Java Visible Screen
For Mac OS X you can use Toolkit.getScreenInsets() to setup a full size GUI without rendering into the menubar or the Dock.
An update with more detail:
An update with more detail:
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
// this only works for one screen, if you need to access more than one
// you will need to loop through every GraphicsDevice
Insets in = Toolkit.getDefaultToolkit().getScreenInsets(gs[0].getConfigurations()[0]);
Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
left = in.left;
right = size.width - in.left - in.right;
top = in.top;
bottom = size.height - in.top - in.bottom;
setBounds(left, top, right, bottom);
GraphicsDevice[] gs = ge.getScreenDevices();
// this only works for one screen, if you need to access more than one
// you will need to loop through every GraphicsDevice
Insets in = Toolkit.getDefaultToolkit().getScreenInsets(gs[0].getConfigurations()[0]);
Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
left = in.left;
right = size.width - in.left - in.right;
top = in.top;
bottom = size.height - in.top - in.bottom;
setBounds(left, top, right, bottom);
0 Comments:
Post a Comment
<< Home