0

I am using JDesktopPane, and I want it to be maximized when I load it. How can I do it?

JoseK
  • 31,141
  • 14
  • 104
  • 131
noke
  • 3
  • 1
  • 2
  • 3

1 Answers1

0

Set the encompassing container's layout to BorderLayout and add the JDesktopPane to the CENTER. Then set the window to maximized.

JFrame f = new JFrame();
f.setLayout(new BorderLayout());
JDesktopPane jDesktopPane = new JDesktopPane();
f.add(jDesktopPane, BorderLayout.CENTER);
...
f.setExtendedState(MAXIMIZED_BOTH);
brian_d
  • 11,190
  • 5
  • 47
  • 72