|
|||||||||
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
edu.princeton.toy.choosers.TFontChooserPane
public class TFontChooserPane
TFontChooserPane manages a set of fonts for various areas and allows the user to change those fonts for those areas.
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 | |
---|---|
static String[] |
FONT_FAMILIES
A list of all font families. |
static int[] |
FONT_SIZES
A list of all font sizes. |
static int[] |
FONT_STYLE_MASKS
Font style masks corresponding to the FONT_STYLES array. |
static String[] |
FONT_STYLES
Strings corresponding to the styles available. |
static String |
UPDATE_COMMAND
The command that causes the TFontChooserPane to update its components with the internal data. |
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 | |
---|---|
TFontChooserPane(String[] fontAreas)
Creates a new TFontChooserPane. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
Implement ActionListener to pay attention to changes in the areaComboBox. |
boolean |
doCommand(String command,
Object extraInfo)
Performs a command based on the argument. |
Font |
getFont(int areaIndex)
Gets the font for a given area. |
void |
setFont(Font font,
int areaIndex)
Sets the font for a given area. |
void |
setFont(String family,
boolean bold,
boolean italic,
int size,
int areaIndex)
Sets the font for a given area. |
void |
valueChanged(ListSelectionEvent e)
Implement ListSelectionListener to pay attention to changes in the fontList, styleList, and sizeList. |
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 String UPDATE_COMMAND
public static final String[] FONT_FAMILIES
public static final String[] FONT_STYLES
public static final int[] FONT_STYLE_MASKS
public static final int[] FONT_SIZES
Constructor Detail |
---|
public TFontChooserPane(String[] fontAreas)
Method Detail |
---|
public Font getFont(int areaIndex)
areaIndex
- The index of the area whose font we're getting. An invalid value will
result in an ArrayIndexOutOfBoundsException.
public void setFont(Font font, int areaIndex)
font
- The new font for the given area. A null value will result in a
NullPointerException.areaIndex
- The index of the area whose font we're setting. An invalid value will
result in an ArrayIndexOutOfBoundsException.public void setFont(String family, boolean bold, boolean italic, int size, int areaIndex)
family
- The family of the font. If null was passed or the family was not found, then
& "Default" will be used.bold
- Wheter or not the font is bold.italic
- Wheter or not the font is italic.size
- The size of the font. The font size will be adjusted to the closest available
size.areaIndex
- The index of the area whose font we're setting.public boolean doCommand(String command, Object extraInfo)
command
- A string representing the command. Note that pointer equality (not string
equality) is tested here, so it is important to use the string constants defined in this
class. An IllegalArgumentException will be thrown if the argument is invalid.
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
public void valueChanged(ListSelectionEvent e)
valueChanged
in interface ListSelectionListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |