Documentation of 'jv.objectGui.PsMultiLineLabel' Java class
PsMultiLineLabel ("JavaView Reference Manual")
"JavaView? v5.03.003"
jv.objectGui

Class PsMultiLineLabel

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable


    public class PsMultiLineLabel
    extends java.awt.Component
    A label that may contain multiple lines. Lines are automatically wrapped at the end of the label. Use Label.CENTER, Label.LEFT, Label.RIGHT to specify the horizontal alignment of the text.

    After changing the text or alignment of this component, validate() must be called to enforce a new layout.

    See Also:
    PuString.splitString(String, int, FontMetrics), Serialized Form
    Author:
    Eike Preuss
    Version:
    11.08.03, 2.10 revised (kp) Now a lightweight component, superclass changed to Component from Canvas.
    21.07.03, 2.00 revised (kp) Methods update() removed, and enforce calling of validate().
    21.07.03, 1.50 revised (kp) Deprecated method preferredSize() removed.
    28.01.03, 1.40 revised (ep) Removed overrides of setSize etc. and implemented 'validate' instead (infinite loop bug).
    14.11.02, 1.30 revised (ep) Make sure that after setBounds etc is called there is still a revalidation at next paint.
    Reason for this is: If setBounds is called from LayoutManager the whole validation gets weird.
    12.06.02, 1.20 revised (ep) Split the text whenever the size of the component is set (so preferredSize is up to date).
    11.03.02, 1.10 revised (ep) Revalidate layout when text/alignment is changed.
    18.01.02, 1.00 created (ep)
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      • Fields inherited from class java.awt.Component

        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

      Constructors 
      Constructor and Description
      PsMultiLineLabel()
      Create label with empty text and left alignment.
      PsMultiLineLabel(java.lang.String text)
      Create label with given text in multiple lines, and left alignment.
      PsMultiLineLabel(java.lang.String text, int align)
      Create label with given text in multiple lines and given alignment.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int getAlignment()
      Get alignment of label.
      java.awt.Dimension getPreferredSize()
      Get preferred layout size of this component.
      java.lang.String getText()
      Get text on this multi line label.
      java.awt.Color getTextColor()
      Get color of text, if null then default color of component is used.
      void paint(java.awt.Graphics g)
      Draw split string if splitting was successful, otherwise just return without any drawing.
      void setAlignment(int align)
      Same as in java.awt.Label.
      void setText(java.lang.String text)
      Set text on this multi line label.
      void setTextColor(java.awt.Color color)
      Set color of text, if null then default color of component is used.
      void validate()
      Enforce recomputation of splitting of string, and call super.validate().
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PsMultiLineLabel

        public PsMultiLineLabel(java.lang.String text)
        Create label with given text in multiple lines, and left alignment. Text is wrapped at end of canvas size and whenever a '\n' appears.
        See Also:
        PsMultiLineLabel(), PsMultiLineLabel(String, int)
      • PsMultiLineLabel

        public PsMultiLineLabel(java.lang.String text,
                                int align)
        Create label with given text in multiple lines and given alignment. Text is wrapped at end of canvas size and whenever a '\n' appears. Use Label.CENTER, Label.LEFT, Label.RIGHT to specify the horizontal alignment of the text.
        See Also:
        PsMultiLineLabel(), PsMultiLineLabel(String)
        Version:
        21.07.03, 1.10 revised (kp) No longer call setAlignment() to prevent update().
    • Method Detail

      • getTextColor

        public java.awt.Color getTextColor()
        Get color of text, if null then default color of component is used.
        Since:
        JavaView 3.52.002
        Version:
        15.08.04, 1.00 created (kp)
      • setTextColor

        public void setTextColor(java.awt.Color color)
        Set color of text, if null then default color of component is used.
        Since:
        JavaView 3.52.002
        Version:
        15.08.04, 1.00 created (kp)
      • getAlignment

        public int getAlignment()
        Get alignment of label. Alignment is Label.CENTER, Label.LEFT, Label.RIGHT to specify the horizontal alignment of the text.
      • setAlignment

        public void setAlignment(int align)
        Same as in java.awt.Label. Use Label.CENTER, Label.LEFT, Label.RIGHT to specify the horizontal alignment of the text.
      • getText

        public java.lang.String getText()
        Get text on this multi line label.
        Returns:
        String contains the contents of this label
      • setText

        public void setText(java.lang.String text)
        Set text on this multi line label.
        Parameters:
        text - String contains the contents of this label
      • paint

        public void paint(java.awt.Graphics g)
        Draw split string if splitting was successful, otherwise just return without any drawing.
        Overrides:
        paint in class java.awt.Component
      • getPreferredSize

        public java.awt.Dimension getPreferredSize()
        Get preferred layout size of this component.
        Overrides:
        getPreferredSize in class java.awt.Component
      • validate

        public void validate()
        Enforce recomputation of splitting of string, and call super.validate(). Also invokes a repaint() because we are running as lightweight component.
        Overrides:
        validate in class java.awt.Component
        Version:
        04.06.04, 1.10 revised (kp) Validate() now also invokes a repaint().
"JavaView? v5.03.003"

"

The software JavaView? is copyright protected. All Rights Reserved.
"

Ads help maintain this website.