Java Code Examples for java.awt.Component#isShowing()
The following examples show how to use
java.awt.Component#isShowing() .
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: JavaElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 6 votes |
private void fillUp(List<Component> allComponents, Component c) { if (!c.isVisible() || !c.isShowing()) { return; } allComponents.add(c); if (c instanceof Container) { Component[] components = ((Container) c).getComponents(); for (Component component : components) { fillUp(allComponents, component); } } if (c instanceof Window) { Window[] ownedWindows = ((Window) c).getOwnedWindows(); for (Window window : ownedWindows) { fillUp(allComponents, window); } } }
Example 2
Source File: JComponentOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean checkComponent(Component comp) { if (comp.isShowing() && comp instanceof Window) { ComponentSearcher cs = new ComponentSearcher((Container) comp); cs.setOutput(JemmyProperties.getCurrentOutput().createErrorOutput()); return (cs.findComponent(ppFinder) != null); } return false; }
Example 3
Source File: SunDropTargetContextPeer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * actual processing on EventQueue Thread */ protected void processEnterMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); Point hots = event.getPoint(); local = getJVMLocalSourceTransferable(); if (currentDTC != null) { // some wreckage from last time currentDTC.removeNotify(); currentDTC = null; } if (c.isShowing() && dt != null && dt.isActive()) { currentDT = dt; currentDTC = currentDT.getDropTargetContext(); currentDTC.addNotify(this); currentA = dt.getDefaultActions(); try { ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC, hots, currentDA, currentSA)); } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDT = null; currentDTC = null; currentDA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentA = DnDConstants.ACTION_NONE; } }
Example 4
Source File: SunDropTargetContextPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * actual processing on EventQueue Thread */ protected void processEnterMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); Point hots = event.getPoint(); local = getJVMLocalSourceTransferable(); if (currentDTC != null) { // some wreckage from last time currentDTC.removeNotify(); currentDTC = null; } if (c.isShowing() && dt != null && dt.isActive()) { currentDT = dt; currentDTC = currentDT.getDropTargetContext(); currentDTC.addNotify(this); currentA = dt.getDefaultActions(); try { ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC, hots, currentDA, currentSA)); } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDT = null; currentDTC = null; currentDA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentA = DnDConstants.ACTION_NONE; } }
Example 5
Source File: SunDropTargetContextPeer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * actual processing on EventQueue Thread */ protected void processEnterMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); Point hots = event.getPoint(); local = getJVMLocalSourceTransferable(); if (currentDTC != null) { // some wreckage from last time currentDTC.removeNotify(); currentDTC = null; } if (c.isShowing() && dt != null && dt.isActive()) { currentDT = dt; currentDTC = currentDT.getDropTargetContext(); currentDTC.addNotify(this); currentA = dt.getDefaultActions(); try { ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC, hots, currentDA, currentSA)); } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDT = null; currentDTC = null; currentDA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentA = DnDConstants.ACTION_NONE; } }
Example 6
Source File: FrameWaiter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean checkComponent(Component comp) { if (comp instanceof Frame) { return ((FIND_INVISIBLE_WINDOWS || (comp.isShowing() && comp.isVisible())) && chooser.checkComponent(comp)); } else { return false; } }
Example 7
Source File: SunDropTargetContextPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * actual processing on EventQueue Thread */ protected void processEnterMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); Point hots = event.getPoint(); local = getJVMLocalSourceTransferable(); if (currentDTC != null) { // some wreckage from last time currentDTC.removeNotify(); currentDTC = null; } if (c.isShowing() && dt != null && dt.isActive()) { currentDT = dt; currentDTC = currentDT.getDropTargetContext(); currentDTC.addNotify(this); currentA = dt.getDefaultActions(); try { ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC, hots, currentDA, currentSA)); } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDT = null; currentDTC = null; currentDA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentA = DnDConstants.ACTION_NONE; } }
Example 8
Source File: SunDropTargetContextPeer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * actual processing on EventQueue Thread */ protected void processEnterMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); Point hots = event.getPoint(); local = getJVMLocalSourceTransferable(); if (currentDTC != null) { // some wreckage from last time currentDTC.removeNotify(); currentDTC = null; } if (c.isShowing() && dt != null && dt.isActive()) { currentDT = dt; currentDTC = currentDT.getDropTargetContext(); currentDTC.addNotify(this); currentA = dt.getDefaultActions(); try { ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC, hots, currentDA, currentSA)); } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDT = null; currentDTC = null; currentDA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentA = DnDConstants.ACTION_NONE; } }
Example 9
Source File: SunDropTargetContextPeer.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 10
Source File: SunDropTargetContextPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processDropMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); DropTarget dt = c.getDropTarget(); dropStatus = STATUS_WAIT; // drop pending ACK dropComplete = false; if (c.isShowing() && dt != null && dt.isActive()) { DropTargetContext dtc = dt.getDropTargetContext(); currentDT = dt; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); currentA = dt.getDefaultActions(); synchronized(_globalLock) { if ((local = getJVMLocalSourceTransferable()) != null) setCurrentJVMLocalSourceTransferable(null); } dropInProcess = true; try { ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc, hots, currentDA, currentSA, local != null)); } finally { if (dropStatus == STATUS_WAIT) { rejectDrop(); } else if (dropComplete == false) { dropComplete(false); } dropInProcess = false; } } else { rejectDrop(); } }
Example 11
Source File: SunDropTargetContextPeer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 12
Source File: Test6199676.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private static boolean isShowing(Component component) { return (component != null) && component.isShowing(); }
Example 13
Source File: SunDropTargetContextPeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 14
Source File: Test6199676.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static boolean isShowing(Component component) { return (component != null) && component.isShowing(); }
Example 15
Source File: SunDropTargetContextPeer.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; DropTargetContextAccessor acc = AWTAccessor.getDropTargetContextAccessor(); if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { acc.reset(currentDTC); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { acc.reset(currentDTC); } currentDTC = dtc; acc.setDropTargetContextPeer(currentDTC, this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 16
Source File: PopupAction.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
private Point calculatePosition(Component source) { if (!source.isShowing()) { // should not happen, but better safe than sorry return new Point(0, 0); } int xSource = source.getLocationOnScreen().x; int ySource = source.getLocationOnScreen().y; // get size of popup Dimension popupSize = popupComponent.getSize(); if (popupSize.width == 0) { popupSize = ((Component) popupComponent).getPreferredSize(); } int xPopup = 0; int yPopup = 0; // get max x and y screen coordinates Window focusedWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); if (focusedWindow == null) { // should not happen, but better safe than sorry return new Point(xSource, ySource); } GraphicsConfiguration graphicsConfig = focusedWindow.getGraphicsConfiguration(); if (graphicsConfig == null) { // should not happen, but better safe than sorry return new Point(xSource, ySource); } Rectangle bounds = graphicsConfig.getBounds(); Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(graphicsConfig); int maxScreenX = (int) (bounds.getX() + bounds.getWidth() - screenInsets.right); int maxScreenY = (int) (bounds.getY() + bounds.getHeight() - screenInsets.bottom); switch (position) { case VERTICAL: // place popup at sources' x position xPopup = xSource; // place popup always below source (to avoid overlapping) yPopup = ySource + source.getHeight(); // check if popup is outside active window if (xPopup + popupSize.width > maxScreenX) { // move popup x position to the left // to fit inside the active window xPopup = maxScreenX - popupSize.width - BORDER_OFFSET; } // if the popup now would be moved outside of screen to the left it would look // silly, so in that case just show it at its intended position and let it be cut // off on the right side as we cannot do anything about it if (xPopup < bounds.getX() + screenInsets.left) { xPopup = (int) (bounds.getX() + screenInsets.left); } break; case HORIZONTAL: // place popup always to the right side of the source (to avoid overlapping) xPopup = xSource + source.getWidth(); // place popup at sources' y position yPopup = ySource; // check if popup is outside active window if (yPopup + popupSize.height > maxScreenY) { // move popup upwards to fit into active window yPopup = maxScreenY - popupSize.height - BORDER_OFFSET; } // if the popup now would be moved outside of screen at the top it would look // silly, so in that case just show it at top of screen and let it be cut // off on the bottom side as we cannot do anything about it if (yPopup < bounds.getY() + screenInsets.top) { yPopup = (int) (bounds.getY() + screenInsets.top); } break; } return new Point(xPopup, yPopup); }
Example 17
Source File: SunDropTargetContextPeer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 18
Source File: SunDropTargetContextPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 19
Source File: SunDropTargetContextPeer.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processDropMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); DropTarget dt = c.getDropTarget(); dropStatus = STATUS_WAIT; // drop pending ACK dropComplete = false; if (c.isShowing() && dt != null && dt.isActive()) { DropTargetContext dtc = dt.getDropTargetContext(); currentDT = dt; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); currentA = dt.getDefaultActions(); synchronized(_globalLock) { if ((local = getJVMLocalSourceTransferable()) != null) setCurrentJVMLocalSourceTransferable(null); } dropInProcess = true; try { ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc, hots, currentDA, currentSA, local != null)); } finally { if (dropStatus == STATUS_WAIT) { rejectDrop(); } else if (dropComplete == false) { dropComplete(false); } dropInProcess = false; } } else { rejectDrop(); } }
Example 20
Source File: SunDropTargetContextPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }