|
Oracle JEWT 4.2.10 | ||||||||
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 | +--oracle.bali.ewt.painter.PaintContextComponent | +--oracle.bali.ewt.LWComponent | +--oracle.bali.ewt.scrolling.ScrollableComponent | +--oracle.bali.ewt.text.MultiLineLabel
A component that displays multiple lines of read-only text. The MultiLineLabel supports:
Note that the MultiLineLabel calculates it's preferred size, and lays out, according to the following rules:
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
static int |
ALIGNMENT_CENTER
Constant to specify center alignment of MultiLineLabel. |
static int |
ALIGNMENT_DEFAULT
Constant to specify default alignment of MultiLineLabel. |
static int |
ALIGNMENT_LEFT
Constant to specify left alignment of MultiLineLabel. |
static int |
ALIGNMENT_RIGHT
Constant to specify right alignment of MultiLineLabel. |
static float |
ASPECTRATIO_NONE
Constant to specify that the MultLineLabel has no preferred aspect ratio. |
static int |
NOT_SET
Constant used to indicate to setPreferredRows() or setPreferredColumns() that the columns or rows should be calculated dynamically. |
static java.lang.String |
PROPERTY_TEXT
Constant to specify text property. |
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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
MultiLineLabel()
Creates an empty MultilineLabel. |
|
MultiLineLabel(java.lang.String text)
Creates a MultiLineLabel displaying text wrapped on carriage returns. |
|
MultiLineLabel(TextWrapper wrapper,
java.lang.String text)
Creates a MultiLineLabel displaying text wrapped by the wrapper TextWrapper. |
Method Summary | |
void |
addNotify()
Override of ScrollableComponent.addNotify(). |
javax.swing.JToolTip |
createToolTip()
Override to create a MultiLineToolTip by default. |
void |
doLayout()
Overrides Component.doLayout() to validate the MultiLineLabel's layout. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Get the AccessibleContext of this object |
java.awt.Color |
getForeground()
Override to dynamically return the color if it's defaulted. |
int |
getMaximumColumns()
Returns the maximum allowable number of columns. |
int |
getMaximumRows()
Returns the maximum allowable number of rows. |
java.awt.Dimension |
getMaximumSize()
Override to return maximum size based on maximumColumns and maximumRows. |
int |
getMinimumColumns()
Returns the minimum allowable number of columns. |
int |
getMinimumRows()
Returns the minimum allowable number of rows. |
java.awt.Dimension |
getMinimumSize()
Override of getMinimumSize(). |
float |
getPreferredAspectRatio()
Returns how much wider than tall the MultiLineLabel prefers to be. |
int |
getPreferredColumns()
Returns the preferred number of columns to show, or NOT_SET if none have been set. |
int |
getPreferredRows()
Returns the preferred number of rows to show, or NOT_SET if none have been set. |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for a view component. |
boolean |
getScrollableTracksViewportWidth()
Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport. |
java.lang.String |
getText()
Returns the text displayed by the MultiLineLabel. |
TextWrapper |
getTextWrapper()
Returns the TextWrapper used to wrap this MultiLineLabel's text. |
protected int |
getVMaximum()
Protected method used to configure the vertical scroll manager range. |
protected int |
getVOffsetOfValue(int value)
Protected method used to get the vertical scroll value for a canvas offset. |
protected int |
getVValueOfOffset(int y)
Protected method used to get the vertical offset for a scroll manager value. |
boolean |
isFullyJustified()
Returns whether the MultiLineLabel is being displayed with full justification. |
boolean |
isHScrollable()
Override ScrollableComponent.isHScrollable to return true, since MultiLineLabels support horizontal scrolling. |
boolean |
isVScrollable()
Override ScrollableComponent.isVScrollable to return true, since MultiLineLabels support vertical scrolling. |
protected java.awt.Dimension |
layoutCanvas()
Implementation of Scrollable interface getContentSize(). |
protected void |
paintCanvasInterior(java.awt.Graphics g)
Override of LWComponent.paintInterior(). |
void |
setFont(java.awt.Font newFont)
Override of Component.setFont(). |
void |
setForeground(java.awt.Color c)
Override to mark the foreground color as no longer defaulted. |
void |
setFullJustification(boolean useFullJustification)
Sets whether the text displayed in the MultiLineLabel is fully justified. |
void |
setLocale(java.util.Locale newLocale)
Override of setLocale(). |
void |
setMaximumColumns(int columns)
Sets the maximum number of columns allowable. |
void |
setMaximumRows(int rows)
Sets the maximum number of rows allowable. |
void |
setMaximumSize(java.awt.Dimension maximumSize)
Override to reset maximum columns and maximum rows to NOT_SET. |
void |
setMinimumColumns(int columns)
Sets the minimum numberof columns allowable. |
void |
setMinimumRows(int rows)
Sets the minimum number of rows allowable. |
void |
setMinimumSize(java.awt.Dimension minimumSize)
Override to reset minimum columns and minimum rows to NOT_SET. |
void |
setPreferredAspectRatio(float preferredAspectRation)
Sets how much wider than tall the MultiLineLabel prefers to be. |
void |
setPreferredColumns(int columns)
Sets the preferred number of columns to show; columns may be the NOT_SET value indicating that the preferred width should be calculated dynamically based on other factors. |
void |
setPreferredRows(int rows)
Sets the preferred number of rows to show; rows may be the NOT_SET value indicating that the preferred height should be calculated dynamically based on other factors. |
void |
setText(java.lang.String label)
Sets the text to be displayed by the MultiLineLabel. |
void |
setTextWrapper(TextWrapper newWrapper)
Sets the TextWrapper to use when wrapping text. |
void |
updateUI()
Notification that the LookAndFeel has changed. |
Methods inherited from class oracle.bali.ewt.scrolling.ScrollableComponent |
autoscroll, clipCanvasToParents, convertCanvasToOuter, convertInnerToOuterSize, convertInnerToOuterSize, convertInteriorToOuter, convertOuterToCanvas, convertOuterToInterior, getAutoscrollInsets, getCanvasBounds, getCanvasGraphics, getCanvasHeight, getCanvasOrigin, getCanvasOriginX, getCanvasOriginY, getCanvasSize, getCanvasWidth, getDocumentSize, getHMaximum, getHOffsetOfValue, getHValueOfOffset, getInnerBounds, getInnerHeight, getInnerOrigin, getInnerSize, getInnerWidth, getPreferredSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableUnitIncrement, getScrollParent, getViewport, invalidateCanvas, layout, makeCanvasGraphics, paintComponent, paintImmediateCanvas, printPage, removeNotify, repaintCanvas, setCanvasBounds, setCanvasOrigin, setCanvasSize, setPreferredSize |
Methods inherited from class oracle.bali.ewt.LWComponent |
clipToParents, freezeRepaints, getActualAlignment, getActualReadingDirection, getAlignment, getBorderInsets, getFill, getPageBounds, getPrintPaintContext, isFocusTraversable, paintChildren, paintImmediateInterior, paintImmediateInterior, paintImmediately, paintOverChildren, processEvent, processEventImpl, repaint, repaintInterior, repaintInterior, setAlignment, setFill, unfreezeRepaints |
Methods inherited from class oracle.bali.ewt.painter.PaintContextComponent |
getBorderContext, getPaintContext, getPaintData, getPaintState, getUIDefaults, setUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, 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, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, 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 |
public static final int NOT_SET
public static final int ALIGNMENT_DEFAULT
public static final int ALIGNMENT_LEFT
public static final int ALIGNMENT_RIGHT
public static final int ALIGNMENT_CENTER
public static final java.lang.String PROPERTY_TEXT
public static final float ASPECTRATIO_NONE
getPreferredAspectRatio()
,
setPreferredAspectRatio(float)
Constructor Detail |
public MultiLineLabel()
public MultiLineLabel(java.lang.String text)
text
- The text to disply in the MultiLineLabelpublic MultiLineLabel(TextWrapper wrapper, java.lang.String text)
wrapper
- The textWrapper to use to wrap the MultiLineLabel's
text.text
- The text to disply in the MultiLineLabel
TextWrapper
Method Detail |
public void setText(java.lang.String label)
Fires PROPERTY_TEXT ("text") property change event.
label
- The text to display in the MultiLineLabel
getText()
public java.lang.String getText()
setText(java.lang.String)
public void setTextWrapper(TextWrapper newWrapper)
newWrapper
- The TextWrapper to use to wrap this MultiLineLabel
getTextWrapper()
,
TextWrapper
public TextWrapper getTextWrapper()
setTextWrapper(oracle.bali.ewt.text.TextWrapper)
public int getMaximumColumns()
setMaximumSize()
has been called, or the maximum number of
columns was never set, this will return NOT_SET.setMaximumColumns(int)
,
getMaximumRows()
,
setMaximumRows(int)
public void setMaximumColumns(int columns)
getMaximumColumns()
,
getMaximumRows()
,
setMaximumRows(int)
public int getMaximumRows()
setMaximumSize()
has been called, or the maximum number of
rows was never set, this will return NOT_SET.setMaximumRows(int)
,
getMaximumColumns()
,
setMaximumColumns(int)
public void setMaximumRows(int rows)
getMaximumRows()
,
getMaximumColumns()
,
setMaximumColumns(int)
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class javax.swing.JComponent
public void setMaximumSize(java.awt.Dimension maximumSize)
setMaximumSize
in class javax.swing.JComponent
public int getMinimumColumns()
setMinimumColumns(int)
,
getMinimumRows()
,
setMinimumRows(int)
public void setMinimumColumns(int columns)
getMinimumColumns()
,
getMinimumRows()
,
setMinimumRows(int)
public void setMinimumSize(java.awt.Dimension minimumSize)
setMinimumSize
in class javax.swing.JComponent
public int getMinimumRows()
setMinimumSize()
has been called, this will return
NOT_SET.setMinimumRows(int)
,
getMinimumColumns()
,
setMinimumColumns(int)
public void setMinimumRows(int rows)
setMinimumSize()
after this call, then the minimum rows will
be changed to NOT_SET and the minimum size call will take precedence.getMinimumRows()
,
getMinimumColumns()
,
setMinimumColumns(int)
public void setPreferredColumns(int columns)
getPreferredColumns()
,
getPreferredRows()
,
setPreferredRows(int)
public int getPreferredColumns()
setPreferredColumns(int)
,
getPreferredRows()
,
setPreferredRows(int)
public void setPreferredRows(int rows)
getPreferredRows()
,
setPreferredColumns(int)
,
getPreferredColumns()
public int getPreferredRows()
setPreferredRows(int)
,
setPreferredColumns(int)
,
getPreferredColumns()
public void setFullJustification(boolean useFullJustification)
useFullJustification
- Whether the MuliLineLabel should be displayed
with full justification.
isFullyJustified()
public boolean isFullyJustified()
setFullJustification(boolean)
public void setPreferredAspectRatio(float preferredAspectRation)
preferredAspectRation
- The ratio of width to height that the
MultiLineLabel should strive for when returning its preferred size.
If ASPECTRATIO_NONE, then getPreferredSize() will ignore the aspect ratio when calculating the size of the MultiLineLabel. This is useful when using the MultiLineLabel in constrained layout managers, such as NORTH in a Borderlayout.
getPreferredAspectRatio()
,
ScrollableComponent.getPreferredSize()
public float getPreferredAspectRatio()
setPreferredAspectRatio(float)
public java.awt.Color getForeground()
getForeground
in class java.awt.Component
public void setForeground(java.awt.Color c)
setForeground
in class javax.swing.JComponent
public void setFont(java.awt.Font newFont)
MultiLineLabel overrides Component setFont() in order to force relayout of the MultiLineLabel whenever the font changes. Subclasses that override this methods must call super.setFont(font).
setFont
in class javax.swing.JComponent
public void setLocale(java.util.Locale newLocale)
MultiLineLabel overrides setLocale to catch when the locale changes, since this could potentially result in a relayout due to changes in how different locales wrap text.
setLocale
in class java.awt.Component
public javax.swing.JToolTip createToolTip()
createToolTip
in class javax.swing.JComponent
public void updateUI()
updateUI
in class oracle.bali.ewt.LWComponent
public void doLayout()
doLayout
in class java.awt.Container
public boolean isHScrollable()
isHScrollable
in class oracle.bali.ewt.scrolling.ScrollableComponent
ScrollableComponent.isHScrollable()
public boolean isVScrollable()
isVScrollable
in class oracle.bali.ewt.scrolling.ScrollableComponent
ScrollableComponent.isVScrollable()
protected int getVMaximum()
Since MultiLineLabels scroll vertically by lines, we return the number of lines in the MultiLineLabel for this.
getVMaximum
in class oracle.bali.ewt.scrolling.ScrollableComponent
protected int getVOffsetOfValue(int value)
Since the MultiLineLabel scrolls by lines vertically, we need to convert the line index into a pixel value.
getVOffsetOfValue
in class oracle.bali.ewt.scrolling.ScrollableComponent
The
- vertical canvas offset in pixels, typically a negative value.
getVValueOfOffset(int)
protected int getVValueOfOffset(int y)
Since the MultiLineLabel scrolls by lines vertically, we need to convert the pixel value passed to us to the line in the MultiLineLabel it refers to.
getVValueOfOffset
in class oracle.bali.ewt.scrolling.ScrollableComponent
The
- vertical value that needs to be convertedprotected java.awt.Dimension layoutCanvas()
Returns the size of the MultiLineLabel's content area.
layoutCanvas
in class oracle.bali.ewt.scrolling.ScrollableComponent
public void addNotify()
MultiLineLabel overrides ScrollableComponent.addNotify() to do some initialization work. Clients that need to override this method must call super.addNotify() so that the MultiLineLabel will get initialized properly.
addNotify
in class oracle.bali.ewt.scrolling.ScrollableComponent
protected void paintCanvasInterior(java.awt.Graphics g)
MultiLineLabel overrides paintCanvasInterior to actually display the MultiLineLabel. paintCanvasInterior is responsible for the following when rendering the MultiLineLabel's text: Displaying left, right, and center alignment Displaying full justification Displaying the minimum number of lines for the visible portion of a scrolled MultiLineLabel
Note that we do not attempt to optimize horizontal scrolling by logically clipping to the horizontal bounds of the drawRect.
paintCanvasInterior
in class oracle.bali.ewt.scrolling.ScrollableComponent
g
- The graphics object to draw this MultiLineLabel withdrawRect
- The rectangle to redraw. The drawRect is specified in
outer coordinates.public java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in class oracle.bali.ewt.scrolling.ScrollableComponent
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in class oracle.bali.ewt.scrolling.ScrollableComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public javax.accessibility.AccessibleContext getAccessibleContext()
getAccessibleContext
in interface javax.accessibility.Accessible
getAccessibleContext
in class javax.swing.JComponent
|
Oracle JEWT 4.2.10 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |