Class JXLabel.Renderer

All Implemented Interfaces:
SwingConstants, TabExpander
Enclosing class:
JXLabel

static class JXLabel.Renderer extends WrappedPlainView
Root text view that acts as an renderer.
  • Field Details

    • host

      JXLabel host
    • invalidated

      boolean invalidated
    • width

      private float width
    • height

      private float height
    • view

      private View view
    • factory

      private ViewFactory factory
  • Constructor Details

  • Method Details

    • updateLayout

      protected void updateLayout(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a)
      Overrides:
      updateLayout in class View
    • preferenceChanged

      public void preferenceChanged(View child, boolean width, boolean height)
      Overrides:
      preferenceChanged in class BoxView
    • getAttributes

      public AttributeSet getAttributes()
      Fetches the attributes to use when rendering. At the root level there are no attributes. If an attribute is resolved up the view hierarchy this is the end of the line.
      Overrides:
      getAttributes in class View
    • paint

      public void paint(Graphics g, Shape allocation)
      Renders the view.
      Overrides:
      paint in class WrappedPlainView
      Parameters:
      g - the graphics context
      allocation - the region to render into
    • setParent

      public void setParent(View parent)
      Sets the view parent.
      Overrides:
      setParent in class CompositeView
      Parameters:
      parent - the parent view
    • getViewCount

      public int getViewCount()
      Returns the number of views in this view. Since this view simply wraps the root of the view hierarchy it has exactly one child.
      Overrides:
      getViewCount in class CompositeView
      Returns:
      the number of views
      See Also:
    • getView

      public View getView(int n)
      Gets the n-th view in this container.
      Overrides:
      getView in class CompositeView
      Parameters:
      n - the number of the view to get
      Returns:
      the view
    • getDocument

      public Document getDocument()
      Returns the document model underlying the view.
      Overrides:
      getDocument in class View
      Returns:
      the model
    • setSize

      public void setSize(float width, float height)
      Sets the view size.
      Overrides:
      setSize in class WrappedPlainView
      Parameters:
      width - the width
      height - the height
    • getPreferredSpan

      public float getPreferredSpan(int axis)
      Overrides:
      getPreferredSpan in class WrappedPlainView
    • getContainer

      public Container getContainer()
      Fetches the container hosting the view. This is useful for things like scheduling a repaint, finding out the host components font, etc. The default implementation of this is to forward the query to the parent view.
      Overrides:
      getContainer in class View
      Returns:
      the container
    • getViewFactory

      public ViewFactory getViewFactory()
      Fetches the factory to be used for building the various view fragments that make up the view that represents the model. This is what determines how the model will be represented. This is implemented to fetch the factory provided by the associated EditorKit.
      Overrides:
      getViewFactory in class View
      Returns:
      the factory
    • getWidth

      public int getWidth()
      Overrides:
      getWidth in class BoxView
    • getHeight

      public int getHeight()
      Overrides:
      getHeight in class BoxView