Getting the size on the screen

I making video games, its a good idea to make the games
playable on any size on screen or montior. Im trying to
do that. What Im trying to do here is: when the game starts
the program check what size screen the computer has, and
then open a window to that size. Does anyone know how to do this?
Im thinking its something like this:
ScreenDevice sd = ScreenDevice.getDefaultScreenDevice();
// and then on from there..
Can anyone help me out?
Thanks

this is the most correct way of doing it :-
GraphicsEnvironment ge = GraphicsEnvironment.getLocalEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice(); //this line uses the primary monitor only
//you could modify it to take into account multi-monitor systems
DisplayMode dm = gd.getDisplayMode();
dm.getWidth();
dm.getHeight();however, you can also do this :-
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
d.getWidth();
d.getHeight();all this info is available in the javadoc ;p

Similar Messages

Maybe you are looking for

  • Recovery Disc Not Working

    Have a friends model A205-7458 that he was downloading a file onto a USB HD when apparntly the printer cable got hooked on the USB drive and yanked it out. System now will not load and hits a corrupt file message in \windows\system32\drivers\fileinfo

  • Very Urjent Help Needed

    Hi All, Again i am here for your valuable suggestion and help. I dont know User Exit. I got a situation like below. Plz give me some step by step process to resolve the issue, My time is very short.. so if u can give the exact full steps it will be v

  • Is there any .obr files  related to Oracle SOA Suite 10.1.3.1.0 ? if yes then i want to open that .obr files  in Oracle SOA Suite 11g environment

    is there any .obr files  related to Oracle SOA Suite 10.1.3.1.0 ? if yes then i want to open that .obr files  in Oracle SOA Suite 11g environment . is it related to Oracle Business Rules ?

  • Random record retrieval problem

    At this point I'm sort of desperate as this has been going on for a few weeks now. I missed this part of the forum an dposted the problem here: thread If anyone can help I would very much apprecfiate that!

  • Why still can not update thunderbolt update 1.2.1

    I had newly bought a Thunderbolt Ethernet Adapter for my late 2010 MacAir. However, when I try to install the Thunderbolt update 1.2.1 and it keep shows "This software is not support in this system". Can someone tell me why ? and How can I solve this