Class Component

    • Constructor Detail

      • Component

        public Component()
    • Method Detail

      • getAutomationID

        public java.lang.String getAutomationID()
        Returns the component's automation ID.
        Returns:
        The component's automation ID, or null if the component does not have an automation ID.
      • setAutomationID

        public void setAutomationID​(java.lang.String automationID)
        Sets the component's automation ID. This value can be used to obtain a reference to the component via Automation.get(String) when the component is attached to a component hierarchy.
        Parameters:
        automationID - The automation ID to use for the component, or null to clear the automation ID.
      • setAutomationID

        public <E extends java.lang.Enum<E>> void setAutomationID​(E enumID)
        Set the automation ID via an enum value.
        Type Parameters:
        E - The enum type that will be used here.
        Parameters:
        enumID - The enum value to use as the automation ID for this component, or null to clear the automation ID.
        See Also:
        setAutomationID(String)
      • getSkin

        protected Skin getSkin()
        Returns the currently installed skin.
        Returns:
        The currently installed skin.
      • setSkin

        protected void setSkin​(Skin skin)
        Sets the skin, replacing any previous skin.
        Parameters:
        skin - The new skin.
      • checkSkin

        protected final void checkSkin​(Skin skin,
                                       java.lang.Class<?> expectedClass)
        Check if the given skin is correct with respect to the necessary skin class.

        Meant to be called from the subclass' setSkin(org.apache.pivot.wtk.Skin) method.

        Parameters:
        skin - The skin object to check.
        expectedClass - What the skin class should be.
        Throws:
        java.lang.IllegalArgumentException - if the skin object doesn't implement the given skin interface.
      • installSkin

        protected void installSkin​(java.lang.Class<? extends Component> componentClass)
        Installs the skin for the given component class, as defined by the current theme.
        Parameters:
        componentClass - Pivot component class for which to install the skin.
      • setParent

        protected void setParent​(Container parent)
      • getWindow

        public Window getWindow()
      • getDisplay

        public Display getDisplay()
      • getAncestor

        public Container getAncestor​(java.lang.Class<? extends Container> ancestorType)
      • getAncestor

        public Container getAncestor​(java.lang.String ancestorTypeName)
                              throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • getWidth

        public int getWidth()
        Description copied from interface: Visual
        Returns the visual's width.
        Specified by:
        getWidth in interface Visual
        Returns:
        Current width of this visual.
      • setWidth

        public void setWidth​(int width)
      • getHeight

        public int getHeight()
        Description copied from interface: Visual
        Returns the visual's height.
        Specified by:
        getHeight in interface Visual
        Returns:
        Current height of this visual.
      • setHeight

        public void setHeight​(int height)
      • getSize

        public Dimensions getSize()
        Description copied from interface: Visual
        Default method to return the visual's complete size via a Dimensions object. Note that if the width and height calculations for a particular object are lengthy and could be better done together rather than separately, that component should be free to override this default implementation.
        Specified by:
        getSize in interface Visual
        Returns:
        The visual's complete size.
      • setSize

        public void setSize​(int width,
                            int height)
        NOTE This method should only be called during layout. Callers should use setPreferredSize(int, int).
        Specified by:
        setSize in interface ConstrainedVisual
        Parameters:
        width - Final computed width
        height - Final computed height
      • getPreferredWidth

        public int getPreferredWidth()
        Returns:
        The component's unconstrained preferred width.
      • getPreferredWidth

        public int getPreferredWidth​(int height)
        Returns the component's constrained preferred width.
        Specified by:
        getPreferredWidth in interface ConstrainedVisual
        Parameters:
        height - The height value by which the preferred width should be constrained, or -1 for no constraint.
        Returns:
        The constrained preferred width.
      • setPreferredWidth

        public void setPreferredWidth​(int preferredWidth)
        Sets the component's preferred width.
        Parameters:
        preferredWidth - The preferred width value, or -1 to use the default value determined by the skin.
      • isPreferredWidthSet

        public boolean isPreferredWidthSet()
        Returns a flag indicating whether the preferred width was explicitly set by the caller or is the default value determined by the skin.
        Returns:
        true if the preferred width was explicitly set; false, otherwise.
      • getPreferredHeight

        public int getPreferredHeight()
        Returns:
        The component's unconstrained preferred height.
      • getPreferredHeight

        public int getPreferredHeight​(int width)
        Returns the component's constrained preferred height.
        Specified by:
        getPreferredHeight in interface ConstrainedVisual
        Parameters:
        width - The width value by which the preferred height should be constrained, or -1 for no constraint.
        Returns:
        The constrained preferred height.
      • setPreferredHeight

        public void setPreferredHeight​(int preferredHeight)
        Sets the component's preferred height.
        Parameters:
        preferredHeight - The preferred height value, or -1 to use the default value determined by the skin.
      • isPreferredHeightSet

        public boolean isPreferredHeightSet()
        Returns a flag indicating whether the preferred height was explicitly set by the caller or is the default value determined by the skin.
        Returns:
        true if the preferred height was explicitly set; false, otherwise.
      • setPreferredSize

        public final void setPreferredSize​(Dimensions preferredSize)
      • setPreferredSize

        public void setPreferredSize​(int preferredWidth,
                                     int preferredHeight)
        Sets the component's preferred size.
        Parameters:
        preferredWidth - The preferred width value, or -1 to use the default value determined by the skin.
        preferredHeight - The preferred height value, or -1 to use the default value determined by the skin.
      • isPreferredSizeSet

        public boolean isPreferredSizeSet()
        Returns a flag indicating whether the preferred size was explicitly set by the caller or is the default value determined by the skin.
        Returns:
        true if the preferred size was explicitly set; false, otherwise.
      • getMinimumWidth

        public int getMinimumWidth()
        Returns:
        The given minimum width of this component.
      • setMinimumWidth

        public void setMinimumWidth​(int minimumWidth)
        Sets the minimum width of this component.
        Parameters:
        minimumWidth - The new minimum width for this component.
      • getMaximumWidth

        public int getMaximumWidth()
        Returns:
        The given maximum width of this component.
      • setMaximumWidth

        public void setMaximumWidth​(int maximumWidth)
        Sets the maximum width of this component.
        Parameters:
        maximumWidth - The new maximum width of this component.
      • getWidthLimits

        public Limits getWidthLimits()
        Returns:
        The current width limits (min and max) for this component.
      • setWidthLimits

        public void setWidthLimits​(int minimumWidth,
                                   int maximumWidth)
        Sets the width limits for this component.
        Parameters:
        minimumWidth - The new minimum width.
        maximumWidth - The new maximum width.
      • setWidthLimits

        public final void setWidthLimits​(Limits widthLimits)
        Sets the width limits for this component.
        Parameters:
        widthLimits - The new width limits (min and max).
      • getMinimumHeight

        public int getMinimumHeight()
        Returns:
        The given minimum height of this component.
      • setMinimumHeight

        public void setMinimumHeight​(int minimumHeight)
        Sets the minimum height of this component.
        Parameters:
        minimumHeight - The new minimum height.
      • getMaximumHeight

        public int getMaximumHeight()
        Returns:
        The given maximum height of this component.
      • setMaximumHeight

        public void setMaximumHeight​(int maximumHeight)
        Sets the maximum height of this component.
        Parameters:
        maximumHeight - The new maximum height.
      • getHeightLimits

        public Limits getHeightLimits()
        Returns:
        The current height limits (min and max) for this component.
      • setHeightLimits

        public void setHeightLimits​(int minimumHeight,
                                    int maximumHeight)
        Sets the height limits for this component.
        Parameters:
        minimumHeight - The new minimum height.
        maximumHeight - The new maximum height.
      • setHeightLimits

        public final void setHeightLimits​(Limits heightLimits)
        Sets the height limits for this component.
        Parameters:
        heightLimits - The new height limits (min and max).
      • getX

        public int getX()
        Returns:
        The component's x-coordinate or its horizontal position relative to the origin of the parent container.
      • setX

        public void setX​(int x)
        Sets the component's x-coordinate.
        Parameters:
        x - The component's horizontal position relative to the origin of the parent container.
      • getY

        public int getY()
        Returns:
        The component's y-coordinate or its vertical position relative to the origin of the parent container.
      • setY

        public void setY​(int y)
        Sets the component's y-coordinate.
        Parameters:
        y - The component's vertical position relative to the origin of the parent container.
      • getLocation

        public Point getLocation()
        Returns:
        A point value containing the component's location or its horizontal and vertical position relative to the origin of the parent container.
      • setLocation

        public void setLocation​(int x,
                                int y)
        Sets the component's location. NOTE This method should only be called when performing layout. However, since some containers do not reposition components during layout, it is valid for callers to invoke this method directly for such containers.
        Parameters:
        x - The component's horizontal position relative to the origin of the parent container.
        y - The component's vertical position relative to the origin of the parent container.
      • setLocation

        public final void setLocation​(Point location)
        Sets the component's location.
        Parameters:
        location - A point value containing the component's horizontal and vertical position relative to the origin of the parent container.
        See Also:
        setLocation(int, int)
      • getBaseline

        public int getBaseline()
        Returns the component's baseline.
        Specified by:
        getBaseline in interface Visual
        Returns:
        The baseline relative to the origin of this component, or -1 if this component does not have a baseline.
      • getBaseline

        public int getBaseline​(int width,
                               int height)
        Returns the component's baseline for a given width and height.
        Specified by:
        getBaseline in interface ConstrainedVisual
        Parameters:
        width - Constrained width to compute the baseline for.
        height - Constrained height to compute the baseline for.
        Returns:
        The baseline relative to the origin of this component, or -1 if this component does not have a baseline.
      • getBounds

        public Bounds getBounds()
        Returns:
        The component's bounding area. The x and y values are relative to the parent container.
      • getDecoratedBounds

        public Bounds getDecoratedBounds()
        Returns:
        The component's bounding area including decorators. The x and y values are relative to the parent container.
      • getScreenBounds

        public Bounds getScreenBounds()
        Returns the component's bounding area in screen coordinates.

        The result is the result of getBounds() offset by all the parent containers of this component, and offset by the application's Display on the screen.

        Returns:
        The component's bounding area relative to the entire screen.
      • offsetToScreen

        public java.awt.Rectangle offsetToScreen​(java.awt.Rectangle clientRectangle)
        Convert and return a new Rectangle from component-relative coordinates to screen-relative. Uses the getScreenBounds() method to accomplish the mapping.
        Parameters:
        clientRectangle - A rectangle in component-relative coordinates.
        Returns:
        A new object in screen-relative coordinates.
      • contains

        @UnsupportedOperation
        public boolean contains​(int xValue,
                                int yValue)
        Determines if the component contains a given location. This method facilitates mouse interaction with non-rectangular components.
        Parameters:
        xValue - Horizontal location to check.
        yValue - Vertical location to check.
        Returns:
        true if the component's shape contains the given location; false, otherwise.
        Throws:
        java.lang.UnsupportedOperationException - This method is not currently implemented.
      • isVisible

        public boolean isVisible()
        Returns the component's visibility.
        Returns:
        true if the component will be painted; false, otherwise.
      • setVisible

        public void setVisible​(boolean visible)
        Sets the component's visibility.
        Parameters:
        visible - true if the component should be painted; false, otherwise.
      • mapPointToAncestor

        public Point mapPointToAncestor​(Container ancestor,
                                        int xValue,
                                        int yValue)
        Maps a point in this component's coordinate system to the specified ancestor's coordinate space.
        Parameters:
        ancestor - The ancestor container of this component.
        xValue - The x-coordinate in this component's coordinate space.
        yValue - The y-coordinate in this component's coordinate space.
        Returns:
        A point containing the translated coordinates, or null if the component is not a descendant of the specified ancestor.
      • mapPointToAncestor

        public Point mapPointToAncestor​(Container ancestor,
                                        Point location)
        Maps a point in this component's coordinate system to the specified ancestor's coordinate space.
        Parameters:
        ancestor - The ancestor container of this component.
        location - The coordinates in this component's coordinate space.
        Returns:
        A point containing the translated coordinates, or null if the component is not a descendant of the specified ancestor.
      • mapPointFromAncestor

        public Point mapPointFromAncestor​(Container ancestor,
                                          int xValue,
                                          int yValue)
        Maps a point in the specified ancestor's coordinate space to this component's coordinate system.
        Parameters:
        ancestor - The ancestor container of this component.
        xValue - The x-coordinate in the ancestors's coordinate space.
        yValue - The y-coordinate in the ancestor's coordinate space.
        Returns:
        A point containing the translated coordinates, or null if the component is not a descendant of the specified ancestor.
      • mapPointFromAncestor

        public Point mapPointFromAncestor​(Container ancestor,
                                          Point location)
      • isShowing

        public boolean isShowing()
        Determines if this component is showing. To be showing, the component and all of its ancestors must be visible and attached to a display.
        Returns:
        true if this component is showing; false otherwise.
      • getVisibleArea

        public Bounds getVisibleArea()
        Determines the visible area of a component. The visible area is defined as the intersection of the component's area with the visible area of its ancestors, or, in the case of a Viewport, the viewport bounds.
        Returns:
        The visible area of the component in the component's coordinate space, or null if the component is either not showing or not part of the component hierarchy.
      • getVisibleArea

        public Bounds getVisibleArea​(Bounds area)
        Determines the visible portion of a given area. The visible area is defined as the intersection of the component's area with the visible area of its ancestors, or, in the case of a Viewport, the viewport bounds.
        Parameters:
        area - The area to check its visibility.
        Returns:
        The visible part of the given area in the component's coordinate space, or null if the component is either not showing or not part of the component hierarchy.
      • getVisibleArea

        public Bounds getVisibleArea​(int xValue,
                                     int yValue,
                                     int width,
                                     int height)
        Determines the visible area of the given rectangle. The visible area is defined as the intersection of the component's area with the visible area of its ancestors, or, in the case of a Viewport, the viewport bounds.
        Parameters:
        xValue - The x-coordinate of the area.
        yValue - The y-coordinate of the area.
        width - The width of the area.
        height - The height of the area.
        Returns:
        The visible part of the given area in the component's coordinate space, or null if the component is either not showing or not part of the component hierarchy.
      • scrollAreaToVisible

        public void scrollAreaToVisible​(Bounds area)
        Ensures that the given area of a component is visible within the viewports of all applicable ancestors.
        Parameters:
        area - The area to be made visible.
      • scrollAreaToVisible

        public void scrollAreaToVisible​(int xValue,
                                        int yValue,
                                        int width,
                                        int height)
        Ensures that the given area of a component is visible within the viewports of all applicable ancestors.
        Parameters:
        xValue - The x-coordinate of the area to be made visible.
        yValue - The y-coordinate of the area.
        width - The width of the area to be shown.
        height - The height of the area.
      • isValid

        public boolean isValid()
        Returns:
        Whether or not the component is valid.
      • invalidate

        public void invalidate()
        Flags the component's hierarchy as invalid, and clears any cached preferred size.
      • validate

        public void validate()
        Lays out the component by calling Skin.layout().
      • layout

        protected void layout()
        Called to lay out the component.
      • repaint

        public final void repaint()
        Flags the entire component as needing to be repainted.
      • repaint

        public final void repaint​(boolean immediate)
        Flags the entire component as needing to be repainted.
        Parameters:
        immediate - Whether to repaint immediately.
      • repaint

        public final void repaint​(Bounds area)
        Flags an area as needing to be repainted.
        Parameters:
        area - The area that needs to be repainted.
      • repaint

        public final void repaint​(Bounds area,
                                  boolean immediate)
        Flags an area as needing to be repainted or repaints the rectangle immediately.
        Parameters:
        area - The area to be repainted.
        immediate - Whether or not the area needs immediate painting.
      • repaint

        public final void repaint​(int xValue,
                                  int yValue,
                                  int width,
                                  int height)
        Flags an area as needing to be repainted.
        Parameters:
        xValue - Starting x-coordinate of area to paint.
        yValue - Starting y-coordinate.
        width - Width of area to repaint.
        height - Height of the area.
      • repaint

        public void repaint​(int xValue,
                            int yValue,
                            int width,
                            int height,
                            boolean immediate)
        Flags an area as needing to be repainted.
        Parameters:
        xValue - Starting x-coordinate of area to repaint.
        yValue - Starting y-coordinate.
        width - Width of area to repaint.
        height - Height of area.
        immediate - Whether repaint should be done immediately.
      • paint

        public void paint​(java.awt.Graphics2D graphics)
        Paints the component. Delegates to the skin.
        Specified by:
        paint in interface Visual
        Parameters:
        graphics - The graphics context to paint into.
      • getGraphics

        public java.awt.Graphics2D getGraphics()
        Creates a graphics context for this component. This graphics context will not be double buffered. In other words, drawing operations on it will operate directly on the video RAM.
        Returns:
        A graphics context for this component, or null if this component is not showing.
        See Also:
        isShowing()
      • isEnabled

        public boolean isEnabled()
        Returns the component's enabled state.
        Returns:
        true if the component is enabled; false, otherwise.
      • setEnabled

        public void setEnabled​(boolean enabled)
        Sets the component's enabled state. Enabled components respond to user input events; disabled components do not.
        Parameters:
        enabled - true if the component is enabled; false, otherwise.
      • isBlocked

        public boolean isBlocked()
        Determines if this component is blocked. A component is blocked if the component or any of its ancestors is disabled.
        Returns:
        true if the component is blocked; false, otherwise.
      • isMouseOver

        public boolean isMouseOver()
        Determines if the mouse is positioned over this component.
        Returns:
        true if the mouse is currently located over this component; false, otherwise.
      • getMouseLocation

        public Point getMouseLocation()
        Returns the current mouse location in the component's coordinate space.
        Returns:
        The current mouse location, or null if the mouse is not currently positioned over this component.
      • getCursor

        public Cursor getCursor()
        Returns the cursor that is displayed when the mouse pointer is over this component.
        Returns:
        The cursor that is displayed over the component.
      • setCursor

        public void setCursor​(Cursor cursor)
        Sets the cursor that is displayed when the mouse pointer is over this component.
        Parameters:
        cursor - The cursor to display over the component, or null to inherit the cursor of the parent container.
      • getTooltipText

        public java.lang.String getTooltipText()
        Returns:
        The component's tooltip text, or null if no tooltip is specified.
      • setTooltipText

        public void setTooltipText​(java.lang.String tooltipText)
        Sets the component's tooltip text.
        Parameters:
        tooltipText - The component's tooltip text, or null for no tooltip.
      • getTooltipDelay

        public int getTooltipDelay()
        Returns:
        The component's tooltip delay, in milliseconds.
      • setTooltipDelay

        public void setTooltipDelay​(int tooltipDelay)
        Sets the component's tooltip delay.
        Parameters:
        tooltipDelay - The tooltip delay, in milliseconds.
      • getTooltipWrapText

        public boolean getTooltipWrapText()
        Returns the tooltip's mode for wrapping its text.
        Returns:
        true if the tooltip text wrap mode is enabled; false if not.
      • setTooltipWrapText

        public void setTooltipWrapText​(boolean tooltipWrapText)
        Sets the tooltip's text wrapping mode.
        Parameters:
        tooltipWrapText - The component's tooltip text wrap mode.
      • isOpaque

        public boolean isOpaque()
        Tells whether or not this component is fully opaque when painted.
        Returns:
        true if this component is opaque; false if any part of it is transparent or translucent.
      • isFocusable

        public boolean isFocusable()
        Returns this component's focusability. A focusable component is capable of receiving the focus only when it is showing, unblocked, and its window is not closing.
        Returns:
        true if the component is capable of receiving the focus; false, otherwise.
      • isFocused

        public boolean isFocused()
        Returns the component's focused state.
        Returns:
        true if the component has the input focus; false otherwise.
      • setFocused

        protected void setFocused​(boolean focused,
                                  Component obverseComponent)
        Called to notify a component that its focus state has changed.
        Parameters:
        focused - true if the component has received the input focus; false if the component has lost the focus.
        obverseComponent - If focused is true, the component that has lost the focus; otherwise, the component that has gained the focus.
      • requestFocus

        public boolean requestFocus()
        Requests that focus be given to this component.
        Returns:
        true if the component gained the focus; false otherwise.
      • transferFocus

        public Component transferFocus​(FocusTraversalDirection direction)
        Transfers focus to the next focusable component in the given direction.
        Parameters:
        direction - The direction in which to transfer focus.
        Returns:
        The new component that has received the focus or null if no component is focused.
      • getFocusedComponent

        public static Component getFocusedComponent()
        Returns the currently focused component.
        Returns:
        The component that currently has the focus, or null if no component is focused.
      • clearFocus

        public static void clearFocus()
        Clears the focus.
      • load

        public void load​(java.lang.Object context)
        Copies bound values from the bind context to the component. This functionality must be provided by the subclass; the base implementation is a no-op.
        Parameters:
        context - The object to load the bound values from.
      • store

        public void store​(java.lang.Object context)
        Copies bound values from the component to the bind context. This functionality must be provided by the subclass; the base implementation is a no-op.
        Parameters:
        context - The object to store the bound values into.
      • clear

        public void clear()
        Clears any bound values in the component. This functionality must be provided by the subclass; the base implementation is a no-op.
      • getDragSource

        public DragSource getDragSource()
      • setDragSource

        public void setDragSource​(DragSource dragSource)
      • getDropTarget

        public DropTarget getDropTarget()
      • setDropTarget

        public void setDropTarget​(DropTarget dropTarget)
      • setMenuHandler

        public void setMenuHandler​(MenuHandler menuHandler)
      • getName

        public java.lang.String getName()
        Returns:
        The name of the component.
      • setName

        public void setName​(java.lang.String name)
        Sets the component's name.
        Parameters:
        name - Name to be given to this component.
      • getStyle

        public final java.lang.Object getStyle​(Style style)
        Get the style value corresponding to the given style key.
        Parameters:
        style - The enumerated style key.
        Returns:
        The value for this style.
      • getStyle

        public final java.lang.Object getStyle​(java.lang.String style)
        Get the style value corresponding to the given style key.
        Parameters:
        style - The style key.
        Returns:
        The value for this style.
      • getStyleColor

        public java.awt.Color getStyleColor​(Style style)
        Get the color value corresponding to the given style key.
        Parameters:
        style - The enumerated style key.
        Returns:
        The color value for that style.
      • getStyleColor

        public java.awt.Color getStyleColor​(java.lang.String style)
        Get the color value corresponding to the given style key.
        Parameters:
        style - The style key.
        Returns:
        The color value for that style.
      • getStyleFont

        public java.awt.Font getStyleFont​(Style style)
        Get the font value corresponding to the given style key.
        Parameters:
        style - The enumerated style key.
        Returns:
        The font value for that style.
      • getStyleFont

        public java.awt.Font getStyleFont​(java.lang.String style)
        Get the font value corresponding to the given style key.
        Parameters:
        style - The style key.
        Returns:
        The font value for that style.
      • getStyleInt

        public int getStyleInt​(Style style)
        Get the integer value corresponding to the given style key.
        Parameters:
        style - The enumerated style key.
        Returns:
        The integer value for that style.
      • getStyleInt

        public int getStyleInt​(java.lang.String style)
        Get the integer value corresponding to the given style key.
        Parameters:
        style - The style key.
        Returns:
        The integer value for that style.
      • getStyleBoolean

        public boolean getStyleBoolean​(Style style)
        Get the boolean value corresponding to the given style key.
        Parameters:
        style - The enumerated style key.
        Returns:
        The boolean value for that style.
      • getStyleBoolean

        public boolean getStyleBoolean​(java.lang.String style)
        Get the boolean value corresponding to the given style key.
        Parameters:
        style - The style key.
        Returns:
        The boolean value for that style.
      • putStyle

        public final void putStyle​(Style style,
                                   java.lang.Object value)
        Put the given key/value style into the style dictionary.
        Parameters:
        style - The enumerated style key.
        value - The value for this style.
      • putStyle

        public final void putStyle​(java.lang.String style,
                                   java.lang.Object value)
        Put the given key/value style into the style dictionary.
        Parameters:
        style - The style key.
        value - The value for this style.
      • copyStyle

        public final void copyStyle​(Style style,
                                    Component comp)
        Copy the given style from the other component to this one.
        Parameters:
        style - The enumerated style key.
        comp - The other component to copy the style from.
      • copyStyle

        public final void copyStyle​(java.lang.String style,
                                    Component comp)
        Copy the given style from the other component to this one.
        Parameters:
        style - The style key.
        comp - The other component to copy the style from.
      • setStyles

        public void setStyles​(Map<java.lang.String,​?> styles)
        Applies a set of styles.
        Parameters:
        styles - A map containing the styles to apply.
      • setStyles

        public void setStyles​(java.lang.String styles)
                       throws SerializationException
        Applies a set of styles.
        Parameters:
        styles - The styles encoded as a JSON map.
        Throws:
        SerializationException - if the string doesn't conform to JSON standards.
      • getTypedStyles

        public static Map<java.lang.Class<? extends Component>,​Map<java.lang.String,​?>> getTypedStyles()
        Returns:
        The typed style dictionary for this component.
      • getNamedStyles

        public static Map<java.lang.String,​Map<java.lang.String,​?>> getNamedStyles()
        Returns:
        The named style dictionary for this component.
      • setStyleName

        public void setStyleName​(java.lang.String styleName)
        Applies a named style to this component.
        Parameters:
        styleName - The name of an already loaded style to apply.
      • setStyleNames

        public void setStyleNames​(Sequence<java.lang.String> styleNames)
        Applies a set of named styles.
        Parameters:
        styleNames - List of style names to apply to this component.
      • setStyleNames

        public void setStyleNames​(java.lang.String styleNames)
        Applies a set of named styles.
        Parameters:
        styleNames - Comma-delimited list of style names to apply.
      • getAttribute

        public <T extends java.lang.Enum<T>> java.lang.Object getAttribute​(T key)
        Gets the specified component attribute. While attributes can be used to store arbitrary data, they are intended to be used by containers to store layout-related metadata in their child components.
        Type Parameters:
        T - The enum type of the attribute key.
        Parameters:
        key - The attribute key
        Returns:
        The attribute value, or null if no such attribute exists
      • setAttribute

        public <T extends java.lang.Enum<T>> java.lang.Object setAttribute​(T key,
                                                                           java.lang.Object value)
        Sets the specified component attribute. While attributes can be used to store arbitrary data, they are intended to be used by containers to store layout-related metadata in their child components.
        Type Parameters:
        T - The enum type of the attribute key.
        Parameters:
        key - The attribute key
        value - The attribute value, or null to clear the attribute
        Returns:
        The previous value of the attribute, or null if the attribute was unset
      • reenterMouse

        public void reenterMouse()
        If the mouse is currently over the component, causes the component to fire mouseOut() and a mouseMove() at the current mouse location.

        This method is primarily useful when consuming container mouse motion events, since it allows a caller to reset the mouse state based on the event consumption logic.

      • mouseMove

        protected boolean mouseMove​(int xValue,
                                    int yValue)
      • mouseOver

        protected void mouseOver()
      • mouseOut

        protected void mouseOut()
      • mouseDown

        protected boolean mouseDown​(Mouse.Button button,
                                    int xValue,
                                    int yValue)
      • mouseUp

        protected boolean mouseUp​(Mouse.Button button,
                                  int xValue,
                                  int yValue)
      • mouseClick

        protected boolean mouseClick​(Mouse.Button button,
                                     int xValue,
                                     int yValue,
                                     int count)
      • mouseWheel

        protected boolean mouseWheel​(Mouse.ScrollType scrollType,
                                     int scrollAmount,
                                     int wheelRotation,
                                     int xValue,
                                     int yValue)
      • keyTyped

        protected boolean keyTyped​(char character)
      • getTextInputMethodListener

        public TextInputMethodListener getTextInputMethodListener()
        Returns the input method listener for this component, which will reside in the skin, so defer to the skin class.
        Returns:
        The input method listener (if any) for this component.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • indexBoundsCheck

        protected static final void indexBoundsCheck​(java.lang.String indexName,
                                                     int index,
                                                     int min,
                                                     int max)
        Check an index value against the provided bounds and throw a nicely formatted exception, including the index name, for out of range values. Index must be in the range of [min..max].
        Parameters:
        indexName - The name of the index to be checked.
        index - Index to be checked against the bounds.
        min - Minimum allowed value of the index.
        max - Maximum allowed value of the index.
        Throws:
        java.lang.IllegalArgumentException - if given max < min.
        java.lang.IndexOutOfBoundsException - if index is out of range (index < min or index > max).