|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object be.ugent.caagt.swirl.actions.Description
public class Description
An object of this class describes caption, mnemonic and accelerator key of a
GUI component. It is initialized by a single description string (either at
construction time or by calling setDescription(java.lang.String)
) which is then
internally split into different parts. For example, the description string
"Javadoc inde&x search [shift F1]" will be split into the caption
'Javadoc index search', mnemonic 'X' and accelerator key shift-F1.
Accelerator keys, if present, are written between square brackets as the
last part of the description string and use the conventions of method
KeyStroke.getKeyStroke(String)
. Mnemonics are indicated
by placing an ampersand in front of the first occurrence of that letter in
the string. The name of the action is obtained by removing from the
description string the bracketed accelerator
key, any surrounding white space and all ampersands.
Two consecutive ampersands are
not interpreted as a mnemonic, but result in a single ampersand in the
name.
In most cases this class should not be used directly, for buttons and menu
items can most easily be internationalized using actions that extend SimpleAction
.
Constructor Summary | |
---|---|
|
Description(java.lang.String description)
Create a new object based on the given description string. |
protected |
Description(java.lang.String caption,
int mnemonic,
int mnemonicIndex,
javax.swing.KeyStroke acceleratorKey)
Create a new description with the given subconstituents. |
Method Summary | |
---|---|
javax.swing.KeyStroke |
getAcceleratorKey()
Return the accelerator key for this description, or 0 when no key was given. |
static Description |
getCancelButtonDescription()
Return a default description for a Cancel-button. |
java.lang.String |
getCaption()
Return the caption for this description. |
int |
getMnemonic()
Return the mnemonic for this description |
int |
getMnemonicIndex()
Return the index of the mnemonic for this description, or -1 when no mnemonic was given. |
static Description |
getNoButtonDescription()
Return a default description for a No-button. |
static Description |
getOkButtonDescription()
Return a default description for an OK-button. |
static Description |
getYesButtonDescription()
Return a default description for a Yes-button. |
void |
init(javax.swing.AbstractButton button)
Initialize caption and mnemonic for the given button, according to this description. |
void |
init(javax.swing.Action action)
Initialize caption, mnemonic and accelerator key for the given action, according to this description. |
void |
initApproveButton(javax.swing.JFileChooser chooser)
Initialize the approve button and title of the given file chooser, according to this description. |
void |
setDescription(java.lang.String newDescription)
(Re)initialize this object based on the given description string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Description(java.lang.String description)
protected Description(java.lang.String caption, int mnemonic, int mnemonicIndex, javax.swing.KeyStroke acceleratorKey)
Method Detail |
---|
public static Description getOkButtonDescription()
public static Description getCancelButtonDescription()
public static Description getYesButtonDescription()
public static Description getNoButtonDescription()
public final void setDescription(java.lang.String newDescription)
public java.lang.String getCaption()
public int getMnemonic()
public int getMnemonicIndex()
public javax.swing.KeyStroke getAcceleratorKey()
public void init(javax.swing.Action action)
public void init(javax.swing.AbstractButton button)
public void initApproveButton(javax.swing.JFileChooser chooser)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |