public class DisabledPanel extends JPanel
JPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategylistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
DisabledPanel(Container container)
Create a DisablePanel for the specified Container.
|
DisabledPanel(Container container,
Color disabledColor)
Create a DisablePanel for the specified Container using the specified
disabled color.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
disable(Container container)
Convenience static method to disable all components of a given Container,
including nested Containers.
|
static void |
enable(Container container)
Convenience static method to enable Components disabled by using the
disable() method.
|
static boolean |
equals(Object obj1,
Object obj2)
Convenience method for determining whether two objects are either equal
or both null.
|
static Map<JComponent,List<JComponent>> |
getComponentMap(JComponent container,
boolean nested)
Convenience method for mapping a container in the hierarchy to its
contained components.
|
static <T extends JComponent> |
getDescendantOfClass(Class<T> clazz,
Container container,
String property,
Object value)
Convenience method that searches below
container in the
component hierarchy in a depth first manner and returns the first found
component of class clazz having the bound property value. |
static <T extends JComponent> |
getDescendantOfClass(Class<T> clazz,
Container container,
String property,
Object value,
boolean nested)
Convenience method that searches below
container in the
component hierarchy in a depth first manner and returns the first found
component of class clazz having the bound property value. |
static <T extends JComponent> |
getDescendantOfType(Class<T> clazz,
Container container,
String property,
Object value)
Convenience method that searches below
container in the
component hierarchy and returns the first found component that is an
instance of class clazz having the bound property value. |
static <T extends JComponent> |
getDescendantOfType(Class<T> clazz,
Container container,
String property,
Object value,
boolean nested)
Convenience method that searches below
container in the
component hierarchy and returns the first found component that is an
instance of class clazz and has the bound property value. |
static <T extends JComponent> |
getDescendantsOfClass(Class<T> clazz,
Container container)
Convenience method for searching below
container in the
component hierarchy and return nested components of class
clazz it finds. |
static <T extends JComponent> |
getDescendantsOfClass(Class<T> clazz,
Container container,
boolean nested)
Convenience method for searching below
container in the
component hierarchy and return nested components of class
clazz it finds. |
static <T extends JComponent> |
getDescendantsOfType(Class<T> clazz,
Container container)
Convenience method for searching below
container in the
component hierarchy and return nested components that are instances of
class clazz it finds. |
static <T extends JComponent> |
getDescendantsOfType(Class<T> clazz,
Container container,
boolean nested)
Convenience method for searching below
container in the
component hierarchy and return nested components that are instances of
class clazz it finds. |
Color |
getDisabledColor()
The background color of the glass pane.
|
JComponent |
getGlassPane()
The glass pane of this DisablePanel.
|
static <T extends JComponent> |
getJClass(T component)
Convenience method to obtain the Swing class from which this component
was directly or indirectly derived.
|
static Map<Object,Object> |
getProperties(JComponent component)
Convenience method for obtaining most non-null human readable properties
of a JComponent.
|
static Object |
getUIDefaultOfClass(Class clazz,
String property)
Convenience method for retrieving the UIDefault for a single property of
a particular class.
|
static UIDefaults |
getUIDefaultsOfClass(Class clazz)
Convenience method for retrieving a subset of the UIDefaults pertaining
to a particular class.
|
static UIDefaults |
getUIDefaultsOfClass(String className)
Convenience method for retrieving a subset of the UIDefaults pertaining
to a particular class.
|
boolean |
isOptimizedDrawingEnabled()
Because we use layered panels this should be disabled.
|
void |
setDisabledColor(Color disabledColor)
Set the background color of the glass pane.
|
void |
setEnabled(boolean enabled)
Change the enabled state of the panel.
|
void |
setGlassPane(JComponent glassPane)
Use a custom glass pane.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, 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, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, 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, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, 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, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic DisabledPanel(Container container)
container - a Container to be added to this DisabledPanelpublic Color getDisabledColor()
public void setDisabledColor(Color disabledColor)
disabledColor - the background color of the glass panepublic JComponent getGlassPane()
public void setGlassPane(JComponent glassPane)
glassPane - a JComponent to be used as a glass panepublic void setEnabled(boolean enabled)
setEnabled in class JComponentpublic boolean isOptimizedDrawingEnabled()
isOptimizedDrawingEnabled in class JComponentpublic static void disable(Container container)
container - the Container containing Components to be disabledpublic static void enable(Container container)
container - a Container that has been previously disabled.public static <T extends JComponent> List<T> getDescendantsOfType(Class<T> clazz, Container container)
container in the
component hierarchy and return nested components that are instances of
class clazz it finds. Returns an empty list if no such
components exist in the container.
Invoking this method with a class parameter of JComponent.class will return all nested components.
This method invokes getDescendantsOfType(clazz, container, true)
T - typeclazz - the class of components whose instances are to be found.container - the container at which to begin the searchpublic static <T extends JComponent> List<T> getDescendantsOfType(Class<T> clazz, Container container, boolean nested)
container in the
component hierarchy and return nested components that are instances of
class clazz it finds. Returns an empty list if no such
components exist in the container.
Invoking this method with a class parameter of JComponent.class will return all nested components.
T - typeclazz - the class of components whose instances are to be found.container - the container at which to begin the searchnested - true to list components nested within another listed
component, false otherwisepublic static <T extends JComponent> T getDescendantOfType(Class<T> clazz, Container container, String property, Object value) throws IllegalArgumentException
container in the
component hierarchy and returns the first found component that is an
instance of class clazz having the bound property value.
Returns null if such component cannot be found.
This method invokes getDescendantOfType(clazz, container, property, value, true)
T - typeclazz - the class of component whose instance is to be found.container - the container at which to begin the searchproperty - the className of the bound property, exactly as expressed
in the accessor e.g. "Text" for getText(), "Value" for getValue().value - the value of the bound propertyIllegalArgumentException - if the bound property does not
exist for the class or cannot be accessedpublic static <T extends JComponent> T getDescendantOfType(Class<T> clazz, Container container, String property, Object value, boolean nested) throws IllegalArgumentException
container in the
component hierarchy and returns the first found component that is an
instance of class clazz and has the bound property value.
Returns null if such component cannot be found.T - typeclazz - the class of component whose instance to be found.container - the container at which to begin the searchproperty - the className of the bound property, exactly as expressed
in the accessor e.g. "Text" for getText(), "Value" for getValue().value - the value of the bound propertynested - true to list components nested within another component
which is also an instance of clazz, false otherwiseIllegalArgumentException - if the bound property does not
exist for the class or cannot be accessedpublic static <T extends JComponent> List<T> getDescendantsOfClass(Class<T> clazz, Container container)
container in the
component hierarchy and return nested components of class
clazz it finds. Returns an empty list if no such components
exist in the container.
This method invokes getDescendantsOfClass(clazz, container, true)
T - typeclazz - the class of components to be found.container - the container at which to begin the searchpublic static <T extends JComponent> List<T> getDescendantsOfClass(Class<T> clazz, Container container, boolean nested)
container in the
component hierarchy and return nested components of class
clazz it finds. Returns an empty list if no such components
exist in the container.T - typeclazz - the class of components to be found.container - the container at which to begin the searchnested - true to list components nested within another listed
component, false otherwisepublic static <T extends JComponent> T getDescendantOfClass(Class<T> clazz, Container container, String property, Object value) throws IllegalArgumentException
container in the
component hierarchy in a depth first manner and returns the first found
component of class clazz having the bound property value.
Returns null if such component cannot be found.
This method invokes getDescendantOfClass(clazz, container, property, value, true)
T - typeclazz - the class of component to be found.container - the container at which to begin the searchproperty - the className of the bound property, exactly as expressed
in the accessor e.g. "Text" for getText(), "Value" for getValue(). This
parameter is case sensitive.value - the value of the bound propertyIllegalArgumentException - if the bound property does not
exist for the class or cannot be accessedpublic static <T extends JComponent> T getDescendantOfClass(Class<T> clazz, Container container, String property, Object value, boolean nested) throws IllegalArgumentException
container in the
component hierarchy in a depth first manner and returns the first found
component of class clazz having the bound property value.
Returns null if such component cannot be found.
T - typeclazz - the class of component to be found.container - the container at which to begin the searchproperty - the className of the bound property, exactly as expressed
in the accessor e.g. "Text" for getText(), "Value" for getValue(). This
parameter is case sensitive.value - the value of the bound propertynested - true to include components nested within another listed
component, false otherwiseIllegalArgumentException - if the bound property does not
exist for the class or cannot be accessedpublic static boolean equals(Object obj1, Object obj2)
obj1 - the first reference object to compare.obj2 - the second reference object to compare.public static Map<JComponent,List<JComponent>> getComponentMap(JComponent container, boolean nested)
Implementation note: The returned value is a HashMap and the values are of type ArrayList. This is subject to change, so callers should code against the interfaces Map and List.
container - The JComponent to be mappednested - true to drill down to nested containers, false otherwisepublic static UIDefaults getUIDefaultsOfClass(Class clazz)
clazz - the class of interestpublic static UIDefaults getUIDefaultsOfClass(String className)
className - fully qualified name of the class of interestpublic static Object getUIDefaultOfClass(Class clazz, String property)
clazz - the class of interestproperty - the property to querypublic static Map<Object,Object> getProperties(JComponent component)
Implementation note: The returned value is a HashMap. This is subject to change, so callers should code against the interface Map.
component - the component whose properties are to be determinedpublic static <T extends JComponent> Class getJClass(T component)
T - typecomponent - The component whose Swing superclass is to be determinedCopyright © 2021 vpc open source initiative. All rights reserved.