Class ResizableTextLabel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
xal.extension.widgets.swing.wheelswitch.comp.ResizableTextLabel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants
Direct Known Subclasses:
GradientLabel

public class ResizableTextLabel extends JLabel
A text area in which the text can dynamically adjust its font size to fill the whole area available.
Version:
$id$
Author:
Jernej Kamenik
See Also:
  • Constructor Details

    • ResizableTextLabel

      public ResizableTextLabel(String text, Icon icon, int horizontalAlignment)
      Creates a resizable text label with text, icon and predefined horizontal text aligment and resizable font setting.
      Parameters:
      text - java.lang.String text to be displayed in the label.
      icon - Icon image to be displayed in the label.
      horizontalAlignment - int horizontal aligment of the text in the label.
    • ResizableTextLabel

      public ResizableTextLabel(String arg0, int arg1)
      Creates a resizable text label with text and predefined horizontal text aligment.
      Parameters:
      arg0 - java.lang.String text to be displayed in the label.
      arg1 - int horizontal aligment of the text in the label.
    • ResizableTextLabel

      public ResizableTextLabel(String arg0)
      Creates a resizable text label with text.
      Parameters:
      arg0 - java.lang.String text to be displayed in the label.
    • ResizableTextLabel

      public ResizableTextLabel(Icon image, int horizontalAlignment)
      Creates a resizable text label with icon and predefined horizontal text aligment and resizable font setting.
      Parameters:
      image - Icon image to be displayed in the label.
      horizontalAlignment - int horizontal aligment of the text in the label.
    • ResizableTextLabel

      public ResizableTextLabel(Icon image)
      Creates a resizable text label with an icon
      Parameters:
      image - Icon image to be displayed in the label.
    • ResizableTextLabel

      public ResizableTextLabel()
      Creates an empty label.
  • Method Details

    • setColumns

      public void setColumns(int newColumns)
      Sets the number of character columns to be displayed. This setting only has effect if resizable text font setting is enabled. Then the size of the font is adjusted to display the specified number of character columns.
      Parameters:
      newColumns -
    • getColumns

      public int getColumns()
      Gets the number of character columns to be displayed.
      Returns:
      int
    • isResizable

      public boolean isResizable()
      Returns the resizable text font setting.
      Returns:
      boolean
    • setResizable

      public void setResizable(boolean newResizable)
      Sets the resizable text font setting.
      Parameters:
      newResizable -
    • setEnhanced

      public void setEnhanced(boolean newEnhanced)
      Sets the enhanced mode setting. When true, the label is painted with anti-aliasing rendering hints.
      Parameters:
      newEnhanced -
    • isEnhanced

      public boolean isEnhanced()
      Returns the enhanced mode setting.
      Returns:
      boolean
    • setText

      public void setText(String text)
      This method was overriden to implement font resizing.
      Overrides:
      setText in class JLabel
      Parameters:
      text - to be displayed.
      See Also:
    • resize

      protected void resize()
      Adjusts the size of the font to the size of the label.
    • addNotify

      public void addNotify()
      This method was overriden to implement font resizing.
      Overrides:
      addNotify in class JComponent
      See Also:
    • getPreferredSize

      public Dimension getPreferredSize()
      This method was overriden to implement font resizing.
      Overrides:
      getPreferredSize in class JComponent
      Returns:
      Dimension preferred size of the label
      See Also:
    • setPreferredSize

      public void setPreferredSize(Dimension newPreferredSize)
      This method was overriden to implement font resizing.
      Overrides:
      setPreferredSize in class JComponent
      See Also:
    • getMinimumSize

      public Dimension getMinimumSize()
      This method was overriden to implement font resizing.
      Overrides:
      getMinimumSize in class JComponent
      See Also:
    • setMinimumSize

      public void setMinimumSize(Dimension newMinimumSize)
      This method was overriden to implement font resizing.
      Overrides:
      setMinimumSize in class JComponent
      See Also:
    • paintComponent

      protected void paintComponent(Graphics g)
      This method hes been overriden to implement the feature of enhanced anti-aliasing paint of the label.
      Overrides:
      paintComponent in class JComponent
      See Also: