|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--com.symantec.itools.javax.swing.JWrappingLabel
This class implements a multiple-line text label. It displays text on one or more lines, wrapping text as needed to fit in the available horizontal space.
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field Summary | |
protected int |
align
The current text alignment. |
protected java.lang.String |
text
The text string being displayed. |
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM,
CENTER,
EAST,
HORIZONTAL,
LEADING,
LEFT,
NORTH,
NORTH_EAST,
NORTH_WEST,
RIGHT,
SOUTH,
SOUTH_EAST,
SOUTH_WEST,
TOP,
TRAILING,
VERTICAL,
WEST |
Constructor Summary | |
JWrappingLabel()
Constructs a default wrapping label. |
|
JWrappingLabel(java.lang.String s)
Constructs a wrapping label that displays the specified string. |
|
JWrappingLabel(java.lang.String s,
int a)
Constructs wrapping label with the specified text and alignment. |
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a listener for all event changes. |
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds a vetoable listener for all event changes. |
protected void |
drawAlignedString(java.awt.Graphics g,
java.awt.FontMetrics fm,
int baseline,
java.lang.String s,
int x,
int y,
int width)
This helper method draws a string aligned the requested way. |
java.lang.String |
getText()
Gets the current label text. |
int |
getTextAlignment()
Gets the current text alignment setting. |
void |
paintComponent(java.awt.Graphics g)
Paints this component using the given graphics context. |
java.lang.String |
paramString()
Returns an empty string. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a listener for all event changes. |
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes a vetoable listener for all event changes. |
void |
setText(java.lang.String newText)
Sets the label text. |
void |
setTextAlignment(int newAlignStyle)
Sets the text alignment. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addNotify,
addPropertyChangeListener,
computeVisibleRect,
contains,
createToolTip,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getAccessibleContext,
getActionForKeyStroke,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getGraphics,
getHeight,
getInsets,
getInsets,
getLocation,
getMaximumSize,
getMinimumSize,
getNextFocusableComponent,
getPreferredSize,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getToolTipText,
getTopLevelAncestor,
getUIClassID,
getVisibleRect,
getWidth,
getX,
getY,
grabFocus,
hasFocus,
isDoubleBuffered,
isFocusCycleRoot,
isFocusTraversable,
isLightweightComponent,
isManagingFocus,
isOpaque,
isOptimizedDrawingEnabled,
isPaintingTile,
isRequestFocusEnabled,
isValidateRoot,
paint,
paintBorder,
paintChildren,
paintImmediately,
paintImmediately,
processComponentKeyEvent,
processFocusEvent,
processKeyEvent,
processMouseMotionEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removeNotify,
removePropertyChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
reshape,
revalidate,
scrollRectToVisible,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBackground,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setEnabled,
setFont,
setForeground,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setOpaque,
setPreferredSize,
setRequestFocusEnabled,
setToolTipText,
setUI,
setVisible,
unregisterKeyboardAction,
update,
updateUI |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
hide,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processInputMethodEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected java.lang.String text
protected int align
SwingConstants.LEFT
,
SwingConstants.CENTER
,
SwingConstants.RIGHT
Constructor Detail |
public JWrappingLabel()
public JWrappingLabel(java.lang.String s)
s
- string to be displayed in labelpublic JWrappingLabel(java.lang.String s, int a)
s
- the string to be displayed in labela
- the alignment, one of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHTcom.symantec.itools.javax.swing.Alignment
,
com.symantec.itools.javax.swing.Alignment#ALIGN_LEFT
,
com.symantec.itools.javax.swing.Alignment#ALIGN_CENTERED
,
com.symantec.itools.javax.swing.Alignment#ALIGN_RIGHT
Method Detail |
public int getTextAlignment()
setTextAlignment(int)
,
com.symantec.itools.javax.swing.Alignment
,
com.symantec.itools.javax.swing.Alignment#ALIGN_LEFT
,
com.symantec.itools.javax.swing.Alignment#ALIGN_CENTERED
,
com.symantec.itools.javax.swing.Alignment#ALIGN_RIGHT
public void setTextAlignment(int newAlignStyle) throws java.beans.PropertyVetoException
newAlignStyle
- the new alignment style, one of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHTgetTextAlignment()
,
com.symantec.itools.javax.swing.Alignment
,
com.symantec.itools.javax.swing.Alignment#ALIGN_LEFT
,
com.symantec.itools.javax.swing.Alignment#ALIGN_CENTERED
,
com.symantec.itools.javax.swing.Alignment#ALIGN_RIGHT
public java.lang.String getText()
setText(java.lang.String)
public void setText(java.lang.String newText) throws java.beans.PropertyVetoException
s
- the new label textgetText()
public java.lang.String paramString()
public void paintComponent(java.awt.Graphics g)
g
- the graphics context used for paintingComponent.repaint()
,
Component.update(java.awt.Graphics)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener
- listener the listener to add.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener
- listener the listener to remove.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
VetoableChangeListener
- listener the listener to add.removeVetoableChangeListener(java.beans.VetoableChangeListener)
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
VetoableChangeListener
- listener the listener to remove.addVetoableChangeListener(java.beans.VetoableChangeListener)
protected void drawAlignedString(java.awt.Graphics g, java.awt.FontMetrics fm, int baseline, 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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |