Java Code Examples for java.awt.Component#isShowing()
The following examples show how to use
java.awt.Component#isShowing() .
These examples are extracted from open source projects.
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 Project: marathonv5 File: JavaElementPropertyAccessor.java License: 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 Project: openjdk-8 File: SunDropTargetContextPeer.java License: 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 3
Source Project: jdk8u-jdk File: SunDropTargetContextPeer.java License: 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 Project: openjdk-8-source File: SunDropTargetContextPeer.java License: 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 Project: openjdk-jdk9 File: FrameWaiter.java License: 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 6
Source Project: jdk8u_jdk File: SunDropTargetContextPeer.java License: 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 7
Source Project: jdk8u-jdk File: SunDropTargetContextPeer.java License: 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 Project: openjdk-jdk9 File: JComponentOperator.java License: 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 9
Source Project: Bytecoder File: SunDropTargetContextPeer.java License: 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 10
Source Project: openjdk-jdk8u-backup File: SunDropTargetContextPeer.java License: 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 11
Source Project: dragonwell8_jdk File: SunDropTargetContextPeer.java License: 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 12
Source Project: jdk8u-jdk File: SunDropTargetContextPeer.java License: 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 13
Source Project: TencentKona-8 File: SunDropTargetContextPeer.java License: 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 Project: rapidminer-studio File: PopupAction.java License: 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 15
Source Project: jdk8u60 File: SunDropTargetContextPeer.java License: 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 16
Source Project: jdk8u_jdk File: Test6199676.java License: GNU General Public License v2.0 | 4 votes |
private static boolean isShowing(Component component) { return (component != null) && component.isShowing(); }
Example 17
Source Project: openjdk-jdk8u File: SunDropTargetContextPeer.java License: 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 Project: jdk8u-dev-jdk File: Test6199676.java License: GNU General Public License v2.0 | 4 votes |
private static boolean isShowing(Component component) { return (component != null) && component.isShowing(); }
Example 19
Source Project: jdk8u-dev-jdk File: SunDropTargetContextPeer.java License: 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 20
Source Project: jdk8u-jdk File: SunDropTargetContextPeer.java License: 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(); } }