|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--com.klg.jclass.util.swing.AbstractSpinBox | +--com.klg.jclass.util.swing.JCSpinBox
A spinbox component. This spin box will display a list of objects. The renderer and editor can be replaced to display the and edit the objects in any form. The default editor and renderer is designed to work with Strings.
Nested Class Summary | |
static interface |
JCSpinBox.KeySelectionManager
The interface that defines a KeySelectionManager . |
Nested classes inherited from class com.klg.jclass.util.swing.AbstractSpinBox |
AbstractSpinBox.ArrowButton, AbstractSpinBox.MetalArrowButton, AbstractSpinBox.MetalBorder |
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 | |
protected String |
actionCommand
|
protected com.klg.jclass.util.JCListenerList |
actionListeners
|
protected boolean |
firstPaint
|
protected com.klg.jclass.util.JCListenerList |
itemListeners
|
protected JCSpinBox.KeySelectionManager |
keySelectionManager
|
protected Object |
lastSelectedItem
|
protected ListDataListener |
listDataListener
|
protected com.klg.jclass.util.swing.JCSpinBoxModel |
model
|
protected boolean |
modelChanging
|
Fields inherited from class com.klg.jclass.util.swing.AbstractSpinBox |
arrowKeySpinningAllowed, buttonTimer, continuousScroll, currentButton, DECREMENT, downArrow, editable, editor, editorIsValidateRoot, INCREMENT, l, metalBorder, minimumHeight, NONE, renderer, renderPanel, rl, upArrow, userFont, valueListeners, valueModel |
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 | |
JCSpinBox()
Creates a JCSpinBox with a default data model. |
|
JCSpinBox(com.klg.jclass.util.swing.JCSpinBoxModel aModel)
Creates a JCSpinBox that takes its items from an existing
JCSpinBoxModel . |
|
JCSpinBox(Object[] items)
Creates a JCSpinBox that contains the elements in the specified
array. |
|
JCSpinBox(Vector items)
Creates a JCSpinBox that contains the elements in the specified
Vector . |
Method Summary | |
void |
addActionListener(ActionListener l)
Adds an ActionListener . |
void |
addItem(Object o)
Adds an item to the item list. |
void |
addItemListener(ItemListener l)
Adds a java.awt.event.ItemListener . |
protected void |
checkArrowButtons()
Disables the arrow buttons if the end of the range is reached. |
protected void |
checkSpinBoxMutableModel()
Checks if the current model is mutable. |
String |
getAbout()
Returns vendor information. |
String |
getActionCommand()
Returns the action command that is included in the event sent to action listeners. |
Object |
getItemAt(int index)
Returns the list item at the specified index. |
int |
getItemCount()
Returns the number of items in the list. |
JCSpinBox.KeySelectionManager |
getKeySelectionManager()
Returns the list's key-selection manager. |
com.klg.jclass.util.swing.JCSpinBoxModel |
getModel()
Returns the data model currently used by the JCSpinBox . |
int |
getSelectedIndex()
Returns the index of the currently selected item in the list. |
Object |
getSelectedItem()
Returns the currently selected item. |
Object[] |
getSelectedObjects()
Returns an array containing the selected item. |
protected void |
handleKeyPressed(KeyEvent e)
Overridden in JCSpinBox to add keySelectionManager
functionality. |
void |
insertItemAt(Object o,
int index)
Inserts an item into the item list at a given index. |
protected void |
modelChanged()
This method is invoked by listeners on the data model when the model changes. |
void |
paint(Graphics g)
Paints the spinbox. |
protected int |
preferredWidthOfView()
Overrides preferred width to make sure the width is big enough for the formatted max and min values. |
protected void |
processValueChanged(com.klg.jclass.util.value.JCValueEvent event)
This method can be overridded by the subclass |
void |
removeActionListener(ActionListener l)
Removes an ActionListener . |
void |
removeAllItems()
Removes all items from the item list. |
void |
removeItem(Object o)
Removes an item from the item list. |
void |
removeItemAt(int anIndex)
Removes the item at anIndex
This method works only if the JCSpinBox model implements
JCSpinBoxMutableModel . |
void |
removeItemListener(ItemListener l)
Removes an ItemListener . |
boolean |
selectWithKeyChar(char keyChar)
Selects the list item that correponds to the specified keyboard character and returns true if there is an item corresponding to that
character. |
void |
setAbout(String s)
Provided for Beans property editors - has no effect. |
void |
setActionCommand(String aCommand)
Sets the action command that should be included in the event sent to action listeners. |
void |
setKeySelectionManager(JCSpinBox.KeySelectionManager aManager)
Sets the object that translates a keyboard character into a list selection. |
void |
setModel(com.klg.jclass.util.swing.JCSpinBoxModel aModel)
Sets the data model that the JCSpinBox uses to obtain the list
of items. |
void |
setSelectedIndex(int index)
Selects the item at index index . |
void |
setSelectedItem(Object item)
Sets the selected item in the JCSpinBox by specifying the object
in the list. |
protected Object |
spinDown()
Returns the new value generated when spinning down a notch. |
protected Object |
spinUp()
Returns the new value generated when spinning up a notch. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected com.klg.jclass.util.swing.JCSpinBoxModel model
protected com.klg.jclass.util.JCListenerList itemListeners
protected com.klg.jclass.util.JCListenerList actionListeners
protected String actionCommand
protected ListDataListener listDataListener
protected boolean modelChanging
protected JCSpinBox.KeySelectionManager keySelectionManager
protected Object lastSelectedItem
protected boolean firstPaint
Constructor Detail |
public JCSpinBox(com.klg.jclass.util.swing.JCSpinBoxModel aModel)
JCSpinBox
that takes its items from an existing
JCSpinBoxModel
.
aModel
- the SpinBoxModel
that provides the displayed list
of itemspublic JCSpinBox(Object[] items)
JCSpinBox
that contains the elements in the specified
array.
items
- public JCSpinBox(Vector items)
JCSpinBox
that contains the elements in the specified
Vector
.
items
- com.sun.java.util.collections.Vector
.public JCSpinBox()
JCSpinBox
with a default data model.
The default data model is an empty list of objects.
Use addItem
to add items.
Method Detail |
public void paint(Graphics g)
paint
in class AbstractSpinBox
g
- protected Object spinUp()
spinUp
in class AbstractSpinBox
protected Object spinDown()
spinDown
in class AbstractSpinBox
public Object[] getSelectedObjects()
ItemSelectable
.
getSelectedObjects
in interface ItemSelectable
protected void processValueChanged(com.klg.jclass.util.value.JCValueEvent event)
AbstractSpinBox
processValueChanged
in class AbstractSpinBox
protected void checkArrowButtons()
checkArrowButtons
in class AbstractSpinBox
AbstractSpinBox.setArrowEnabled(javax.swing.JButton, boolean)
public void setAbout(String s)
s
- public String getAbout()
public void setModel(com.klg.jclass.util.swing.JCSpinBoxModel aModel)
JCSpinBox
uses to obtain the list
of items.
aModel
- the JCSpinBoxModel
that provides the displayed
list of itemspublic com.klg.jclass.util.swing.JCSpinBoxModel getModel()
JCSpinBox
.
JCSpinBoxModel
that provides the displayed list of
itemspublic Object getItemAt(int index)
index
- an int indicating the list position, where the first
item starts at zero
public int getItemCount()
public void setKeySelectionManager(JCSpinBox.KeySelectionManager aManager)
aManager
- public JCSpinBox.KeySelectionManager getKeySelectionManager()
KeySelectionManager
currently in usepublic boolean selectWithKeyChar(char keyChar)
true
if there is an item corresponding to that
character.
keyChar
- a char, typically this is a keyboard key typed by the user
public void setSelectedIndex(int index)
index
.
index
- an int specifying the list item to select, where 0 specifies
the first item in the listpublic int getSelectedIndex()
JCSpinBox
box allows selected
items that are not in the list.
public void setSelectedItem(Object item)
JCSpinBox
by specifying the object
in the list. If item
is in the list, the list displays with
item
selected. If the object does not exist in the list,
the default data model selects the first item in the list.
item
- the list object to selectpublic Object getSelectedItem()
public void insertItemAt(Object o, int index)
JCSpinBox
uses a data model that
implements JCMutableSpinBoxModel
.
o
- the Object to add to the listindex
- an int specifying the position at which to add the itempublic void addItem(Object o)
JComboBox
uses a
JCSpinBoxMutableModel
.
o
- the Object to add to the listpublic void removeItem(Object o)
JCSpinBox
uses a model that
implements JCSpinBoxMutableModel
.
JCSpinBox
uses the default data model when created with the
empty constructor and no other model has been set.
o
- the object to remove from the item listpublic void removeItemAt(int anIndex)
anIndex
This method works only if the JCSpinBox
model implements
JCSpinBoxMutableModel
.
anIndex
- an int specifying the idex of the item to remove, where 0
indicates the first item in the listpublic void removeAllItems()
JCSpinBox
model implements
JCSpinBoxMutableModel
.
public void addItemListener(ItemListener l)
java.awt.event.ItemListener
. aListener
will
receive an event when the selected item changes.
addItemListener
in interface ItemSelectable
l
- the ItemListener
that is to be notifiedpublic void removeItemListener(ItemListener l)
ItemListener
.
removeItemListener
in interface ItemSelectable
l
- the ItemListener
to removepublic void addActionListener(ActionListener l)
ActionListener
.
l
- the actionListener
that is to be notifiedpublic void removeActionListener(ActionListener l)
ActionListener
.
l
- the ActionListener
to removepublic void setActionCommand(String aCommand)
aCommand
- A String containing the "command" that is sent
to action listeners. The same listener can then
do different things depending on the command it
receives.public String getActionCommand()
protected int preferredWidthOfView()
preferredWidthOfView
in class AbstractSpinBox
protected void checkSpinBoxMutableModel()
protected void modelChanged()
protected void handleKeyPressed(KeyEvent e)
JCSpinBox
to add keySelectionManager
functionality.
handleKeyPressed
in class AbstractSpinBox
e
-
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |