|
||||||||||
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.JOptionPane
org.crosswire.common.swing.CWOptionPane
public class CWOptionPane
CWOptionPane is just like JOptionPane, but internationalize the button text for some languages that Java does not handle, for which JSword has translations.
for license details.
The copyright to this program is held by it's authors.
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JOptionPane |
---|
JOptionPane.AccessibleJOptionPane |
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 | |
---|---|
(package private) static ActionFactory |
actions
The actions for this dialog. |
private static long |
serialVersionUID
Serialization ID |
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 | |
---|---|
CWOptionPane()
Creates a CWOptionPane with a test message. |
|
CWOptionPane(Object message)
Creates a instance of CWOptionPane to display a
message using the
plain-message message type and the default options delivered by
the UI. |
|
CWOptionPane(Object message,
int messageType)
Creates an instance of CWOptionPane to display a message
with the specified message type and the default options, |
|
CWOptionPane(Object message,
int messageType,
int optionType)
Creates an instance of CWOptionPane to display a message
with the specified message type and options. |
|
CWOptionPane(Object message,
int messageType,
int optionType,
Icon icon)
Creates an instance of CWOptionPane to display a message
with the specified message type, options, and icon. |
|
CWOptionPane(Object message,
int messageType,
int optionType,
Icon icon,
Object[] options)
Creates an instance of CWOptionPane to display a message
with the specified message type, icon, and options. |
|
CWOptionPane(Object message,
int messageType,
int optionType,
Icon icon,
Object[] options,
Object initialValue)
Creates an instance of CWOptionPane to display a message
with the specified message type, icon, and options, with the
initially-selected option specified. |
Method Summary | |
---|---|
private JDialog |
createDialog(Component parentComponent,
String title,
int style)
|
private static Object[] |
fixOptions(Object[] options,
int optionType,
int messageType)
|
private static String |
getActionName(String key)
|
static int |
showConfirmDialog(Component parentComponent,
Object message)
Brings up a dialog with the options Yes, No and Cancel; with the title, Select an Option. |
static int |
showConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType)
Brings up a dialog where the number of choices is determined by the optionType parameter. |
static int |
showConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType,
int messageType)
Brings up a dialog where the number of choices is determined by the optionType parameter, where the
messageType
parameter determines the icon to display. |
static int |
showConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType,
int messageType,
Icon icon)
Brings up a dialog with a specified icon, where the number of choices is determined by the optionType parameter. |
static String |
showInputDialog(Component parentComponent,
Object message)
Shows a question-message dialog requesting input from the user parented to parentComponent . |
static String |
showInputDialog(Component parentComponent,
Object message,
Object initialSelectionValue)
Shows a question-message dialog requesting input from the user and parented to parentComponent . |
static String |
showInputDialog(Component parentComponent,
Object message,
String title,
int messageType)
Shows a dialog requesting input from the user parented to parentComponent with the dialog having the title
title and message type messageType . |
static Object |
showInputDialog(Component parentComponent,
Object message,
String title,
int messageType,
Icon icon,
Object[] selectionValues,
Object initialSelectionValue)
Prompts the user for input in a blocking dialog where the initial selection, possible selections, and all other options can be specified. |
static String |
showInputDialog(Object message)
Shows a question-message dialog requesting input from the user. |
static String |
showInputDialog(Object message,
Object initialSelectionValue)
Shows a question-message dialog requesting input from the user, with the input value initialized to initialSelectionValue . |
static void |
showMessageDialog(Component parentComponent,
Object message)
Brings up an information-message dialog titled "Message". |
static void |
showMessageDialog(Component parentComponent,
Object message,
String title,
int messageType)
Brings up a dialog that displays a message using a default icon determined by the messageType parameter. |
static void |
showMessageDialog(Component parentComponent,
Object message,
String title,
int messageType,
Icon icon)
Brings up a dialog displaying a message, specifying all parameters. |
static int |
showOptionDialog(Component parentComponent,
Object message,
String title,
int optionType,
int messageType,
Icon icon,
Object[] options,
Object initialValue)
Brings up a dialog with a specified icon, where the initial choice is determined by the initialValue parameter and the number of
choices is determined by the optionType parameter. |
private static int |
styleFromMessageType(int messageType)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static ActionFactory actions
private static final long serialVersionUID
Constructor Detail |
---|
public CWOptionPane()
CWOptionPane
with a test message.
public CWOptionPane(Object message)
CWOptionPane
to display a
message using the
plain-message message type and the default options delivered by
the UI.
message
- the Object
to displaypublic CWOptionPane(Object message, int messageType)
CWOptionPane
to display a message
with the specified message type and the default options,
message
- the Object
to displaymessageType
- the type of message to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
public CWOptionPane(Object message, int messageType, int optionType)
CWOptionPane
to display a message
with the specified message type and options.
message
- the Object
to displaymessageType
- the type of message to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
optionType
- the options to display in the pane:
DEFAULT_OPTION
, YES_NO_OPTION
,
YES_NO_CANCEL_OPTION
,
OK_CANCEL_OPTION
public CWOptionPane(Object message, int messageType, int optionType, Icon icon)
CWOptionPane
to display a message
with the specified message type, options, and icon.
message
- the Object
to displaymessageType
- the type of message to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
optionType
- the options to display in the pane:
DEFAULT_OPTION
, YES_NO_OPTION
,
YES_NO_CANCEL_OPTION
,
OK_CANCEL_OPTION
icon
- the Icon
image to displaypublic CWOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options)
CWOptionPane
to display a message
with the specified message type, icon, and options.
None of the options is initially selected.
The options objects should contain either instances of
Component
s, (which are added directly) or
Strings
(which are wrapped in a JButton
).
If you provide Component
s, you must ensure that when the
Component
is clicked it messages setValue
in the created CWOptionPane
.
message
- the Object
to displaymessageType
- the type of message to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
optionType
- the options to display in the pane:
DEFAULT_OPTION
,
YES_NO_OPTION
,
YES_NO_CANCEL_OPTION
,
OK_CANCEL_OPTION
icon
- the Icon
image to displayoptions
- the choices the user can selectpublic CWOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue)
CWOptionPane
to display a message
with the specified message type, icon, and options, with the
initially-selected option specified.
message
- the Object
to displaymessageType
- the type of message to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
optionType
- the options to display in the pane:
DEFAULT_OPTION
,
YES_NO_OPTION
,
YES_NO_CANCEL_OPTION
,
OK_CANCEL_OPTION
icon
- the Icon image to displayoptions
- the choices the user can selectinitialValue
- the choice that is initially selected; if
null
, then nothing will be initially selected;
only meaningful if options
is usedMethod Detail |
---|
public static String showInputDialog(Object message) throws HeadlessException
message
- the Object
to display
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static String showInputDialog(Object message, Object initialSelectionValue)
initialSelectionValue
. The
dialog uses the default frame, which usually means it is centered on
the screen.
message
- the Object
to displayinitialSelectionValue
- the value used to initialize the input
fieldpublic static String showInputDialog(Component parentComponent, Object message) throws HeadlessException
parentComponent
.
The dialog is displayed on top of the Component
's
frame, and is usually positioned below the Component
.
parentComponent
- the parent Component
for the
dialogmessage
- the Object
to display
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static String showInputDialog(Component parentComponent, Object message, Object initialSelectionValue)
parentComponent
. The input value will be
initialized to initialSelectionValue
.
The dialog is displayed on top of the Component
's
frame, and is usually positioned below the Component
.
parentComponent
- the parent Component
for the
dialogmessage
- the Object
to displayinitialSelectionValue
- the value used to initialize the input
fieldpublic static String showInputDialog(Component parentComponent, Object message, String title, int messageType) throws HeadlessException
parentComponent
with the dialog having the title
title
and message type messageType
.
parentComponent
- the parent Component
for the
dialogmessage
- the Object
to displaytitle
- the String
to display in the dialog
title barmessageType
- the type of message that is to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static Object showInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue) throws HeadlessException
selectionValues
, where null
implies the
user can input
whatever they wish, usually by means of a JTextField
.
initialSelectionValue
is the initial value to prompt
the user with. It is up to the UI to decide how best to represent
the selectionValues
, but usually a
JComboBox
, JList
, or
JTextField
will be used.
parentComponent
- the parent Component
for the
dialogmessage
- the Object
to displaytitle
- the String
to display in the
dialog title barmessageType
- the type of message to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
icon
- the Icon
image to displayselectionValues
- an array of Object
s that
gives the possible selectionsinitialSelectionValue
- the value used to initialize the input
field
null
meaning the user
canceled the input
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static void showMessageDialog(Component parentComponent, Object message) throws HeadlessException
parentComponent
- determines the Frame
in
which the dialog is displayed; if null
,
or if the parentComponent
has no
Frame
, a default Frame
is usedmessage
- the Object
to display
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType) throws HeadlessException
messageType
parameter.
parentComponent
- determines the Frame
in which the dialog is displayed; if null
,
or if the parentComponent
has no
Frame
, a default Frame
is usedmessage
- the Object
to displaytitle
- the title string for the dialogmessageType
- the type of message to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon) throws HeadlessException
parentComponent
- determines the Frame
in which the
dialog is displayed; if null
,
or if the parentComponent
has no
Frame
, a
default Frame
is usedmessage
- the Object
to displaytitle
- the title string for the dialogmessageType
- the type of message to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
icon
- an icon to display in the dialog that helps the user
identify the kind of message that is being displayed
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static int showConfirmDialog(Component parentComponent, Object message) throws HeadlessException
parentComponent
- determines the Frame
in which the
dialog is displayed; if null
,
or if the parentComponent
has no
Frame
, a
default Frame
is usedmessage
- the Object
to display
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType) throws HeadlessException
optionType
parameter.
parentComponent
- determines the Frame
in which the
dialog is displayed; if null
,
or if the parentComponent
has no
Frame
, a
default Frame
is usedmessage
- the Object
to displaytitle
- the title string for the dialogoptionType
- an int designating the options available on the dialog:
YES_NO_OPTION
, or
YES_NO_CANCEL_OPTION
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType) throws HeadlessException
optionType
parameter, where the
messageType
parameter determines the icon to display.
The messageType
parameter is primarily used to supply
a default icon from the Look and Feel.
parentComponent
- determines the Frame
in
which the dialog is displayed; if null
,
or if the parentComponent
has no
Frame
, a
default Frame
is used.message
- the Object
to displaytitle
- the title string for the dialogoptionType
- an integer designating the options available
on the dialog: YES_NO_OPTION
,
or YES_NO_CANCEL_OPTION
messageType
- an integer designating the kind of message this is;
primarily used to determine the icon from the pluggable
Look and Feel: ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon) throws HeadlessException
optionType
parameter.
The messageType
parameter is primarily used to supply
a default icon from the look and feel.
parentComponent
- determines the Frame
in which the
dialog is displayed; if null
,
or if the parentComponent
has no
Frame
, a
default Frame
is usedmessage
- the Object to displaytitle
- the title string for the dialogoptionType
- an int designating the options available on the dialog:
YES_NO_OPTION
,
or YES_NO_CANCEL_OPTION
messageType
- an int designating the kind of message this is,
primarily used to determine the icon from the pluggable
Look and Feel: ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
icon
- the icon to display in the dialog
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
public static int showOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue) throws HeadlessException
initialValue
parameter and the number of
choices is determined by the optionType
parameter.
If optionType
is YES_NO_OPTION
, or
YES_NO_CANCEL_OPTION
and the options
parameter is null
, then the options are supplied by the
look and feel.
The messageType
parameter is primarily used to supply a
default icon from the look and feel.
parentComponent
- determines the Frame
in which the
dialog is displayed; if null
, or if the
parentComponent
has no Frame
, a
default Frame
is usedmessage
- the Object
to displaytitle
- the title string for the dialogoptionType
- an integer designating the options available on the
dialog: YES_NO_OPTION
, or
YES_NO_CANCEL_OPTION
messageType
- an integer designating the kind of message this is,
primarily used to determine the icon from the pluggable Look
and Feel: ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
, QUESTION_MESSAGE
,
or PLAIN_MESSAGE
icon
- the icon to display in the dialogoptions
- an array of objects indicating the possible choices the
user can make; if the objects are components, they are
rendered properly; non-String
objects are
rendered using their toString
methods; if this
parameter is null
, the options are determined
by the Look and FeelinitialValue
- the object that represents the default selection for
the dialog; only meaningful if options
is used;
can be null
CLOSED_OPTION
if the user closed the dialog
HeadlessException
- if
GraphicsEnvironment.isHeadless
returns
true
GraphicsEnvironment.isHeadless()
private JDialog createDialog(Component parentComponent, String title, int style) throws HeadlessException
HeadlessException
private static int styleFromMessageType(int messageType)
private static String getActionName(String key)
private static Object[] fixOptions(Object[] options, int optionType, int messageType)
|
Copyright ยจ 2003-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |