【发布时间】:2012-04-02 23:13:10
【问题描述】:
我需要在我的屏幕上定位 JFrame。但我不能让它们出现在屏幕底部的右侧。
请谁能解释我如何定位它们,如果你能描述如何去做,那就太好了。
这是目前为止的代码。
//Gets the screen size and positions the frame left bottom of the screen
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice defaultScreen = ge.getDefaultScreenDevice();
Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds();
int x = (int)rect.getMinX();
int y = (int)rect.getMaxY()- frame.getHeight();
frame.setLocation(x ,y - 45);
【问题讨论】:
-
一些平台对此进行了限制,如here所述。
标签: java swing jframe point layout-manager