Package io.github.jonestimd.swing
Class LabelBuilder
- java.lang.Object
-
- io.github.jonestimd.swing.LabelBuilder
-
public class LabelBuilder extends java.lang.Object
A builder class for creating labels.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LabelBuilder.Factory
A factory class for building multiple labels using the sameResourceBundle
and a common resource prefix.
-
Field Summary
Fields Modifier and Type Field Description static char
NO_MNEMONIC
Character to use for a combined mnemonic and name when the label has no mnemonic.
-
Constructor Summary
Constructors Constructor Description LabelBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LabelBuilder
bold()
Make the label font bold.LabelBuilder
forComponent(java.awt.Component component)
javax.swing.JLabel
get()
LabelBuilder
mnemonic(char mnemonic)
Set the label mnemonic.LabelBuilder
mnemonicAndName(java.lang.String mnemonicAndName)
Set the label's mnemonic and text from a resource bundle value.LabelBuilder
name(java.lang.String text)
Set the label text.
-
-
-
Field Detail
-
NO_MNEMONIC
public static final char NO_MNEMONIC
Character to use for a combined mnemonic and name when the label has no mnemonic.- See Also:
- Constant Field Values
-
-
Method Detail
-
mnemonicAndName
public LabelBuilder mnemonicAndName(java.lang.String mnemonicAndName)
Set the label's mnemonic and text from a resource bundle value. The first character of the value indicates the mnemonic and the rest of the string indicates the label text. If the value starts with'_'
then the label will not have a mnemonic.
-
name
public LabelBuilder name(java.lang.String text)
Set the label text.
-
mnemonic
public LabelBuilder mnemonic(char mnemonic)
Set the label mnemonic.
-
forComponent
public LabelBuilder forComponent(java.awt.Component component)
- Parameters:
component
- the component to be associated with the label
-
bold
public LabelBuilder bold()
Make the label font bold.
-
get
public javax.swing.JLabel get()
-
-