Java Code Examples for java.awt.Frame#isResizable()

The following examples show how to use java.awt.Frame#isResizable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlatTitlePane.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
protected void frameStateChanged() {
	if( window == null || rootPane.getWindowDecorationStyle() != JRootPane.FRAME )
		return;

	if( window instanceof Frame ) {
		Frame frame = (Frame) window;
		boolean resizable = frame.isResizable();
		boolean maximized = ((frame.getExtendedState() & Frame.MAXIMIZED_BOTH) != 0);

		iconifyButton.setVisible( true );
		maximizeButton.setVisible( resizable && !maximized );
		restoreButton.setVisible( resizable && maximized );
	} else {
		// hide buttons because they are only supported in frames
		iconifyButton.setVisible( false );
		maximizeButton.setVisible( false );
		restoreButton.setVisible( false );

		revalidate();
		repaint();
	}
}
 
Example 2
Source File: XFramePeer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 3
Source File: XFramePeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 4
Source File: XFramePeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 5
Source File: XFramePeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 6
Source File: XFramePeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 7
Source File: XFramePeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = XWindowAttributesData.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = XWindowAttributesData.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 8
Source File: XFramePeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 9
Source File: XFramePeer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 10
Source File: XFramePeer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 11
Source File: XFramePeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 12
Source File: XFramePeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 13
Source File: XFramePeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 14
Source File: XFramePeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 15
Source File: BETitlePane.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the state of the window. If <code>updateRegardless</code> is
 * true and the state has not changed, this will update anyway.
 *
 * @param state the state
 * @param updateRegardless the update regardless
 */
private void setState(int state, boolean updateRegardless)
{
	Window w = getWindow();

	if (w != null && getWindowDecorationStyle() == JRootPane.FRAME)
	{
		if (this.state == 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(restoreAction, minimizeIcon, minimizeIcon_rover, minimizeIcon_pressed);
					maximizeAction.setEnabled(false);
					restoreAction.setEnabled(true);
				}
				else
				{
					updateToggleButton(maximizeAction, maximizeIcon, maximizeIcon_rover, maximizeIcon_pressed);
					maximizeAction.setEnabled(true);
					restoreAction.setEnabled(false);
				}
				if (toggleButton.getParent() == null
						|| iconifyButton.getParent() == null)
				{
					add(toggleButton);
					add(iconifyButton);
					revalidate();
					repaint();
				}
				toggleButton.setText(null);
			}
			else
			{
				maximizeAction.setEnabled(false);
				restoreAction.setEnabled(false);
				if (toggleButton.getParent() != null)
				{
					remove(toggleButton);
					revalidate();
					repaint();
				}
			}
		}
		else
		{
			// Not contained in a Frame
			maximizeAction.setEnabled(false);
			restoreAction.setEnabled(false);
			iconifyAction.setEnabled(false);
			remove(toggleButton);
			remove(iconifyButton);
			revalidate();
			repaint();
		}
		closeAction.setEnabled(true);
		this.state = state;
	}
}