|
||||||||||
| 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
ghm.follow.font.FontSelectionPanel
FontSelectionPanel v1.1, copied without functional modification from http://gregmerrill.imagineis.com/fontSelectionPanel.
| Nested Class Summary | |
protected class |
FontSelectionPanel.FontSizeSynchronizer
This class synchronizes font size value between the list containing available font sizes & the text field in which font size is ultimately specified. |
protected static class |
FontSelectionPanel.FontStyleList
Represents a list of the four font styles: plain, bold, italic, and bold italic |
protected static class |
FontSelectionPanel.ListCellRenderer
An implementation of ListCellRenderer which right
justifies all cells. |
protected static class |
FontSelectionPanel.PublicChangeObservable
Subclass of Observable which allows public
access to the setChanged() method. |
| Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
protected javax.swing.JList |
fontFamilyList_
JList for font family |
protected javax.swing.JTextField |
fontSize_
JTextField for font size |
protected javax.swing.JList |
fontSizeList_
JList for font size |
protected FontSelectionPanel.FontStyleList |
fontStyleList_
FontStlyeList (subclass of JList) for font style |
protected int |
maxNumCharsInFontSize_
Maximum number of characters permissibile in a valid font size |
protected FontSelectionPanel.PublicChangeObservable |
observable_
Observable used for registering/notifying Observers |
protected ghm.follow.font.FontSelectionPanel.PhraseCanvas |
phraseCanvas_
PhraseCanvas in which font samples are displayed |
| 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 | |
FontSelectionPanel()
Like FontSelectionPanel(java.awt.Font), except an initialFont
of null will be used. |
|
FontSelectionPanel(java.awt.Font initialFont)
Like FontSelectionPanel(java.awt.Font, String[], int[]), except
that a default list of styles ({"Plain", "Bold", "Italic", "Bold Italic"})
and font sizes ({8, 9, 10, 12, 14}) will be used. |
|
FontSelectionPanel(java.awt.Font initialFont,
java.lang.String[] styleDisplayNames,
int[] predefinedSizes)
Construct a new FontSelectionPanel whose family, style & size widget selections are set according to the supplied initial Font. |
|
| Method Summary | |
void |
addObserver(java.util.Observer o)
Adds an Observer to this FontSelectionPanel; the supplied Observer will have its update() method called any time the Font currently specified in the FontSelectionPanel changes. |
void |
deleteObserver(java.util.Observer o)
Removes an Observer from this FontSelectionPanel. |
java.awt.Font |
getSelectedFont()
Returns the currently selected font. |
java.lang.String |
getSelectedFontFamily()
Returns the currently selected font family |
int |
getSelectedFontSize()
Returns the currently selected font size. |
int |
getSelectedFontStyle()
Returns the currently selected font style. |
void |
setSelectedFont(java.awt.Font font)
Changes the currently selected font by assigning all widget values to match the family/style/size values of the supplied font |
void |
setSelectedFontFamily(java.lang.String family)
Sets the currently selected font family. |
void |
setSelectedFontSize(int size)
Sets the currently selected font size. |
void |
setSelectedFontStyle(int style)
Sets the currently selected font style. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected javax.swing.JList fontFamilyList_
protected FontSelectionPanel.FontStyleList fontStyleList_
protected javax.swing.JTextField fontSize_
protected javax.swing.JList fontSizeList_
protected ghm.follow.font.FontSelectionPanel.PhraseCanvas phraseCanvas_
protected FontSelectionPanel.PublicChangeObservable observable_
protected int maxNumCharsInFontSize_
| Constructor Detail |
public FontSelectionPanel()
FontSelectionPanel(java.awt.Font), except an initialFont
of null will be used.
public FontSelectionPanel(java.awt.Font initialFont)
FontSelectionPanel(java.awt.Font, String[], int[]), except
that a default list of styles ({"Plain", "Bold", "Italic", "Bold Italic"})
and font sizes ({8, 9, 10, 12, 14}) will be used.
initialFont - see
FontSelectionPanel(java.awt.Font, String[], int[])
public FontSelectionPanel(java.awt.Font initialFont,
java.lang.String[] styleDisplayNames,
int[] predefinedSizes)
initialFont - the newly constructed FontSelectionPanel's family, style, and
size widgets will be set according to this value. This value
may be null, in which case an initial font will be
automatically created. This auto-created font will have a
family, style, and size corresponding to the first avaiable
value in the widget form family, style, and size respectively.styleDisplayNames - must contain exactly four members. The members of this array
represent the following styles, in order: Font.PLAIN,
Font.BOLD, Font.ITALIC, and Font.BOLD+Font.ITALICpredefinedSizes - must contain one or more predefined font sizes which will be
available to the user as a convenience for populating the font
size text field; all values must be greater than 0.| Method Detail |
public void addObserver(java.util.Observer o)
o - observer to be addedObserverpublic void deleteObserver(java.util.Observer o)
o - Observer to be removedObserver
public java.lang.String getSelectedFontFamily()
throws NoFontFamilySelectedException
NoFontFamilySelectedException - thrown if no font family is currently selected
public int getSelectedFontStyle()
throws NoFontStyleSelectedException
Font
NoFontStyleSelectedException - thrown if no font style is currently selected
public int getSelectedFontSize()
throws NoFontSizeSpecifiedException,
InvalidFontSizeException
NoFontSizeSpecifiedException - thrown if no font size is currently specified
InvalidFontSizeException - thrown if the font size currently specified is invalid
public java.awt.Font getSelectedFont()
throws InvalidFontException
InvalidFontException - thrown if no valid font is currently specified; the actual
class of the exception thrown may be
InvalidFontException,
NoFontFamilySelectedException,
NoFontStyleSelectedException,
NoFontSizeSpecifiedException, or
InvalidFontSizeExceptionpublic void setSelectedFont(java.awt.Font font)
font - font whose values should be used to set widgets
java.lang.IllegalArgumentException - thrown if the family or style of the font supplied are not
available or invalidpublic void setSelectedFontFamily(java.lang.String family)
family - family to which selection should change
java.lang.IllegalArgumentException - thrown if the supplied font family is not among the list
of available font familiespublic void setSelectedFontStyle(int style)
style - style to which selection should change
java.lang.IllegalArgumentException - thrown if the supplied font style is not one of
Font.PLAIN, Font.BOLD, Font.ITALIC, or
Font.BOLD+Font.ITALICpublic void setSelectedFontSize(int size)
size - size to which selection should change
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||