JavaView© v3.95.000

jv.objectGui
Class PsMultiLineLabel

java.lang.Object
  extended byjava.awt.Component
      extended byjv.objectGui.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

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
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
 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 splitted 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, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, 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, 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, isOpaque, 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, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, 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()
Create label with empty text and left alignment.

See Also:
PsMultiLineLabel(String), PsMultiLineLabel(String, int)

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)
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

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

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 splitted string if splitting was successful, otherwise just return without any drawing.


getPreferredSize

public java.awt.Dimension getPreferredSize()
Get preferred layout size of this 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.


JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.