|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel util.swing.JOptionPanel
public class JOptionPanel
A Swing Panel realising a standard option panel layout. That means, option titles are displayed right in front of their corresponding components. All alignment is done automatically.
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.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
BOTTOM
Constant representing bottom alignment. |
static int |
CENTER
Constant representing center alignment. |
static int |
LEFT
Constant representing left alignment. |
static int |
RIGHT
Constant representing right alignment. |
static int |
TOP
Constant representing top alignment. |
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 | |
---|---|
JOptionPanel()
Create a new JOptionPanel without title and horizontal and vertical alignment set to LEFT and TOP, respectively. |
|
JOptionPanel(String text)
Create a new JOptionPanel with horizontal and vertical alignment set to LEFT and TOP, respectively. |
|
JOptionPanel(String text,
int hgap,
int vgap)
Create a new JOptionPanel with horizontal and vertical alignment set to LEFT and TOP, respectively. |
|
JOptionPanel(String text,
int hgap,
int vgap,
int horizAlign,
int vertAlign)
Create a new JOptionPanel. |
Method Summary | |
---|---|
void |
addOption(String title,
JComponent component)
Add the given component under the given title. |
void |
addOption(String title,
Object text)
Add a "display only" option. the text 's toString()
method will be used to construct a JLabel that will be displayed. |
Component |
getOptionComponent(int n)
Get the n-th option component (in the order they were added). |
String |
getText()
Get the option panel's title text. |
void |
setLayout(LayoutManager mgr)
Set layout manager. |
void |
setText(String text)
Set the option panel's title text. |
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 |
---|
public static final int CENTER
public static final int LEFT
public static final int RIGHT
public static final int TOP
public static final int BOTTOM
Constructor Detail |
---|
public JOptionPanel()
public JOptionPanel(String text)
text
- The title text of the panel. Can be set to null
to indicate that there is no title.public JOptionPanel(String text, int hgap, int vgap)
text
- The title text of the panel. Can be set to null
to indicate that there is no title.hgap
- Horizontal gap (between titles and components).vgap
- Vertical gap.public JOptionPanel(String text, int hgap, int vgap, int horizAlign, int vertAlign)
text
- The title text of the panel. Can be set to null
to indicate that there is no title.hgap
- Horizontal gap (between titles and components).vgap
- Vertical gap.horizAlign
- Horizontal aligment. Can be either LEFT
, RIGHT
or CENTER
.vertAlign
- Vertical alignment. Can be either TOP
, BOTTOM
or CENTER
.Method Detail |
---|
public void setText(String text)
text
- The title text of the panel. Can be set to null
to indicate that there is no title.public String getText()
public void addOption(String title, JComponent component)
If the component's preferred width is set to Integer.MAX_VALUE
,
it will take up all possibly available horizontal space. If the component's
preferred height is set to Integer.MAX_VALUE
, it will take up
all vertical space that is left. Note that there cannot be any other components
underneath such a component.
Components are always shown in the order they have been added (from top to bottom).
title
- The option's title. If it is no empty string, a colon (":")
will be added automatically.component
- The component representing the option in however way.public void addOption(String title, Object text)
text
's toString()
method will be used to construct a JLabel
that will be displayed.
That is merely a convenience method that allows you to simply display information.
For example, you could do something like: addOption("File", "test.txt");
.
title
- The option's title. If it is no empty string, a colon (":")
will be added automatically.text
- The object representing the text to show.public Component getOptionComponent(int n)
n
- Number of the component to retrieve.
public void setLayout(LayoutManager mgr)
setLayout
in class Container
|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |