Apache NetBeans Wiki Index

Note: These pages are being reviewed.

How to maximize a TopComponent?

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

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

//----invoke the maximize action on the previously focused TC
//new way >=7.2
Action action=org.openide.awt.Actions.forID("Window", "org.netbeans.core.windows.actions.MaximizeWindowAction");
//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", "org.netbeans.core.windows.actions.MinimizeWindowAction");

Taken from platform-dev mailing list

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqWindowsMaximizeViaCode , that was last modified by NetBeans user Markiewb on 2013-06-08T07:58:56Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.