com.zfqjava.swing
Class JFontChooser

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.zfqjava.swing.JFontChooser
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JFontChooser
extends javax.swing.JComponent
implements javax.accessibility.Accessible

JFontChooser provides a pane of controls designed to allow a user to manipulate and select a font.

Client Property:
NameValueDefault Value
JFontChooser.forContentType
  • text/plain
  • text/rtf
  • text/html
text/plain
JFontChooser.defaultEffectEnabled
  • Boolean.TRUE
  • Boolean.FALSE
Boolean.FALSE

See Also:
Serialized Form

Inner Class Summary
protected  class JFontChooser.AccessibleJFontChooser
          This class implements accessibility support for the JFontChooser class.
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  javax.accessibility.AccessibleContext accessibleContext
           
static int CANCEL_OPTION
          Return value if cancel is chosen.
static int OK_OPTION
          Return value if ok is chosen.
 
Fields inherited from class javax.swing.JComponent
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
JFontChooser()
          Constructs a JFontChooser.
 
Method Summary
protected  javax.swing.JDialog createDialog(java.awt.Component parent, java.lang.String title, JFontChooser fontChooser, java.awt.event.ActionListener okListener, java.awt.event.ActionListener cancelListener)
          Creates the dialog for the JFontChooser.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this JFontChooser.
 java.lang.Object[] getEffectSet()
          Returns the font effects which can be selected.
 java.awt.Color getFontColor()
          Returns the current font color.
 java.util.Locale getFontLocale()
          Returns the current font locale.
 java.lang.Object[] getSelectedEffects()
          Returns the selected font effects.
 java.awt.Font getSelectedFont()
          Returns the selected font.
 FontChooserUI getUI()
          Gets the UI object which implements the L&F for this component.
 java.lang.String getUIClassID()
          Returns a string that specifies the name of the L&F class that renders this component.
protected  java.lang.String paramString()
          Returns a string representation of this JFontChooser.
 void setEffectSet(java.lang.Object[] effects)
          Sets the font effects which can be selected.
 void setFontColor(java.awt.Color fontColor)
          Sets the current font color.
 void setFontLocale(java.util.Locale fontLocale)
          Sets the current font locale.
 void setSelectedEffects(java.lang.Object[] selectedEffects)
          Sets the selected font effects.
 void setSelectedFont(java.awt.Font font)
          Sets the font to be selected.
 int showDialog(java.awt.Component parent)
          Pops up a dialog contains the JFontChooser and parented to parent with the dialog having a default title.
 int showDialog(java.awt.Component parent, java.lang.String title)
          Pops up a dialog contains the JFontChooser and parented to parent with the dialog having a title title.
 void updateUI()
          Notification from the UIFactory that the L&F has changed.
 
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, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OK_OPTION

public static final int OK_OPTION
Return value if ok is chosen.

CANCEL_OPTION

public static final int CANCEL_OPTION
Return value if cancel is chosen.

accessibleContext

protected javax.accessibility.AccessibleContext accessibleContext
Constructor Detail

JFontChooser

public JFontChooser()
Constructs a JFontChooser.
See Also:
JFontChooser()
Method Detail

updateUI

public void updateUI()
Notification from the UIFactory that the L&F has changed.
Overrides:
updateUI in class javax.swing.JComponent
See Also:
JComponent.updateUI()

getUIClassID

public java.lang.String getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component.
Overrides:
getUIClassID in class javax.swing.JComponent
Returns:
the string "FileChooserUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

getUI

public FontChooserUI getUI()
Gets the UI object which implements the L&F for this component.
Returns:
the FileChooserUI object that implements the FileChooserUI L&F

getSelectedFont

public java.awt.Font getSelectedFont()
Returns the selected font.
Returns:
the selected font
See Also:
setSelectedFont(java.awt.Font)

setSelectedFont

public void setSelectedFont(java.awt.Font font)
Sets the font to be selected.
Parameters:
font - the font to be selected
See Also:
getSelectedFont

setEffectSet

public void setEffectSet(java.lang.Object[] effects)
Sets the font effects which can be selected.
Parameters:
effects - the font effects
See Also:
getEffectSet()

getEffectSet

public java.lang.Object[] getEffectSet()
Returns the font effects which can be selected.
Returns:
the font effects
See Also:
setEffectSet(java.lang.Object[])

setSelectedEffects

public void setSelectedEffects(java.lang.Object[] selectedEffects)
Sets the selected font effects.
Parameters:
selectedEffects - the selected font effects
See Also:
getSelectedEffects()

getSelectedEffects

public java.lang.Object[] getSelectedEffects()
Returns the selected font effects.
Returns:
the selected font effects
See Also:
setSelectedEffects(java.lang.Object[])

setFontColor

public void setFontColor(java.awt.Color fontColor)
Sets the current font color.
Parameters:
fontColor - the current font color
See Also:
getFontColor()

getFontColor

public java.awt.Color getFontColor()
Returns the current font color.
Returns:
the current font color
See Also:
setFontColor(java.awt.Color)

setFontLocale

public void setFontLocale(java.util.Locale fontLocale)
Sets the current font locale.
Parameters:
fontLocale - the current font locale
See Also:
getFontLocale()

getFontLocale

public java.util.Locale getFontLocale()
Returns the current font locale.
Returns:
the current font localej
See Also:
setFontLocale(java.util.Locale)

showDialog

public int showDialog(java.awt.Component parent)
Pops up a dialog contains the JFontChooser and parented to parent with the dialog having a default title.
Parameters:
parent - the parent of the dialog
See Also:
showDialog(java.awt.Component)

showDialog

public int showDialog(java.awt.Component parent,
                      java.lang.String title)
Pops up a dialog contains the JFontChooser and parented to parent with the dialog having a title title.
Parameters:
parent - the parent of the dialog
title - the title for the dialog
See Also:
showDialog(java.awt.Component)

createDialog

protected javax.swing.JDialog createDialog(java.awt.Component parent,
                                           java.lang.String title,
                                           JFontChooser fontChooser,
                                           java.awt.event.ActionListener okListener,
                                           java.awt.event.ActionListener cancelListener)
Creates the dialog for the JFontChooser.
Parameters:
parent - the parent of the dialog

paramString

protected java.lang.String paramString()
Returns a string representation of this JFontChooser. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
Overrides:
paramString in class javax.swing.JComponent
Returns:
a string representation of this JFontChooser

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JFontChooser. For color choosers, the AccessibleContext takes the form of an AccessibleJFontChooser. A new AccessibleJFontChooser instance is created if necessary.
Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class javax.swing.JComponent
Returns:
an AccessibleJFontChooser that serves as the AccessibleContext of this JFontChooser


Copyright © 2001-2003 Extreme Component, Inc. All rights reserved.