JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.swing
Class JCFontChooser

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.klg.jclass.util.swing.JCFontChooser
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
JCFontChooserBar, JCFontChooserPane

public abstract class JCFontChooser
extends JComponent

JCFontChooser is the base class for JCFontChooserBar and JCFontChooserPane. It provides common data and methods for both components.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int ALL
          The all styles support constant.
static int BOLD
          The bold style support constant.
static int ITALIC
          The italic style support constant.
static int NONE
          The no style support constant.
protected  Font oldFont
          Old font.
protected  boolean oldUnderline
           
static int UNDERLINE
          The underline style support constant.
 
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
JCFontChooser()
          Creates a font chooser with a default inital font.
JCFontChooser(Font font)
          Creates a font chooser with a specified initial font.
JCFontChooser(Font font, boolean underline)
          Creates a font chooser with a specified initial font and underline.
JCFontChooser(String name, int style, int size, boolean underline)
          Creates a font chooser with a specified initial font and underline.
 
Method Summary
 void addJCFontListener(com.klg.jclass.util.swing.JCFontListener listener)
          Adds the specified listener to receive JCFontEvent objects.
protected  void fireJCFontChangedEvent(com.klg.jclass.util.swing.JCFontEvent event)
          Notifies registered listeners of a fontChanged JCFontEvent.
protected  void fireJCFontChangingEvent(com.klg.jclass.util.swing.JCFontEvent event)
          Notifies registered listeners of a fontChanging JCFontEvent.
protected  String getFontName()
          Returns the font name.
protected  int getFontSize()
          Returns the font size.
 String[] getNameList()
          Gets the font name list.
 Font getSelectedFont()
          Gets the selected font.
protected static String[] getSizeList()
          Gets the font size list.
protected  boolean isBold()
          Returns the bold indication.
protected  boolean isItalic()
          Returns the italic indication.
 boolean isUnderline()
          Returns the underline indication.
static boolean isUnderline(Font font)
          Gets the underline text attribute for a given font.
 void removeJCFontListener(com.klg.jclass.util.swing.JCFontListener listener)
          Removes the specified listener so it no longer receive JCFontEvent objects.
protected  void setBold(boolean bold)
          Sets the bold indication.
protected  void setFontName(String name)
          Sets the font name.
protected  void setFontSize(int size)
          Sets the font size.
protected  void setFontValues(Font font, boolean underline)
          Sets the font values.
protected  void setFontValues(String name, int style, int size, boolean underline)
          Sets the font values.
protected  void setItalic(boolean italic)
          Sets the italic indication.
protected  void setNameList()
          Sets the font name list.
protected  void setNameList(String[] nameList)
          Sets the font name list.
protected  void setOldFont()
          Sets the old font.
protected  void setSelectedFont(Font font)
          Sets the selected font.
protected  void setSelectedFont(Font font, boolean underline)
          Sets the selected font.
protected  void setSelectedFont(String name, int style, int size, boolean underline)
          Sets the selected font.
protected  void setUnderline(boolean underline)
          Sets the underline indication.
static Font setUnderline(Font font, boolean underline)
          Sets the underline text attribute for a given font.
 
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, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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

oldFont

protected Font oldFont
Old font.


oldUnderline

protected boolean oldUnderline

NONE

public static final int NONE
The no style support constant.

See Also:
Constant Field Values

BOLD

public static final int BOLD
The bold style support constant.

See Also:
Constant Field Values

ITALIC

public static final int ITALIC
The italic style support constant.

See Also:
Constant Field Values

UNDERLINE

public static final int UNDERLINE
The underline style support constant.

See Also:
Constant Field Values

ALL

public static final int ALL
The all styles support constant.

See Also:
Constant Field Values
Constructor Detail

JCFontChooser

public JCFontChooser()
Creates a font chooser with a default inital font.


JCFontChooser

public JCFontChooser(Font font)
Creates a font chooser with a specified initial font.

Parameters:
font - the initial font

JCFontChooser

public JCFontChooser(Font font,
                     boolean underline)
Creates a font chooser with a specified initial font and underline.

Parameters:
font - the initial font
underline - true if underline is on

JCFontChooser

public JCFontChooser(String name,
                     int style,
                     int size,
                     boolean underline)
Creates a font chooser with a specified initial font and underline.

Parameters:
name - the font name
style - the style constant for the font
size - the point size of the font
underline - true if underline is on
Method Detail

setFontValues

protected void setFontValues(String name,
                             int style,
                             int size,
                             boolean underline)
Sets the font values.

Parameters:
name - the font name
style - the style constant for the font
size - the point size of the font
underline - true if underline is on

setFontValues

protected void setFontValues(Font font,
                             boolean underline)
Sets the font values.

Parameters:
font - the selected font
underline - true if underline is on

setSelectedFont

protected void setSelectedFont(String name,
                               int style,
                               int size,
                               boolean underline)
Sets the selected font.

Parameters:
name - the font name
style - the style constant for the font
size - the point size of the font
underline - true if underline is on

setSelectedFont

protected void setSelectedFont(Font font,
                               boolean underline)
Sets the selected font.

Parameters:
font - the selected font
underline - true if underline is on

setSelectedFont

protected void setSelectedFont(Font font)
Sets the selected font.

Parameters:
font - the selected font

getSelectedFont

public Font getSelectedFont()
Gets the selected font.

Returns:
the current selected font

setFontName

protected void setFontName(String name)
Sets the font name.

Parameters:
name - the font name

getFontName

protected String getFontName()
Returns the font name.

Returns:
the font name

setFontSize

protected void setFontSize(int size)
Sets the font size.

Parameters:
size - the point size of the font

getFontSize

protected int getFontSize()
Returns the font size.

Returns:
the font size

setBold

protected void setBold(boolean bold)
Sets the bold indication.

Parameters:
bold - true if bold is on

isBold

protected boolean isBold()
Returns the bold indication.

Returns:
true if bold is on

setItalic

protected void setItalic(boolean italic)
Sets the italic indication.

Parameters:
italic - true if underline is on

isItalic

protected boolean isItalic()
Returns the italic indication.

Returns:
true if italic is on

setUnderline

protected void setUnderline(boolean underline)
Sets the underline indication.

Parameters:
underline - true if underline is on

isUnderline

public boolean isUnderline()
Returns the underline indication.

Returns:
true if underline is on

setNameList

protected void setNameList()
Sets the font name list.


setNameList

protected void setNameList(String[] nameList)
Sets the font name list.

Parameters:
nameList - array of font names

getNameList

public String[] getNameList()
Gets the font name list.

Returns:
font name list

getSizeList

protected static String[] getSizeList()
Gets the font size list.

Returns:
font size list

addJCFontListener

public void addJCFontListener(com.klg.jclass.util.swing.JCFontListener listener)
Adds the specified listener to receive JCFontEvent objects.

Parameters:
listener - a listener

removeJCFontListener

public void removeJCFontListener(com.klg.jclass.util.swing.JCFontListener listener)
Removes the specified listener so it no longer receive JCFontEvent objects.

Parameters:
listener - a listener

fireJCFontChangingEvent

protected void fireJCFontChangingEvent(com.klg.jclass.util.swing.JCFontEvent event)
Notifies registered listeners of a fontChanging JCFontEvent.

Parameters:
event - the JCFontEvent

fireJCFontChangedEvent

protected void fireJCFontChangedEvent(com.klg.jclass.util.swing.JCFontEvent event)
Notifies registered listeners of a fontChanged JCFontEvent.

Parameters:
event - the JCFontEvent

setOldFont

protected void setOldFont()
Sets the old font.


setUnderline

public static Font setUnderline(Font font,
                                boolean underline)
Sets the underline text attribute for a given font.

Parameters:
font - the initial font
underline - the underline indication
Returns:
the new font with the indicated underline text attribute

isUnderline

public static boolean isUnderline(Font font)
Gets the underline text attribute for a given font.

Parameters:
font - the initial font
Returns:
true if underline is on; otherwise, false

Copyright © 2004 Quest Software Inc..
All rights reserved.