does the saying "don't optimise" hold true for GUI?

?

-

e.g

setLocation((int)
(Toolkit.getDefaultToolkit().getScreenSize().getWidth() /
getWidth() / 2), (int)
(Toolkit.getDefaultToolkit().getScreenSize().getHeight() /
getHeight() / 2));

or

Dimension screenSize = (Toolkit.getDefaultToolkit().getScreenSize();
setLocation((int) screenSize.getWidth() / getWidth() / 2), (int)
(scrrenSize.getHeight() / getHeight() / 2));
 
A

Angus Parvis

I'd prefer the seconds version. It's code is shorter and better readable
than the first one.
 
C

Chris Smith

- said:
e.g

setLocation((int)
(Toolkit.getDefaultToolkit().getScreenSize().getWidth() /
getWidth() / 2), (int)
(Toolkit.getDefaultToolkit().getScreenSize().getHeight() /
getHeight() / 2));

or

Dimension screenSize = (Toolkit.getDefaultToolkit().getScreenSize();
setLocation((int) screenSize.getWidth() / getWidth() / 2), (int)
(scrrenSize.getHeight() / getHeight() / 2));

setLocationRelativeTo(null);

(And yes, I know that's dodging the question. Nevertheless, I think
there's some kind of lesson here.)

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top