N
Neutrino
Hello,
I'm trying to specify a size for a JPanel component inside a JFrame. I use
the methos setSize, but this is not working, I cannot find the reason, could
you help me to find my mistake ?
Thanks a lot,
AR
.....
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setTitle ("Statistics");
setSize (600,600); // --> IS WORKING
Container contentPane = getContentPane();
JPanel win = new JPanel ();
win.setLayout(new BoxLayout(win, BoxLayout.Y_AXIS));
win.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JPanel up = new JPanel ();
up.setBorder (BorderFactory.createTitledBorder ("Statistics"));
up.setLayout(new BoxLayout(up, BoxLayout.Y_AXIS));
up.setAlignmentX(Component.CENTER_ALIGNMENT);
up.setSize (180, 100); // --> NOT WORKING
// There is here some JLabel....
win.add (up);
contentPane.add (win);
//pack ();
setVisible (true);
....
I'm trying to specify a size for a JPanel component inside a JFrame. I use
the methos setSize, but this is not working, I cannot find the reason, could
you help me to find my mistake ?
Thanks a lot,
AR
.....
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setTitle ("Statistics");
setSize (600,600); // --> IS WORKING
Container contentPane = getContentPane();
JPanel win = new JPanel ();
win.setLayout(new BoxLayout(win, BoxLayout.Y_AXIS));
win.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JPanel up = new JPanel ();
up.setBorder (BorderFactory.createTitledBorder ("Statistics"));
up.setLayout(new BoxLayout(up, BoxLayout.Y_AXIS));
up.setAlignmentX(Component.CENTER_ALIGNMENT);
up.setSize (180, 100); // --> NOT WORKING
// There is here some JLabel....
win.add (up);
contentPane.add (win);
//pack ();
setVisible (true);
....