0

I see many questions about how to maximize a JFrame without hiding the task bar, but in my case the question is just the opposite. I'm trying to use all of the screen including the task bar in order to have more room for my application. Why does my app not use the whole screen?

Here is what I do:

frame.setExtendedState(frame.getExtendedState() | frame.MAXIMIZED_BOTH);
frame.setVisible(true);

(I work on Mac OS X 10.7)

4

1 回答 1

0

为什么我的应用程序不使用整个屏幕?

因为大多数应用程序希望保持任务栏可用,以便用户可以轻松访问其他应用程序,所以扩展状态方法的行为是将任务栏排除在最大尺寸之外。

我正在尝试使用所有屏幕,包括任务栏

您可以手动设置大小。

frame.setSize( Toolkit.getDefaultToolkit().getScreenSize() );
于 2014-03-23T15:26:39.757 回答