This discussion is archived
0 Replies Latest reply: Jul 19, 2011 12:00 AM by 876371 RSS

Clarification on getDefaultScreenSize() method of Toolkit

876371 Newbie
Currently Being Moderated
Consider the below code for getting the Graphics configurations possible on a graphics device.
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
+//Assuming here that only one graphic device is supported.+
GraphicsDevice gd = gs[0];
GraphicsConfiguration[] gc =gd.getConfigurations();

If there are 3 graphics configuration allowed on the device.
1. 1280*720
2. 720*576
3. 960*540

Maximum configuration possible is 1st configuration.
Default configuration is 2nd configuration

and the 3rd graphics configuration is set to the device, what should the method Toolkit.getdefaultToolkit().getScreenSize() return ?

According to In Java 2 Platfor  SE v14.2, the getScreenSize() definition is

Gets the size of the screen. On systems with multiple displays, the primary display is used. Multi-screen aware display dimensions are available from GraphicsConfiguration and GraphicsDevice.

The method returns :
a) The dimension of maximum configuration allowed by the device [Here 1280, 720]
b) The dimension of the default configuration [Here 720, 576]
c) The dimension of the current configuration. [Here 960, 540]

Please let me know whether a, b or c is the right one. I am confused on what needs to be implemented ?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points