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

[509 byte] By [pommyJavaa] at [2007-9-28 6:40:47]
# 1

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

Abusea at 2007-7-9 17:52:28 > top of Java-index,Other Topics,Java Game Development...