Ramesh-X
Ramesh Pramuditha Rathnayake wrote:You have to choose the best way to create and show a JFrame according to your program.
Maneesh Godbole wrote:
No he has not.
Like Rob said GUI operations should happen on the EDT. Also the call to setVisible should be the last one (after setting the title, icon size etc)
Ramesh-X
Ramesh Pramuditha Rathnayake wrote: Then setVisible should be called before.. There is no rule of calling setVisible() method. Programmer has to decide the best place to call the setVisible().
Therefore the best way is depend from program to program...
Ramesh-X
Think of a JFrame where its icon is changed dynamically as user given. Then setVisible should be called before..
Rob Camick wrote:Of course if there is user interaction you need to be able to update the GUI after it is visible. The advice given here is for initially creating and displaying the GUI.
Ramesh-X
Ramesh Pramuditha Rathnayake wrote:I don't tell that GUI operations should not happen on the EDT. I said that, there is no rule..
luck, db
There are no new questions, but there may be new answers.
Ramesh-X
Ramesh Pramuditha Rathnayake wrote:I said here to use codes in the best way that fits to the program. Not to the programmer..!
Ramesh Pramuditha Rathnayake wrote:You have to choose the best way to create and show a JFrame according to your program.
Paul Clapham wrote:In this case, the best way to fit to the program is to initialize the GUI and then call its setVisible method. Sure, the programmer has to decide to do that and not to do something which is different and inferior, but the decision process isn't a difficult one. "Call setVisible at the end of initialization -- check".
Ramesh-X
Ramesh Pramuditha Rathnayake wrote:In this program setSize() is called after the setVisible() method.. But I think no one can do the vice versa..
Ramesh-X
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |