How to maximize a TopComponent?

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

Example: How to open the output window in maximized state?

//----open/focus the TC "OutputWindow"
TopComponent tc = WindowManager.getDefault().findTopComponent("output");
if (!tc.isOpened()){;}

//----invoke the maximize action on the previously focused TC
//new way >=7.2
Action action=org.openide.awt.Actions.forID("Window", "");
//OLD way <7.2
//Action action = FileUtil.getConfigObject("Actions/Window/org-netbeans-core-windows-actions-MaximizeWindowAction.instance", Action.class);


"But it’s a hack, not a pretty API:) "

PS: For minimize use

 Action action=org.openide.awt.Actions.forID("Window", "");

Taken from platform-dev mailing list