/** Returns true when the frame containing the canvas is the foreground window. */ public boolean isActive () { Component root = SwingUtilities.getRoot(canvas); return root instanceof Frame ? ((Frame)root).isActive() : true; }
/** Returns true when the frame containing the canvas is the foreground window. */ public boolean isActive () { Component root = SwingUtilities.getRoot(canvas); return root instanceof Frame ? ((Frame)root).isActive() : true; }
/** Returns true when the frame containing the canvas is the foreground window. */ public boolean isActive () { Component root = SwingUtilities.getRoot(canvas); return root instanceof Frame ? ((Frame)root).isActive() : true; }
/** * We look for an active frame and attach ourselves to that. */ private Frame findActiveOrVisibleFrame() { Frame[] frames = JFrame.getFrames(); for (Frame frame : frames) { if (frame.isActive()) { return frame; } } for (Frame frame : frames) { if (frame.isVisible()) { return frame; } } return null; } }
/** * We look for an active frame and attach ourselves to that. */ private Frame findActiveOrVisibleFrame() { Frame[] frames = JFrame.getFrames(); for (Frame frame : frames) { if (frame.isActive()) { return frame; } } for (Frame frame : frames) { if (frame.isVisible()) { return frame; } } return null; } }
public static Container getActiveContainer() { Frame[] frame = Frame.getFrames(); for (Frame f : frame) { if (f.isActive() && f.isVisible()) { if (f.getSize().width != 0 && f.getSize().height != 0) return f; } } return null; }
Frame frame = new JFrame(); for (Frame f: JFrame.getFrames()) { if (f.isActive()) { frame = f; break;
private boolean cssFileFocused() { WindowManager manager = WindowManager.getDefault(); Frame mainWindow = manager.getMainWindow(); if (mainWindow.isActive()) { TopComponent.Registry registry = manager.getRegistry(); TopComponent activeTC = registry.getActivated(); if (activeTC != null) { if (activeTC instanceof CssStylesTC) { return true; } if (manager.isOpenedEditorTopComponent(activeTC)) { FileObject fob = activeTC.getLookup().lookup(FileObject.class); if ((fob != null) && "text/css".equals(fob.getMIMEType())) { // NOI18N return true; } } } } return false; }