Shared Flashcard Set

Details

Swing Components
Flash cards for remember swing components, their propertise and methos
35
Computer Science
Graduate
08/09/2012

Additional Computer Science Flashcards

 


 

Cards

Term
ButtonModel
Definition
defines methods for reading and writing a model's properties and for adding and removing various types of event listeners
Term
ButtonModel property: actionCommand
Definition

datatype: string

 

purpose: specifies the name property of the controller that should be sent to the ActionEvent. If none is specified, it takes the buttons text.

 

notes: this should be used if the buttons only have icons or several have the same name

Term
Button Model property: armed
Definition

datatype: boolean

 

purpose: indicates whether releasing on a button creates an action

 

note: will become false if the mouse arrow is out of focus of the component

Term
Button Model property: group
Definition

datatype: ButtonGroup

 

purpose: indicates whether which group the button belongs to if any

 

 

Term
Button Model property: selected
Definition

datatype: boolean

 

purpose: indicates whether the button is selected or not

 

notes: this only available underneath JToggleButton and its subclasses

 

Term
Buton Model Events: ActionEvent
Definition
The button is pressed.
Term
Buton Model Events: ChangeEvent
Definition
A change has occurred in one or more properties of the button model.
Term
Buton Model Events: ItemEvent
Definition
The button is toggled on or off.
Term

ButtonModel Methods

Hint: 6 Methods

Definition
public void addActionListener(ActionListener l)
public void removeActionListener(ActionListener l)
public void addItemListener(ItemListener l)
public void removeItemListener(ItemListener l)
public void addChangeListener(ChangeListener l)
public void removeChangeListener(ChangeListener l)
Term
DefaultButtonModel
Definition

Abstract Class that implements ButtonModel

 

note: This class is used directly by the AbstractButton class and indirectly by the other button classes.

Term
DefaultButtonModel property (not inherited from ButtonModel): selectedObjects
Definition

Abstract array of objects

 

note: returns selected objects and is mandated by the interface int implements ItemsSelectable

Term
DefaultButtonModel Events (not from ButtonModel interface):
Definition

public ActionListener[] getActionListeners( ) (added in SDK 1.3)

public ItemListener[] getItemListeners( ) (added in SDK 1.3)

public ChangeListener[] getChangeListeners( ) (added in SDK 1.3)

public EventListener[] getListeners(Class listenerType) (added in SDK 1.4)

Term
AbstractButtonClass
Definition

abstract base class for all button components (JButton, JToggleButton, JCheckBox, JRadioButton, and JMenuItem and its subclasses)

 

 

Term
AbstractButtonClass new Properties: action
Definition

datatype: Action

 

default value: null

 

note: Action received any form of ActionEvent

component configures its properties to match the action properties

component isntalls itself a propertyChangeListener on the action so its properties reflect the actions properties

 

 

Term
AbstractButtonClass new Properties: icon
Definition

datatype: Icon

 

purpose: to display a visual icon on the button

Term
AbstractButtonClass new Properties: disabledIcon
Definition

datatype: Icon

 

purpose: image to reflect that the button is disabled

 

note: will show grayscale of the regular registered icon if this is not defined

Term
AbstractButtonClass new Properties: selectedIcon
Definition

datatype: Icon

 

purpose: Icon to show that the button is selected

Term
AbstractButtonClass new Properties: disabledSelectedIcon
Definition

datatype: Icon

 

purpose: shows when the button state is selected and disabled

 

Term
AbstractButtonClass new Properties: pressedIcon
Definition

datatype: Icon

 

purpose: to show that the button is being pressed

 

Term
AbstractButtonClass new Properties: rolloverIcon
Definition

datatype: Icon

 

purpose: shows an image when the mouse cursor rolls over the button

Term
AbstractButtonClass new Properties: rolloverSelectedIcon
Definition

datatype: Icon

 

purpose: displays an image when the button is selected and is being rolled over

Term
AbstractButtonClass new Properties: model
Definition

datatype: ButtonModel

 

purpose: determinds the state of the button

Term

AbstractButton properties:

horizontalAlignment and verticalAlignment

Definition

datatype: int

 

purpose: specify where the button's content (text, icon, or both) should be drawn within the button's borders

 

note: significant only if the button is larger than button size

Term
AbstractButton properties: multiClickThreshold
Definition

datatype: long

 

prupose: a time threshold in miliseconds that determines the length of time of which multiclicks can be coalesced under one ActionEvent

Term
JButton class
Definition
Simplest of buttons and a minor extension of AbstractButton
Term
JButton Class inherits
Definition
AbstractButton
Term
JButton property: model
Definition

datatype: ButtonModel (returns implementation as DefaultButtonModel)

 

 

Term
JButton property: accessibleContext
Definition

datatype: AccessableContext

 

Assistive Technology support

Term
JButton property: defaultButton
Definition

datatype: boolean

 

purpose:indicates whether the button is activated by default when some event occurs within the JRootPane containing the button.

 

note: Typically, the event that would trigger the button would be an Enter key press, but this is actually up to the L&F implementation.

Term
JButton property: defaultCapable
Definition

datatype: boolean

 

purpose: indicates whether the JRootPane can set it as a default property

Term
JButton event: when clicked?
Definition

ActionEvent

 

note: sent after the button is released, and only if the button is still armed (meaning that the cursor is still over the button

Term
JToggleButton
Definition

is an extension of AbstractButton and is used to represent buttons that can be toggled on and off

Term
JToggleButton property: accessibleContent
Definition

datatype: AccessableContext

 

 

Term
JToggleButton property: model
Definition
datatype: ButtonModel (returns as ToggleButtonModel)
Supporting users have an ad free experience!