|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.ehsbe.commons.gui.JxTextPanel
public class JxTextPanel
A JPanel, which just displays text. The String gets broken into paragraphs using the linefeed character ('\n') and each paragraph gets broken into lines wrt. to the current width of the "monitored" container or the max. length of a line in characters.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected RenderingHints |
hints
rendering hints to use |
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 | |
---|---|
JxTextPanel(String text)
A Panel, which displays the given text using its scrollpane conainer's size for layout. |
|
JxTextPanel(String text,
int lineLength)
A Panel, which displays the given text. |
Method Summary | |
---|---|
int |
getLineLength()
Get the max. length of a line used to determine the preferred layout size of this instance. |
Dimension |
getPreferredSize()
|
Dimension |
getPreferredSize(int lineLength)
Get the prefered size wrt. to a fixed line length. |
String |
getText()
Get the text to be displayed by this panel. |
protected void |
paintComponent(Graphics g)
|
void |
setLineLength(int lineLength)
Set the max. length of a line to use for determination of the preferred layout size of this instance. |
void |
setText(String text)
Set the text to be displayed. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected RenderingHints hints
Constructor Detail |
---|
public JxTextPanel(String text, int lineLength)
text
- text to displaylineLength
- max. line length. If > 0, preferred size gets
determined by breaking the text into N lines of plain text with the
specified length. Otherwise the lines are broken wrt. to the available
width obtained from its scrollpane container.public JxTextPanel(String text)
text
- text to displayMethod Detail |
---|
public Dimension getPreferredSize(int lineLength)
lineLength
- max. number of characters per line.
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
protected void paintComponent(Graphics g)
paintComponent
in class JComponent
public int getLineLength()
-1
if line length is not used to determined the preferred
size, the max. line length otherwise.public void setLineLength(int lineLength)
lineLength
- the max. line length in characters to use for layout.
If -1
, the line length will not be used to determined the
preferred size (but the scrollpane containers size).public void setText(String text)
text
- text to display.public String getText()
null
if not set, the text otherwise.
|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |