private void restore() { Frame frame = getFrame(); if (frame == null) { return; } if ((myState & Frame.ICONIFIED) != 0) { frame.setExtendedState(myState & ~Frame.ICONIFIED); } else { frame.setExtendedState(myState & ~Frame.MAXIMIZED_BOTH); } }
public void propertyChange(PropertyChangeEvent pce) { String name = pce.getPropertyName(); if ("resizable".equals(name) || "state".equals(name)) { Frame frame = getFrame(); if (frame != null) { setState(frame.getExtendedState(), true); } if ("resizable".equals(name)) { getRootPane().repaint(); } } else if ("title".equals(name)) { repaint(); } else if ("componentOrientation" == name) { revalidate(); repaint(); } else if ("iconImage" == name) { updateSystemIcon(); revalidate(); repaint(); } }
private void setState(int state, boolean updateRegardless) { Window wnd = getWindow(); if (wnd != null && getWindowDecorationStyle() == JRootPane.FRAME) { if (myState == state && !updateRegardless) { return; } Frame frame = getFrame(); if (frame != null) { JRootPane rootPane = getRootPane(); if (((state & Frame.MAXIMIZED_BOTH) != 0) && (rootPane.getBorder() == null || (rootPane.getBorder() instanceof UIResource)) && frame.isShowing()) { rootPane.setBorder(null); } else if ((state & Frame.MAXIMIZED_BOTH) == 0) { // This is a croak, if state becomes bound, this can // be nuked. rootPaneUI.installBorder(rootPane); } if (frame.isResizable()) { if ((state & Frame.MAXIMIZED_BOTH) != 0) { updateToggleButton(myRestoreAction, myMinimizeIcon); myMaximizeAction.setEnabled(false); myRestoreAction.setEnabled(true); } else { updateToggleButton(myMaximizeAction, myMaximizeIcon); myMaximizeAction.setEnabled(true); myRestoreAction.setEnabled(false); } if (myToggleButton.getParent() == null || myIconifyButton.getParent() == null) { add(myToggleButton); add(myIconifyButton); revalidate(); repaint(); } myToggleButton.setText(null); } else { myMaximizeAction.setEnabled(false); myRestoreAction.setEnabled(false); if (myToggleButton.getParent() != null) { remove(myToggleButton); revalidate(); repaint(); } } } else { // Not contained in a Frame myMaximizeAction.setEnabled(false); myRestoreAction.setEnabled(false); myIconifyAction.setEnabled(false); remove(myToggleButton); remove(myIconifyButton); revalidate(); repaint(); } myCloseAction.setEnabled(true); myState = state; } }
private void maximize() { Frame frame = getFrame(); if (frame != null) { frame.setExtendedState(myState | Frame.MAXIMIZED_BOTH); } }
private void iconify() { Frame frame = getFrame(); if (frame != null) { frame.setExtendedState(myState | Frame.ICONIFIED); } }