Ashutosh
Ashutosh

Reputation: 324

Taskbar hides jFrame on startup?

When my projects starts the lower part of the main Jframe goes beneath the taskbar.

enter image description here

how to solve this problem.

Upvotes: 2

Views: 217

Answers (1)

camickr
camickr

Reputation: 324207

Don't use frame.setSize(...);

Instead use:

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

Or if you do manually need to set the size then use:

Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
Insets insets = frame.getInsets();

and then make sure you subtract out the insets.top and inserts.bottom from the height of the screen. Then the size of your frame must be less then that value.

Upvotes: 3

Related Questions