Off-topic Talk Where overpaid, underworked S2000 owners waste the worst part of their days before the drive home. This forum is for general chit chat and discussions not covered by the other off-topic forums.

Java Question

Thread Tools
 
Old Oct 17, 2005 | 08:55 AM
  #1  
Gink5's Avatar
Thread Starter
Registered User
 
Joined: Aug 2004
Posts: 1,620
Likes: 0
From: Newtown,PA
Default Java Question

I need the code to size a swing window to the default desktop resolution. Any help would be much appreciated.
Reply
Old Oct 17, 2005 | 10:58 AM
  #2  
rbackhouse's Avatar
20 Year Member
Active Streak: 30 Days
Active Streak: 60 Days
 
Joined: Sep 2002
Posts: 450
Likes: 0
From: Apex NC
Default

Originally Posted by Gink5,Oct 17 2005, 11:55 AM
I need the code to size a swing window to the default desktop resolution. Any help would be much appreciated.
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
frame = new JFrame("Window");

frame.setBounds(screenSize.width/12,
screenSize.height/12,
(screenSize.width/12) * 8,
(screenSize.height/12) * 5);

Modify to your required window proportions
Reply
Old Oct 17, 2005 | 11:30 AM
  #3  
Gink5's Avatar
Thread Starter
Registered User
 
Joined: Aug 2004
Posts: 1,620
Likes: 0
From: Newtown,PA
Default

Thanks man.
Reply
Old Oct 17, 2005 | 11:36 AM
  #4  
Gink5's Avatar
Thread Starter
Registered User
 
Joined: Aug 2004
Posts: 1,620
Likes: 0
From: Newtown,PA
Default

Never knew about the toolkit class.
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
s2kfan77
Off-topic Talk
18
Jul 23, 2011 05:25 PM
y3ll0ws2k
Dinner and a Movie
1
Jul 25, 2007 07:43 PM
BMF
The Corner
4
Oct 3, 2002 02:45 PM




All times are GMT -8. The time now is 11:18 AM.