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 Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addMouseListener
(MouseListener listener) final void
addMouseMotionListener
(MouseMotionListener listener) final void
addMouseWheelListener
(MouseWheelListener listener) protected void
attachToRootPane
(JRootPane rootPane) 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 componentsprotected void
detachFromRootPane
(@Nullable JRootPane rootPane) void
eventDispatched
(AWTEvent event) final MouseListener[]
final MouseMotionListener[]
final MouseWheelListener[]
void
This method is expected to be implemented as follows within a component extension which ought to be made compatible with SwingTree.void
This method is expected to be implemented as follows:final void
removeMouseListener
(MouseListener listener) final void
removeMouseMotionListener
(MouseMotionListener listener) final void
removeMouseWheelListener
(MouseWheelListener listener) void
Certain style configurations require SwingTree to install a custom UI delegate.void
toRootPane
(@Nullable JRootPane pane) void
updateUI()
Resets the UI property with a value from the current look and feel.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, paintBorder, paintComponent, 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, update
Methods inherited from class java.awt.Container
add, 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, validateTree
Methods inherited from class java.awt.Component
action, 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, transferFocusUpCycle
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface swingtree.style.StylableComponent
paintBackground, paintForeground
-
Field Details
-
rootPane
-
-
Constructor Details
-
JGlassPane
public JGlassPane() -
JGlassPane
-
-
Method Details
-
paint
This method is expected to be implemented as follows within a component extension which ought to be made compatible with SwingTree.@Override public void paint(Graphics g){ paintBackground(g, ()->super.paint(g)); }
- Specified by:
paint
in interfaceStylableComponent
- Overrides:
paint
in classJComponent
- Parameters:
g
- the graphics context to paint on, obtained from the component'sJComponent.paint(Graphics)
method.
-
paintChildren
This method is expected to be implemented as follows:@Override public void paintChildren(Graphics g){ paintForeground(g, ()->super.paintChildren(g)); }
- Specified by:
paintChildren
in interfaceStylableComponent
- Overrides:
paintChildren
in classJComponent
- Parameters:
g
- the graphics context to paint on, obtained from the component'sJComponent::paintChildren(Graphics)
method.
-
setUISilently
Description copied from interface:StylableComponent
Certain 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:
setUISilently
in interfaceStylableComponent
- Parameters:
ui
- the UI delegate to set for the component without triggering side effects.
-
updateUI
public void updateUI()Resets the UI property with a value from the current look and feel. -
attachToRootPane
-
detachFromRootPane
-
toRootPane
-
getMouseListeners
- Overrides:
getMouseListeners
in classComponent
-
addMouseListener
- Overrides:
addMouseListener
in classComponent
-
removeMouseListener
- Overrides:
removeMouseListener
in classComponent
-
getMouseMotionListeners
- Overrides:
getMouseMotionListeners
in classComponent
-
addMouseMotionListener
- Overrides:
addMouseMotionListener
in classComponent
-
removeMouseMotionListener
- Overrides:
removeMouseMotionListener
in classComponent
-
getMouseWheelListeners
- Overrides:
getMouseWheelListeners
in classComponent
-
addMouseWheelListener
- Overrides:
addMouseWheelListener
in classComponent
-
removeMouseWheelListener
- Overrides:
removeMouseWheelListener
in classComponent
-
eventDispatched
- Specified by:
eventDispatched
in interfaceAWTEventListener
-
contains
public 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:
contains
in classJComponent
-