/** Impl of ActionListener, called from hierarchyChanged through a Timer, * starts the job */ @Override public void actionPerformed(ActionEvent ae) { if (wasCancelled || (initTask != null)) { //If cancelled or already started, our job is done, go away. LOG.log(Level.FINE, "Detaching {0}", comp4Init); detach(); return; } if ((comp4Init != null) && comp4Init.isDisplayable()) { //If the component has a parent onscreen, we're ready to run. LOG.log(Level.FINE, "Starting {0}", comp4Init); start(); } }
@Override public void hierarchyChanged(HierarchyEvent e) { if(e.getChangeFlags() == HierarchyEvent.DISPLAYABILITY_CHANGED) { if(e.getChanged().isDisplayable()) { onCreated(); } else { onDestroyed(); } } } });
@Override public void hierarchyChanged(HierarchyEvent e) { if(e.getChangeFlags() == HierarchyEvent.DISPLAYABILITY_CHANGED) { if(e.getChanged().isDisplayable()) { onCreated(); } else { onDestroyed(); } } } });
/** Impl of ActionListener, called from hierarchyChanged through a Timer, * starts the job */ @Override public void actionPerformed(ActionEvent ae) { if (wasCancelled || (initTask != null)) { //If cancelled or already started, our job is done, go away. LOG.log(Level.FINE, "Detaching {0}", comp4Init); detach(); return; } if ((comp4Init != null) && comp4Init.isDisplayable()) { //If the component has a parent onscreen, we're ready to run. LOG.log(Level.FINE, "Starting {0}", comp4Init); start(); } }
static long getComponentID(Object o) throws HeadlessException { if (GraphicsEnvironment.isHeadless()) { throw new HeadlessException("No native windows when headless"); } Component c = (Component)o; if (c.isLightweight()) { throw new IllegalArgumentException("Component must be heavyweight"); } if (!c.isDisplayable()) throw new IllegalStateException("Component must be displayable"); // On X11 VMs prior to 1.5, the window must be visible if (Platform.isX11() && System.getProperty("java.version").startsWith("1.4")) { if (!c.isVisible()) { throw new IllegalStateException("Component must be visible"); } } // By this point, we're certain that Toolkit.loadLibraries() has // been called, thus avoiding AWT/JAWT link errors // (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6539705). return Native.getWindowHandle0(c); } }
/** Overriden to delegate call to user component. */ @Override public void requestFocus() { if ((rightComponent != null) && rightComponent.isDisplayable()) { JComponent comp = (JComponent) rightComponent; Container rootAnc = comp.getFocusCycleRootAncestor(); FocusTraversalPolicy policy = rootAnc.getFocusTraversalPolicy(); Component focus = policy.getComponentAfter(rootAnc, comp); if (focus != null) { focus.requestFocus(); } else { comp.requestFocus(); } } else { super.requestFocus(); } }
@Override public boolean isInReadyState(Object mainTimelineObject) { return ((Component) mainTimelineObject).isDisplayable(); }
private String str(final Object obj) { if( null == obj ) { return "0xnil: null"; } else if( obj instanceof Component ) { final Component c = (Component)obj; return id(obj)+": "+c.getClass().getSimpleName()+"[visible "+c.isVisible()+", showing "+c.isShowing()+", valid "+c.isValid()+ ", displayable "+c.isDisplayable()+", "+c.getX()+"/"+c.getY()+" "+c.getWidth()+"x"+c.getHeight()+"]"; } else { return id(obj)+": "+obj.getClass().getSimpleName()+"[..]"; } } private String s(final ComponentEvent e) {
@Override public void attach(LibVlc libvlc, MediaPlayer mediaPlayer) { if(component.isDisplayable()) { long componentId = getComponentId(component); videoSurfaceAdapter.attach(libvlc, mediaPlayer, componentId); } else { throw new IllegalStateException("The video surface component must be displayable"); } }
public void actionPerformed (ActionEvent ae) { if (wasCancelled || initTask != null) { //If cancelled or already started, our job is done, go away. detach(); return; } if (comp4Init != null && comp4Init.isDisplayable()) { //If the component has a parent onscreen, we're ready to run. start(); } }
public void actionPerformed (ActionEvent ae) { if (wasCancelled || initTask != null) { //If cancelled or already started, our job is done, go away. detach(); return; } if (comp4Init != null && comp4Init.isDisplayable()) { //If the component has a parent onscreen, we're ready to run. start(); } }
private void tryRestoringFocusOwner() { if (focusOwner != null) { if (focusOwner.isDisplayable() && focusOwner.isShowing()) { focusOwner.requestFocus(); } } }
/** * There are four standard tests which determine if Swing will be able to request focus for a component. Test them. * * @param comp * @return does the specified component pass the four focusability tests */ public static boolean passesFocusabilityTest(Component comp) { return ((comp != null) && comp.isEnabled() && comp.isDisplayable() && comp.isVisible() && comp.isFocusable() && comp.isShowing()); }
@Override public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 && e.getComponent().isDisplayable()) { e.getComponent().removeHierarchyListener(this); action.run(); } } });
/** * Tells whether <code>component</code> can be focused or not. * @param component some {@link Component} which might gain the focus. * @return <code>true</code> if <code>component</code> is allowed to * gain the focus, <code>false</code> otherwise */ protected boolean accept( Component component ){ return component.isFocusable() && component.isEnabled() && component.isDisplayable() && component.isShowing(); }
/** * Tells whether <code>component</code> can be focused or not. * @param component some {@link Component} which might gain the focus. * @return <code>true</code> if <code>component</code> is allowed to * gain the focus, <code>false</code> otherwise */ protected boolean accept( Component component ){ return component.isFocusable() && component.isEnabled() && component.isDisplayable() && component.isShowing(); }
protected AnimatedLabel() { super(); setIcon(icon); addHierarchyListener(e -> { if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 && !e.getComponent().isDisplayable()) { animator.stop(); } }); }
public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 && e.getComponent().isDisplayable()) { e.getComponent().removeHierarchyListener(this); action.run(); } } });
@Override public void hierarchyChanged(HierarchyEvent e) { if(e.getChangeFlags() == HierarchyEvent.DISPLAYABILITY_CHANGED) { if(e.getChanged().isDisplayable()) { onCreated(); } else { onDestroyed(); } } } });
@Override public void hierarchyChanged(HierarchyEvent e) { if(e.getChangeFlags() == HierarchyEvent.DISPLAYABILITY_CHANGED) { if(e.getChanged().isDisplayable()) { onCreated(); } else { onDestroyed(); } } } });