1

I would like to know is ther any programmaticly way createing JFrame I mean which is correct

JFrame frame = new JFrame("title");
            frame.pack();
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            frame.setVisible(true);
            frame.setSize(250,200);
      or

JFrame frame = new JFrame("title");
            frame.setSize(250,200);
            frame.pack();
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            frame.setVisible(true);

      or
JFrame frame = new JFrame("title");
            frame.setSize(250,200);
            frame.pack();
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            frame.setVisible(true);

now this codes work ok with simple programm but what about if I use threads in bigger programmes

mamur
  • 11
  • 1
  • 2

2 Answers2

2
Community
  • 1
  • 1
Braj
  • 46,415
  • 5
  • 60
  • 76
0

In this case call order is not important, but as a general rule, i would place pack at the end as call of pack is some cases should be last called ( after adding all components to your GUI )

gogic1
  • 111
  • 1
  • 10