public class LineStyleSelector extends javax.swing.JComponent implements javax.swing.event.ListSelectionListener, javax.swing.event.ChangeListener, java.awt.event.ItemListener, java.awt.event.AdjustmentListener, ResourceComponentFactoryable
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected static java.util.Vector |
basicLineStyle |
protected static int |
maxLineStyle
The staic routine initialize the linestyle dash arrays.
|
static java.lang.String |
SELECTEDLINESTYLE_PROPERTY
Property Name for the selected linestyle.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
LineStyleSelector()
The constructor.
|
LineStyleSelector(PenStroke initial,
java.util.Vector pStrokes,
PropertyBundle resources,
java.lang.String keySuffix,
boolean noBorder)
The constructor receive the initial font.
|
Modifier and Type | Method and Description |
---|---|
void |
addMenuItem(java.lang.String itemKey,
javax.swing.JMenuItem menuItem)
Register a menu item and its actions keyword.
|
void |
addNotify() |
void |
adjustmentValueChanged(java.awt.event.AdjustmentEvent e) |
java.beans.PropertyChangeListener |
createActionChangeListener(javax.swing.JMenuItem menuItem)
Creates an action changed listener that implements PropertyChangeListener
|
static javax.swing.JDialog |
createDialog(java.awt.Component c,
PropertyBundle resources,
boolean modal,
LineStyleSelector dialogPane,
java.awt.event.ActionListener okListener,
java.awt.event.ActionListener cancelListener)
Creates and returns a new dialog containing the specified
ColorChooser pane along with "OK", "Cancel", and "Reset" buttons.
|
javax.swing.Action |
getAction(java.lang.String cmdKey)
Returns the menu item belongs the given keyword.
|
PenStroke |
getInitialStroke()
Get the inital stroke.
|
static java.util.Vector |
getLineStyleVector()
Return a vector containing the basic line style objects of type
PenStroke . |
static int |
getMaxStrokeIndex()
Returns the maximal line style index of the internal vector of linestyles.
|
java.lang.String |
getResource(PropertyBundle resources,
java.lang.String key) |
PenStroke |
getSelectedStroke()
Get the selected stroke.
|
static PenStroke |
getStrokeAt(int index)
Returns the index into the basic line style vector for the given stroke.
|
static int |
getStrokeIndex(PenStroke initialStroke)
Returns the index into the basic line style vector for the given stroke.
|
void |
itemStateChanged(java.awt.event.ItemEvent e) |
void |
resetLineStyle()
Reset linestyle.
|
void |
setSelectedStroke(PenStroke sel)
Set the selected font.
|
static PenStroke |
showDialog(java.awt.Component component,
PenStroke initialStyle,
java.util.Vector penStrokes,
PropertyBundle resources,
java.lang.String propertySuffix,
boolean noBorder)
Shows a modal linestyle selector dialog and blocks until the
dialog is hidden.
|
void |
stateChanged(javax.swing.event.ChangeEvent e) |
java.lang.String |
toString()
Return the string representation of the selected font.
|
void |
valueChanged(javax.swing.event.ListSelectionEvent e) |
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String SELECTEDLINESTYLE_PROPERTY
protected static final int maxLineStyle
protected static final java.util.Vector basicLineStyle
public LineStyleSelector()
public LineStyleSelector(PenStroke initial, java.util.Vector pStrokes, PropertyBundle resources, java.lang.String keySuffix, boolean noBorder)
public static PenStroke showDialog(java.awt.Component component, PenStroke initialStyle, java.util.Vector penStrokes, PropertyBundle resources, java.lang.String propertySuffix, boolean noBorder)
PenStroke
.
If the user presses the "Cancel" button or closes the dialog without
pressing "OK", then this method disposes the dialog and returns null.component
- the parent Component for the dialoginitialStyle
- the initial penstroke when the selector is shownpenStrokes
- The vector conatins the available PenStrokes.resources
- the resource component factory to configure the selector.propertySuffix
- the key suffix that should be used to find properties.public static javax.swing.JDialog createDialog(java.awt.Component c, PropertyBundle resources, boolean modal, LineStyleSelector dialogPane, java.awt.event.ActionListener okListener, java.awt.event.ActionListener cancelListener)
c
- the parent component for the dialogresources
- the resource component factory to configure the selector.modal
- a boolean. When true, the remainder of the program
is inactive until the dialog is closed.chooserPane
- the color-chooser to be placed inside the dialogokListener
- the ActionListener invoked when "OK" is pressedcancelListener
- the ActionListener invoked when "Cancel" is pressedpublic static int getMaxStrokeIndex()
getLineStyleVector()
public static int getStrokeIndex(PenStroke initialStroke)
public static PenStroke getStrokeAt(int index)
public static java.util.Vector getLineStyleVector()
PenStroke
.Vector
.public void addNotify()
addNotify
in class javax.swing.JComponent
public void resetLineStyle()
public java.lang.String getResource(PropertyBundle resources, java.lang.String key)
public void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
adjustmentValueChanged
in interface java.awt.event.AdjustmentListener
public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged
in interface java.awt.event.ItemListener
public void valueChanged(javax.swing.event.ListSelectionEvent e)
valueChanged
in interface javax.swing.event.ListSelectionListener
public java.lang.String toString()
toString
in class java.awt.Component
public PenStroke getSelectedStroke()
public void setSelectedStroke(PenStroke sel)
PenStroke
- The new selected stroke.public PenStroke getInitialStroke()
public void addMenuItem(java.lang.String itemKey, javax.swing.JMenuItem menuItem)
addMenuItem
in interface ResourceComponentFactoryable
public javax.swing.Action getAction(java.lang.String cmdKey)
getAction
in interface ResourceComponentFactoryable
public java.beans.PropertyChangeListener createActionChangeListener(javax.swing.JMenuItem menuItem)
createActionChangeListener
in interface ResourceComponentFactoryable