|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
org.havi.ui.HComponent
org.havi.ui.HVisible
org.havi.ui.HStaticIcon
org.havi.ui.HIcon
org.havi.ui.HGraphicButton
public class HGraphicButton
The HGraphicButton
is a user interface
component representing a push-button with static read-only graphical
content. This component can be navigated to, i.e. it can have the input
focus, and it can also be actioned as defined by the HActionable
interface.
By default it uses the HGraphicLook
class to
render itself.
Parameter | Description | Default value | Set method | Get method |
---|---|---|---|---|
x | x-coordinate of top left hand corner of this component in pixels, relative to its parent container (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds |
y | y-coordinate of top left hand corner of this component in pixels, relative to its parent container (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds |
width | width of this component in pixels (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds |
height | height of this component in pixels (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds |
image | The image to be used as the content for every state of this component. | null | setGraphicContent |
getGraphicContent |
imageNormal | The image to be used as the content for the HState.NORMAL_STATE state of
this component. |
null | setGraphicContent |
getGraphicContent |
imageFocused | The image to be used as the content for the
HState.FOCUSED_STATE and
HState.DISABLED_FOCUSED_STATE states of this component. |
null | setGraphicContent |
getGraphicContent |
imageActioned | The image to be used as the content for the
HState.ACTIONED_STATE and
HState.ACTIONED_FOCUSED_STATE states of this component. |
null | setGraphicContent |
getGraphicContent |
HStaticIcon
,
HIcon
,
HNavigable
,
HActionable
,
Serialized FormField Summary |
---|
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface org.havi.ui.HState |
---|
ACTIONED_FOCUSED_STATE, ACTIONED_STATE, ACTIONED_STATE_BIT, ALL_STATES, DISABLED_ACTIONED_FOCUSED_STATE, DISABLED_ACTIONED_STATE, DISABLED_FOCUSED_STATE, DISABLED_STATE, DISABLED_STATE_BIT, FIRST_STATE, FOCUSED_STATE, FOCUSED_STATE_BIT, LAST_STATE, NORMAL_STATE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
HGraphicButton()
Creates an HGraphicButton
object. |
|
HGraphicButton(java.awt.Image image)
Creates an HGraphicButton
object. |
|
HGraphicButton(java.awt.Image imageNormal,
java.awt.Image imageFocused,
java.awt.Image imageActioned)
Creates an HGraphicButton
object. |
|
HGraphicButton(java.awt.Image imageNormal,
java.awt.Image imageFocused,
java.awt.Image imageActioned,
int x,
int y,
int width,
int height)
Creates an HGraphicButton
object. |
|
HGraphicButton(java.awt.Image image,
int x,
int y,
int width,
int height)
Creates an HGraphicButton
object. |
Method Summary | |
---|---|
void |
addHActionListener(HActionListener l)
Adds the specified HActionListener to receive HActionEvent
events sent from this HGraphicButton. |
void |
addHFocusListener(HFocusListener l)
Adds the specified HFocusListener to
receive HFocusEvent events sent from
this HNavigable : If the listener has
already been added further calls will add further references to the listener,
which will then receive multiple copies of a single event. |
java.lang.String |
getActionCommand()
Gets the command name for the HActionEvent
event fired by this HGraphicButton. |
HSound |
getActionSound()
Return the last action sound set by the setActionSound() method
or null if no action sound has been set. |
static HGraphicLook |
getDefaultLook()
Returns the currently set default HLook for HGraphicButton
components. |
HSound |
getGainFocusSound()
Get the sound associated with the gain focus event. |
HSound |
getLoseFocusSound()
Get the sound associated with the lost focus event. |
HNavigable |
getMove(int keyCode)
Provides the HNavigable object
that is navigated to when a particular key is pressed. |
int[] |
getNavigationKeys()
Retrieve the set of key codes which this component maps to navigation targets. |
boolean |
isSelected()
Indicates if this component has focus. |
void |
processHActionEvent(HActionEvent evt)
Process an HActionEvent sent to this HGraphicButton. |
void |
processHFocusEvent(HFocusEvent evt)
Process an HFocusEvent sent to this HGraphicButton . |
void |
removeHActionListener(HActionListener l)
Removes the specified HActionListener so that it no longer receives
HActionEvent events from this
HGraphicButton. |
void |
removeHFocusListener(HFocusListener l)
Removes the specified HFocusListener
so that it no longer receives HFocusEvent events from this HNavigable . |
void |
setActionCommand(java.lang.String command)
Sets the command name for the HActionEvent event fired by this HGraphicButton. |
void |
setActionSound(HSound sound)
Associate a sound to be played when the interaction state of the HGraphicButton makes the following transitions: |
static void |
setDefaultLook(HGraphicLook hlook)
Sets the default HLook for further
HGraphicButton components. |
void |
setFocusTraversal(HNavigable up,
HNavigable down,
HNavigable left,
HNavigable right)
Set the focus control for an HNavigable component. |
void |
setGainFocusSound(HSound sound)
Associate a sound with gaining focus, i.e. |
void |
setLoseFocusSound(HSound sound)
Associate a sound with losing focus, i.e. |
void |
setMove(int keyCode,
HNavigable target)
Defines the navigation path from the current HNavigable to another HNavigable when a particular key is
pressed. |
Methods inherited from class org.havi.ui.HStaticIcon |
---|
setLook |
Methods inherited from class org.havi.ui.HComponent |
---|
getMatte, isDoubleBuffered, isEnabled, setMatte |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HGraphicButton()
HGraphicButton
object. See the class description for details of constructor
parameters and default values. For constructors which specify
content as parameters, see 'State-based content' in HVisible
for unspecified content associated with other HStates.
public HGraphicButton(java.awt.Image image, int x, int y, int width, int height)
HGraphicButton
object. See the class description for details of constructor
parameters and default values. For constructors which specify
content as parameters, see 'State-based content' in HVisible
for unspecified content associated with other HStates.
public HGraphicButton(java.awt.Image imageNormal, java.awt.Image imageFocused, java.awt.Image imageActioned, int x, int y, int width, int height)
HGraphicButton
object. See the class description for details of constructor
parameters and default values. For constructors which specify
content as parameters, see 'State-based content' in HVisible
for unspecified content associated with other HStates.
public HGraphicButton(java.awt.Image image)
HGraphicButton
object. See the class description for details of constructor
parameters and default values. For constructors which specify
content as parameters, see 'State-based content' in HVisible
for unspecified content associated with other HStates.
public HGraphicButton(java.awt.Image imageNormal, java.awt.Image imageFocused, java.awt.Image imageActioned)
HGraphicButton
object. See the class description for details of constructor
parameters and default values. For constructors which specify
content as parameters, see 'State-based content' in HVisible
for unspecified content associated with other HStates.
Method Detail |
---|
public static void setDefaultLook(HGraphicLook hlook)
HLook
for further
HGraphicButton
components.
hlook
- The HLook
that will be
used by default when creating a new HGraphicButton
component.
Note that this parameter may be null, in which case newly
created components shall not draw themselves until a non-null
look is set using the setLook
method.public static HGraphicLook getDefaultLook()
HLook
for HGraphicButton
components.
HLook
that is used by
default when creating a new HGraphicButton
.public void setMove(int keyCode, HNavigable target)
HNavigable
to another HNavigable
when a particular key is
pressed. Note that setFocusTraversal
is
equivalent to multiple calls to setMove
, where the key codes
VK_UP
, VK_DOWN
, VK_LEFT
,
VK_RIGHT
are used.
setMove
in interface HNavigable
setMove
in class HIcon
keyCode
- The key code of the pressed key. Any numerical
keycode is allowed, but the platform may not be able to
generate all keycodes. Application authors should only use keys
for which HRcCapabilities.isSupported()
or
HKeyCapabilities.isSupported()
returns true.target
- The target HNavigable
object that should be navigated to. If a target is
to be removed from a particular navigation path, then
null
shall be specified.public HNavigable getMove(int keyCode)
HNavigable
object
that is navigated to when a particular key is pressed.
getMove
in interface HNavigable
getMove
in class HIcon
keyCode
- The key code of the pressed key.
HNavigable
object or null
if no HNavigable
is associated with the keyCode.public void setFocusTraversal(HNavigable up, HNavigable down, HNavigable left, HNavigable right)
HNavigable
component. Note setFocusTraversal
is a
convenience function for application programmers where a standard
up, down, left and right focus traversal between components is
required.
Note setFocusTraversal
is equivalent to multiple calls to setMove
, where the key codes
VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT are used.
Note that this
API does not prevent the creation of "isolated"
HNavigable
components --- authors
should endeavor to avoid confusing the user.
setFocusTraversal
in interface HNavigable
setFocusTraversal
in class HIcon
up
- The HNavigable
component
to move to, when the user generates a VK_UP KeyEvent. If there is no HNavigable
component to move
"up" to, then null shall be specified.down
- The HNavigable
component to move to, when the user generates a VK_DOWN KeyEvent. If there
is no HNavigable
component to move
"down" to, then null shall be specified.left
- The HNavigable
component to move to, when the user generates a VK_LEFT KeyEvent. If there
is no HNavigable
component to move
"left" to, then null shall be specified.right
- The HNavigable
component to move to, when the user generates a VK_RIGHT KeyEvent. If there
is no HNavigable
component to move
"right" to, then null shall be specified.public boolean isSelected()
isSelected
in interface HNavigable
isSelected
in class HIcon
true
if the component has focus, otherwise
returns false
.public void setGainFocusSound(HSound sound)
HNavigable
receives a
HFocusEvent
event of type
FOCUS_GAINED
. This sound will start to be played
when an object implementing this interface gains focus. It is
not guaranteed to be played to completion. If the object
implementing this interface loses focus before the audio
completes playing, the audio will be truncated. Applications
wishing to ensure the audio is always played to completion must
implement special logic to slow down the focus transitions.
By default, an HNavigable
object
does not have any gain focus sound associated with it.
Note that the ordering of playing sounds is dependent on the order of the focus lost, gained events.
setGainFocusSound
in interface HNavigable
setGainFocusSound
in class HIcon
sound
- the sound to be played, when the component gains
focus. If sound content is already set, the original content is
replaced. To remove the sound specify a null HSound
.public void setLoseFocusSound(HSound sound)
HNavigable
receives a
HFocusEvent
event of type
FOCUS_LOST. This sound will start to be played when an object
implementing this interface loses focus. It is not guaranteed to be
played to completion. It is implementation dependent whether and when
this sound will be truncated by any gain focus sound played by the next
object to gain focus. By default, an HNavigable
object does not have any
lose focus sound associated with it.
Note that the ordering of playing sounds is dependent on the order of the focus lost, gained events.
setLoseFocusSound
in interface HNavigable
setLoseFocusSound
in class HIcon
sound
- the sound to be played, when the component loses
focus. If sound content is already set, the original content is
replaced. To remove the sound specify a null HSound
.public HSound getGainFocusSound()
getGainFocusSound
in interface HNavigable
getGainFocusSound
in class HIcon
public HSound getLoseFocusSound()
getLoseFocusSound
in interface HNavigable
getLoseFocusSound
in class HIcon
public void addHFocusListener(HFocusListener l)
HFocusListener
to
receive HFocusEvent
events sent from
this HNavigable
: If the listener has
already been added further calls will add further references to the listener,
which will then receive multiple copies of a single event.
addHFocusListener
in interface HNavigable
addHFocusListener
in class HIcon
l
- the HFocusListener to addpublic void removeHFocusListener(HFocusListener l)
HFocusListener
so that it no longer receives HFocusEvent
events from this HNavigable
. If
the specified listener is not registered, the method has no effect. If
multiple references to a single listener have been registered it should be
noted that this method will only remove one reference per call.
removeHFocusListener
in interface HNavigable
removeHFocusListener
in class HIcon
l
- the HFocusListener to removepublic int[] getNavigationKeys()
getNavigationKeys
in interface HNavigationInputPreferred
getNavigationKeys
in class HIcon
null
if no
navigation targets are set on this component.public void processHFocusEvent(HFocusEvent evt)
HFocusEvent
sent to this HGraphicButton
.
processHFocusEvent
in interface HNavigationInputPreferred
processHFocusEvent
in class HIcon
evt
- the HFocusEvent
to process.public void addHActionListener(HActionListener l)
HActionListener
to receive HActionEvent
events sent from this HGraphicButton. If the listener has
already been added further calls will add further references to
the listener, which will then receive multiple copies of a
single event.
addHActionListener
in interface HActionable
l
- the HActionListener.public void removeHActionListener(HActionListener l)
HActionListener
so that it no longer receives
HActionEvent
events from this
HGraphicButton. If the specified
listener is not registered, the method has no effect. If
multiple references to a single listener have been registered
it should be noted that this method will only remove one
reference per call.
removeHActionListener
in interface HActionable
l
- the HActionListener.public void setActionCommand(java.lang.String command)
HActionEvent
event fired by this HGraphicButton.
setActionCommand
in interface HActionable
command
- a String
used to set the action
command. To remove the command specify a null command parameter.HActionEvent.getActionCommand()
public void setActionSound(HSound sound)
setActionSound
in interface HActionable
sound
- the sound to be played, when the component is
actioned. If sound content is already set, the original content
is replaced. To remove the sound specify a null
HSound
.public HSound getActionSound()
setActionSound()
method
or null
if no action sound has been set.
getActionSound
in interface HActionable
public void processHActionEvent(HActionEvent evt)
HActionEvent
sent to this HGraphicButton.
processHActionEvent
in interface HActionInputPreferred
evt
- the HActionEvent
to process.public java.lang.String getActionCommand()
HActionEvent
event fired by this HGraphicButton. If this HGraphicButton
has no action command then an empty string shall be returned.
getActionCommand
in interface HActionInputPreferred
String
representing the command name of the
HActionEvent fired by this HGraphicButton.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |