|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.Component
java.awt.Canvas
fi.hut.tml.xsmiles.gui.components.awt.XWrappingLabel
This class is similar to Symantec WrappingLabel class (a lot of copy-paste here). The class displays a long text string in several lines.
| Nested Class Summary |
| Nested classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
protected int |
align
|
protected int |
baseline
|
protected java.awt.FontMetrics |
fm
|
protected java.lang.String |
text
|
protected java.util.Enumeration |
textEnumeration
|
protected java.util.Vector |
textVector
|
| 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 | |
XWrappingLabel()
Constructs a default wrapping label. |
|
XWrappingLabel(java.util.Enumeration e)
|
|
XWrappingLabel(java.lang.String s)
Constructs a wrapping label that displays the specified string. |
|
XWrappingLabel(java.lang.String s,
int a)
Constructs wrapping label with the specified text and alignment. |
|
XWrappingLabel(java.util.Vector v)
|
|
| Method Summary | |
int |
calculateHeight(int width)
Calculates the needed height for current text. |
void |
createSize()
This is a method that calculates and sets the size of the label. |
protected void |
drawAlignedString(java.awt.Graphics g,
java.lang.String s,
int x,
int y,
int width)
This helper method draws a string aligned the requested way. |
void |
paint(java.awt.Graphics g)
Paints this component using the given graphics context. |
void |
setAlignStyle(int newAlignStyle)
Sets the text alignment. |
void |
setBounds(int x,
int y,
int width,
int height)
Moves and/or resizes this component. |
void |
setSize(int width,
int height)
Resizes this component. |
void |
setText(java.lang.String newText)
Sets the label text. |
| Methods inherited from class java.awt.Canvas |
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, 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, getPreferredSize, 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, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.util.Enumeration textEnumeration
protected java.util.Vector textVector
protected java.lang.String text
protected transient java.awt.FontMetrics fm
protected int align
protected int baseline
| Constructor Detail |
public XWrappingLabel()
public XWrappingLabel(java.util.Enumeration e)
public XWrappingLabel(java.util.Vector v)
public XWrappingLabel(java.lang.String s)
s - string to be displayed in label
public XWrappingLabel(java.lang.String s,
int a)
s - the string to be displayed in labela - the alignment, one of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHT| Method Detail |
public void setText(java.lang.String newText)
newText - the new label textpublic void setAlignStyle(int newAlignStyle)
newAlignStyle - the new alignment style, one of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHT
public void setBounds(int x,
int y,
int width,
int height)
x - horizontal position in the parent's coordinate spacey - vertical position in the parent's coordinate spacewidth - the new widthheight - the new height
public void setSize(int width,
int height)
width - the new width, in pixelsheight - the new height, in pixelspublic void createSize()
public void paint(java.awt.Graphics g)
g - the graphics context used for paintingComponent.repaint(),
Component.update(java.awt.Graphics)public int calculateHeight(int width)
width - the width against which the heigh must be calculated
protected void drawAlignedString(java.awt.Graphics g,
java.lang.String s,
int x,
int y,
int width)
g - the graphics context used for paintings - the string to drawx - the point to start drawing from, x coordinatey - the point to start drawing from, y coordinatewidth - the width of the area to draw in, in pixels
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||