Java Code Examples for java.awt.Frame#getExtendedState()
The following examples show how to use
java.awt.Frame#getExtendedState() .
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: XFramePeer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
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 2
Source File: XFramePeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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: WindowManager.java From netbeans with Apache License 2.0 | 6 votes |
/** * Attempts to bring the parent <code>Window</code> of the given <code>TopComponent</code> * to front of other windows. * @see java.awt.Window#toFront() * @since 5.8 */ protected void topComponentToFront(TopComponent tc) { Window parentWindow = SwingUtilities.getWindowAncestor(tc); // be defensive, although w probably will always be non-null here if (null != parentWindow) { if (parentWindow instanceof Frame) { Frame parentFrame = (Frame) parentWindow; int state = parentFrame.getExtendedState(); if ((state & Frame.ICONIFIED) > 0) { parentFrame.setExtendedState(state & ~Frame.ICONIFIED); } } parentWindow.toFront(); } }
Example 4
Source File: XFramePeer.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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-8 with GNU General Public License v2.0 | 6 votes |
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 with GNU General Public License v2.0 | 6 votes |
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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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 8
Source File: XFramePeer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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: OptionsHandler.java From JPPF with Apache License 2.0 | 6 votes |
/** * Save the specified frame state to the preferences store. * @param frame the frame for which the attributes are saved. * @param pref the preferences node where the attributes are saved. */ public static void saveFrameAttributes(final Frame frame, final Preferences pref) { final int state = frame.getExtendedState(); final boolean maximized = (state & Frame.MAXIMIZED_BOTH) > 0; if (maximized) frame.setExtendedState(Frame.NORMAL); final java.awt.Point p = frame.getLocation(); pref.putInt("locationx", p.x); pref.putInt("locationy", p.y); final java.awt.Dimension d = frame.getSize(); pref.putInt("width", d.width); pref.putInt("height", d.height); pref.putBoolean("maximized", maximized); try { pref.flush(); } catch(final BackingStoreException e) { log.error(e.getMessage(), e); } }
Example 10
Source File: FlatTitlePane.java From FlatLaf with Apache License 2.0 | 5 votes |
/** * Restores the window size. */ protected void restore() { if( window instanceof Frame ) { Frame frame = (Frame) window; int state = frame.getExtendedState(); frame.setExtendedState( ((state & Frame.ICONIFIED) != 0) ? (state & ~Frame.ICONIFIED) : (state & ~Frame.MAXIMIZED_BOTH) ); } }
Example 11
Source File: WindowList.java From pumpernickel with MIT License | 5 votes |
/** * Returns a list of frames. * * @param sortByLayer * whether to sort by layer or origin. If this is true, then the * lowest index corresponds to the frame farthest behind; the * highest index represents the highest frame. If this is false, * then the lowest index corresponds to the first frame * activated, and the highest index is the most recently * activated frame. * @param includeInvisible * if this is false then visible Frames will be returned. If this * is true then all Frames will be returned, so the next argument * is meaningless. * @param includeIconified * if this is true then iconified Frames will be returned. */ public static Frame[] getFrames(boolean sortByLayer, boolean includeInvisible, boolean includeIconified) { ArrayList<WeakReference<Window>> list = sortByLayer ? windowLayerList : windowList; List<Frame> returnValue = new ArrayList<Frame>(); int a = 0; while (a < list.size()) { WeakReference<Window> r = list.get(a); Window w = r.get(); if (w == null) { list.remove(a); } else { if (w instanceof Frame) { Frame f = (Frame) w; if (includeInvisible || f.isVisible()) { returnValue.add(f); } else if (includeIconified && f.getExtendedState() == Frame.ICONIFIED) { returnValue.add(f); } } a++; } } return returnValue.toArray(new Frame[returnValue.size()]); }
Example 12
Source File: _AppMenuBarHandler.java From hottub with GNU General Public License v2.0 | 4 votes |
static boolean isFrameMinimized(final Frame frame) { return (frame.getExtendedState() & Frame.ICONIFIED) != 0; }
Example 13
Source File: _AppMenuBarHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
static boolean isFrameMinimized(final Frame frame) { return (frame.getExtendedState() & Frame.ICONIFIED) != 0; }
Example 14
Source File: NormalToIconifiedTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { Robot robot = Util.createRobot(); Frame testFrame = new Frame("Test Frame"); testFrame.setSize(200, 200); testFrame.addWindowStateListener(new WindowStateListener() { @Override public void windowStateChanged(WindowEvent e) { listenerNotified.set(true); synchronized (listenerNotified) { listenerNotified.notifyAll(); } } }); testFrame.setVisible(true); Frame mainFrame = new Frame("Main Frame"); mainFrame.setSize(200, 200); mainFrame.setLocationRelativeTo(null); mainFrame.setVisible(true); Util.waitForIdle(robot); try { Util.clickOnComp(mainFrame, robot); Util.waitForIdle(robot); // NORMAL -> ICONIFIED listenerNotified.set(false); testFrame.setExtendedState(Frame.ICONIFIED); Util.waitForIdle(robot); Util.waitForCondition(listenerNotified, 2000); if (!listenerNotified.get()) { throw new RuntimeException("Test FAILED! Window state listener was not notified during NORMAL to" + "ICONIFIED transition"); } if (testFrame.getExtendedState() != Frame.ICONIFIED) { throw new RuntimeException("Test FAILED! Frame is not in ICONIFIED state"); } // ICONIFIED -> NORMAL listenerNotified.set(false); testFrame.setExtendedState(Frame.NORMAL); Util.waitForIdle(robot); Util.waitForCondition(listenerNotified, 2000); if (!listenerNotified.get()) { throw new RuntimeException("Test FAILED! Window state listener was not notified during ICONIFIED to" + "NORMAL transition"); } if (testFrame.getExtendedState() != Frame.NORMAL) { throw new RuntimeException("Test FAILED! Frame is not in NORMAL state"); } } finally { testFrame.dispose(); mainFrame.dispose(); } }
Example 15
Source File: _AppMenuBarHandler.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
static boolean isFrameMinimized(final Frame frame) { return (frame.getExtendedState() & Frame.ICONIFIED) != 0; }
Example 16
Source File: NormalToIconifiedTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { Robot robot = Util.createRobot(); Frame testFrame = new Frame("Test Frame"); testFrame.setSize(200, 200); testFrame.addWindowStateListener(new WindowStateListener() { @Override public void windowStateChanged(WindowEvent e) { listenerNotified.set(true); synchronized (listenerNotified) { listenerNotified.notifyAll(); } } }); testFrame.setVisible(true); Frame mainFrame = new Frame("Main Frame"); mainFrame.setSize(200, 200); mainFrame.setLocationRelativeTo(null); mainFrame.setVisible(true); Util.waitForIdle(robot); try { Util.clickOnComp(mainFrame, robot); Util.waitForIdle(robot); // NORMAL -> ICONIFIED listenerNotified.set(false); testFrame.setExtendedState(Frame.ICONIFIED); Util.waitForIdle(robot); Util.waitForCondition(listenerNotified, 2000); if (!listenerNotified.get()) { throw new RuntimeException("Test FAILED! Window state listener was not notified during NORMAL to" + "ICONIFIED transition"); } if (testFrame.getExtendedState() != Frame.ICONIFIED) { throw new RuntimeException("Test FAILED! Frame is not in ICONIFIED state"); } // ICONIFIED -> NORMAL listenerNotified.set(false); testFrame.setExtendedState(Frame.NORMAL); Util.waitForIdle(robot); Util.waitForCondition(listenerNotified, 2000); if (!listenerNotified.get()) { throw new RuntimeException("Test FAILED! Window state listener was not notified during ICONIFIED to" + "NORMAL transition"); } if (testFrame.getExtendedState() != Frame.NORMAL) { throw new RuntimeException("Test FAILED! Frame is not in NORMAL state"); } } finally { testFrame.dispose(); mainFrame.dispose(); } }
Example 17
Source File: Central.java From netbeans with Apache License 2.0 | 4 votes |
/** */ public void activateModeTopComponent(ModeImpl mode, TopComponent tc) { if(!getModeOpenedTopComponents(mode).contains(tc)) { return; } ModeImpl oldActiveMode = getActiveMode(); //#45650 -some API users call the activation all over again all the time on one item. // improve performance for such cases. if (oldActiveMode != null && oldActiveMode.equals(mode)) { if (tc != null && tc.equals(model.getModeSelectedTopComponent(mode))) { // #82385, #139319 do repeat activation if focus is not // owned by tc to be activated Component fOwn = KeyboardFocusManager.getCurrentKeyboardFocusManager(). getFocusOwner(); if (fOwn != null && SwingUtilities.isDescendingFrom(fOwn, tc)) { //#70173 - activation request came probably from a sliding //window in 'hover' mode, so let's hide it slideOutSlidingWindows( mode ); return; } } } model.setActiveMode(mode); model.setModeSelectedTopComponent(mode, tc); if(isVisible()) { viewRequestor.scheduleRequest(new ViewRequest(mode, View.CHANGE_TOPCOMPONENT_ACTIVATED, null, tc)); //restore floating windows if iconified if( mode.getState() == Constants.MODE_STATE_SEPARATED ) { Frame frame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, tc); if( null != frame && frame != WindowManagerImpl.getInstance().getMainWindow() && (frame.getExtendedState() & Frame.ICONIFIED) > 0 ) { frame.setExtendedState(frame.getExtendedState() - Frame.ICONIFIED ); } } } // Notify registry. WindowManagerImpl.notifyRegistryTopComponentActivated(tc); if(oldActiveMode != mode) { WindowManagerImpl.getInstance().doFirePropertyChange( WindowManagerImpl.PROP_ACTIVE_MODE, oldActiveMode, mode); } }
Example 18
Source File: _AppMenuBarHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
static boolean isFrameMinimized(final Frame frame) { return (frame.getExtendedState() & Frame.ICONIFIED) != 0; }
Example 19
Source File: _AppMenuBarHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
static boolean isFrameMinimized(final Frame frame) { return (frame.getExtendedState() & Frame.ICONIFIED) != 0; }
Example 20
Source File: NormalToIconifiedTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { Robot robot = Util.createRobot(); Frame testFrame = new Frame("Test Frame"); testFrame.setSize(200, 200); testFrame.addWindowStateListener(new WindowStateListener() { @Override public void windowStateChanged(WindowEvent e) { listenerNotified.set(true); synchronized (listenerNotified) { listenerNotified.notifyAll(); } } }); testFrame.setVisible(true); Frame mainFrame = new Frame("Main Frame"); mainFrame.setSize(200, 200); mainFrame.setLocationRelativeTo(null); mainFrame.setVisible(true); Util.waitForIdle(robot); try { Util.clickOnComp(mainFrame, robot); Util.waitForIdle(robot); // NORMAL -> ICONIFIED listenerNotified.set(false); testFrame.setExtendedState(Frame.ICONIFIED); Util.waitForIdle(robot); Util.waitForCondition(listenerNotified, 2000); if (!listenerNotified.get()) { throw new RuntimeException("Test FAILED! Window state listener was not notified during NORMAL to" + "ICONIFIED transition"); } if (testFrame.getExtendedState() != Frame.ICONIFIED) { throw new RuntimeException("Test FAILED! Frame is not in ICONIFIED state"); } // ICONIFIED -> NORMAL listenerNotified.set(false); testFrame.setExtendedState(Frame.NORMAL); Util.waitForIdle(robot); Util.waitForCondition(listenerNotified, 2000); if (!listenerNotified.get()) { throw new RuntimeException("Test FAILED! Window state listener was not notified during ICONIFIED to" + "NORMAL transition"); } if (testFrame.getExtendedState() != Frame.NORMAL) { throw new RuntimeException("Test FAILED! Frame is not in NORMAL state"); } } finally { testFrame.dispose(); mainFrame.dispose(); } }