Package swingtree.components
Class JGlassPane
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
swingtree.components.JGlassPane
- All Implemented Interfaces:
- AWTEventListener,- ImageObserver,- MenuContainer,- Serializable,- EventListener,- Accessible,- StylableComponent
A more advanced glass pane implementation than the default Swing
  glass pane of a 
JRootPane object (A regular JPanel.
  In contrast to the default glass pane (JPanel) of a JRootPane,
  this pane handles any mouse events, without interrupting the controls underneath
  the glass pane (in the content pane of the root pane).
  Also, cursors are handled as if the glass pane was invisible
  (if no cursor gets explicitly set to the glass pane).- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class javax.swing.JPanelJPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponentJComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.ContainerContainer.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.ComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
- 
Field SummaryFieldsFields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidaddMouseListener(MouseListener listener) final voidaddMouseMotionListener(MouseMotionListener listener) final voidaddMouseWheelListener(MouseWheelListener listener) protected voidattachToRootPane(JRootPane rootPane) Marries this glass pane to the suppliedJRootPaneobject and detaches it from the previous root pane using thedetachFromRootPane(JRootPane)method, if a previous root pane was attached.booleancontains(int x, int y) If someone sets a new cursor to the GlassPane we expect that they know what they are doing and return the super.contains(x,y) otherwise we return false to respect the cursors for the underneath componentsprotected voiddetachFromRootPane(@Nullable JRootPane rootPane) Detaches this glass pane from the suppliedJRootPaneobject, if theJRootPane.getGlassPane()method returns this glass pane.voideventDispatched(AWTEvent event) final MouseListener[]final MouseMotionListener[]final MouseWheelListener[]voidThis method is expected to be implemented as follows:voidfinal voidremoveMouseListener(MouseListener listener) final voidremoveMouseMotionListener(MouseMotionListener listener) final voidremoveMouseWheelListener(MouseWheelListener listener) voidCertain style configurations require SwingTree to install a custom UI delegate.voidtoRootPane(@Nullable JRootPane pane) Marries this glass pane to aJRootPaneobject.voidupdateUI()Resets the UI property with a value from the current look and feel.Methods inherited from class javax.swing.JPanelgetAccessibleContext, getUI, getUIClassID, paramString, setUIMethods inherited from class javax.swing.JComponentaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Containeradd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Componentaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMousePosition, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface swingtree.style.StylableComponentpaint, paintBackground, paintForeground
- 
Field Details- 
rootPane
 
- 
- 
Constructor Details- 
JGlassPanepublic JGlassPane()
- 
JGlassPane
 
- 
- 
Method Details- 
paintComponent- Overrides:
- paintComponentin class- JComponent
 
- 
paintChildrenThis method is expected to be implemented as follows:@Override public void paintChildren(Graphics g){ paintForeground(g, ()->super.paintChildren(g)); }- Specified by:
- paintChildrenin interface- StylableComponent
- Overrides:
- paintChildrenin class- JComponent
- Parameters:
- g- the graphics context to paint on, obtained from the component's- JComponent::paintChildren(Graphics)method.
 
- 
setUISilentlyDescription copied from interface:StylableComponentCertain style configurations require SwingTree to install a custom UI delegate. This method is used to set the UI delegate for the component but without triggering side effects like the former UI being uninstalled (which itself can cause a lot of undesired side effects).This method is not intended to be called by client code! It exists for internal use only and unfortunately cannot be protected or private due to the nature of the Swing API. The implementation of this method is expected to look like this: @Override public void setUISilently(ComponentUI ui){ this.ui = ui; // no side effects }- Specified by:
- setUISilentlyin interface- StylableComponent
- Parameters:
- ui- the UI delegate to set for the component without triggering side effects.
 
- 
updateUIpublic void updateUI()Resets the UI property with a value from the current look and feel.
- 
attachToRootPaneMarries this glass pane to the suppliedJRootPaneobject and detaches it from the previous root pane using thedetachFromRootPane(JRootPane)method, if a previous root pane was attached.- Parameters:
- rootPane- The- JRootPaneobject to which this glass pane should be attached.
 
- 
detachFromRootPaneDetaches this glass pane from the suppliedJRootPaneobject, if theJRootPane.getGlassPane()method returns this glass pane.- Parameters:
- rootPane- The- JRootPaneobject from which this glass pane should be detached.
 
- 
toRootPaneMarries this glass pane to aJRootPaneobject. Note that it is expected that the suppliedJRootPaneis the same root pane that this current glass pane is attached to. If the suppliedJRootPaneisnull, then this glass pane is detached from the current root pane.- Parameters:
- pane- The- JRootPaneobject to which this glass pane should be attached.
 
- 
getMouseListeners- Overrides:
- getMouseListenersin class- Component
 
- 
addMouseListener- Overrides:
- addMouseListenerin class- Component
 
- 
removeMouseListener- Overrides:
- removeMouseListenerin class- Component
 
- 
getMouseMotionListeners- Overrides:
- getMouseMotionListenersin class- Component
 
- 
addMouseMotionListener- Overrides:
- addMouseMotionListenerin class- Component
 
- 
removeMouseMotionListener- Overrides:
- removeMouseMotionListenerin class- Component
 
- 
getMouseWheelListeners- Overrides:
- getMouseWheelListenersin class- Component
 
- 
addMouseWheelListener- Overrides:
- addMouseWheelListenerin class- Component
 
- 
removeMouseWheelListener- Overrides:
- removeMouseWheelListenerin class- Component
 
- 
eventDispatched- Specified by:
- eventDispatchedin interface- AWTEventListener
 
- 
containspublic boolean contains(int x, int y) If someone sets a new cursor to the GlassPane we expect that they know what they are doing and return the super.contains(x,y) otherwise we return false to respect the cursors for the underneath components- Overrides:
- containsin class- JComponent
 
 
-