mercredi 11 mars 2015

how do I move around java gui elements?


Panel controlPanel = new Panel ();
JPanel chatPanel = new JPanel();
JPanel buttomsPanel = new JPanel();

controlPanel = new Panel();
controlPanel.setLayout(new FlowLayout(10));



Panel panel = new Panel();

panel.setBackground(Color.DARK_GRAY);
panel.setSize(700,700);
GridLayout layout = new GridLayout(6,6, 10, 10);

panel.setLayout(layout);


for (int i= 0; i < 36; i++){
panel.add(new Button(""));
}
controlPanel.add(panel);


buttomsPanel.add(new Button(""));
frame.add(buttomsPanel);


frame.add(controlPanel);
frame.setSize(900, 700);


Basically the second button that I add to the gui won't be displayed. Also, I want to put another two fields and I do not know how to move them either, or wether they should go into a panel first and then be moved. Thanks!


Aucun commentaire:

Enregistrer un commentaire