samedi 30 avril 2016

Need help in GUI

For button Back and button Delete, I have setBounds to (130, 120, 195,30); and (10, 190, 195,30); , but they still doesn't move to bottom.

What's wrong here ?

enter image description here

public deleteAdmin(int num)
    {
        super("Delete Admin");
        setBounds(100, 200, 340, 229);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);

        JPanel panel = new JPanel();
        panel.setBounds(35, 19, 242, 146);
        contentPane.add(panel);

        JButton button = new JButton("Back");
        button.setBounds(130, 120, 195,30);
        panel.add(button);

        JButton bckButton = new JButton("Delete");
        bckButton.setBounds(10, 190, 195,30);
        panel.add(bckButton);

        adminAPI admin = new adminAPI();
        List<String>allName = null;
        try {
            allName= admin.displayName();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        //System.out.println(allName);
        Object [] o1=allName.toArray();
        JCheckBox[] checkBoxList = new JCheckBox[num];
        System.out.println(allName);
         //JLabel[] names = new JLabel[num];
        for(int i = 0; i < num; i++) {   
            checkBoxList[i] = new JCheckBox(""+o1[i]);
            System.out.println(o1[i]);
           contentPane.add(checkBoxList[i]);

        }


    }




Aucun commentaire:

Enregistrer un commentaire