public class HScene extends Container implements HComponentOrdering
HScene is a container representing
the displayable area on-screen within which the application can
display itself and thus interact with the user.
HScene may be
regarded as a simple connection to the window management policy
within the device, acting as a "screen resource reservation
mechanism" denoting the area within which an application may
present components.
HScene does not paint itself
on-screen, only its added "child" components and hence
its only immediate graphical effect is to "clip" its
child components. However, it is possible to request that the
entire HScene be painted in the current
background color before any drawing takes place, and/or that
a background image be drawn before the children are rendered.
An application which sets both of setBackgroundMode(NO_BACKGROUND_FILL) and setImageMode(IMAGE_NONE) shall be responsible for ensuring that all pixels in the HScene are filled with a value which is either opaque or transparent only to video. Such an application cannot make any assumptions about the previous contents of the graphics objects into which it is drawing. For implementations which double-buffer the display of graphics, these existing contents are implementation dependent.
HScene is considered the top-level component of the
application. No parent component to an HScene should be accessible to applications. Interoperable
applications should not use the getParent method in HScene, since results are implementation
dependent and valid implementations may generate a run-time error.
Although HScene is a subclass of
java.awt.Container, implementations are allowed to
insert extra classes in the inheritance tree between
HScene and Container. It is
allowed that this may result in HScene
inheriting additional methods beyond those specified here. This
allows platforms with only one native java.awt.Frame
to use HScene as specified, whereas platforms
with support for multiple java.awt.Frame or
java.awt.Window classes can use an
HScene class derived from the appropriate class.
HScenes follow the design pattern of the
java.awt.Window class. They are not a scarce resource
on the platform. On platforms which only support one HScene being visible at one time the current
HScene both loses the input focus and is
hidden (e.g. iconified) when another application successfully
requests the input focus. Two
java.awt.event.WindowEvent events, with ids
WINDOW_DEACTIVATED and WINDOW_ICONIFIED,
shall be generated and sent to the HScene which has lost the focus and the isShowing method for that HScene
shall return false.
In terms of delegation, the HScene shall
behave like a Window with a native peer
implementation, in that it will not appear to delegate any
functionality to any parent object. Components which do not specify
default characteristics inherit default values transitively from
their parent objects. Therefore, the implementation of HScene must have valid defaults defined for all
characteristics, e.g. Font, foreground
Color, background Color,
ColorModel, Cursor and
Locale.
HScene extends the
java.awt.Container class by providing additional
Z-ordering capabilities, which are required since components in the
HAVi user-interface are explicitly allowed to overlap each
other. The Z-ordering capabilities are defined by the HComponentOrdering interface.
Note that these Z-ordering capabilities (addBefore, addAfter,
pop, popInFrontOf, popToFront, push, pushBehind and
pushToBack) must be implemented by (implicitly) reordering
the child Components within the HScene,
so that the standard AWT convention that the Z-order is defined as
the order in which Components are added to a given Container is
maintained. See the description for HComponentOrdering for more
details.
java.awt.KeyEvent events
to the parent HScene of an
application. Under these circumstances it is the responsibility of
the application designer to ensure that the relevant
java.awt.KeyEvent events used for "shortcut
keys" are not consumed by any custom components.
Implementations of the standard HAVi UI components which process
java.awt.event.KeyEvent events shall not consume any
KeyEvent, thus allowing their use as a shortcut key on
implementation which rely on KeyEvents being available in this way.
HScene and its component hierarchy is not
specified.
Note that whether the HScene is visible
or not (as determined by the isVisible method) does not guarantee that it has the input focus
and is receiving events.
When the application initially gains the input focus, this is
indicated by the system sending a
java.awt.event.WindowEvent of type
WINDOW_ACTIVATED to the HScene. The HScene should request that
a child component gain the focus, if one is available. However, the
mechanism by which this occurs is intentionally not specified here.
When the entire application loses the user's focus, the system
shall notify the HScene that it is no
longer receiving events by sending a java.awt.event.WindowEvent of
type WINDOW_DEACTIVATED to the HScene.
There is no public constructor for HScene, it is constructed by an HSceneFactory. Only one HScene per HGraphicsDevice can be acquired at any
one time for each application.
The application may request that it be made visible by calling the
the show method. This method should
ensure that the HScene is completely
visible to the user, e.g. by expanding an icon, or changing the
stacking order between competing overlapping applications.
Making the HScene visible shall not
automatically cause it to receive or even request input
focus. Input focus can be requested by the application by calling
the requestFocus
method at any time.
| Parameter | Description | Default value | Set method | Get method |
|---|---|---|---|---|
| None. | ||||
| Description | Default value | Set method | Get method |
|---|---|---|---|
Visibility of the HScene |
false | setVisible | isVisible |
| Activity of associated shortcuts | Shortcuts are active | enableShortcuts |
isEnableShortcuts |
| Associated layout manager | null | java.awt.Container#setLayout | java.awt.Container#getLayout |
| Background image mode | IMAGE_NONE | setRenderMode |
getRenderMode |
Container.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
BACKGROUND_FILL
A constant for use with the
setBackgroundMode method
which indicates that the HScene
should fill its bounding rectangle with its current background
color before painting any background image and children. |
static int |
IMAGE_CENTER
A constant for use with
setRenderMode which specifies that any background image
rendered in this HScene should be
centered in the extents of the HScene. |
static int |
IMAGE_NONE
A constant for use with
setRenderMode which specifies that a background image should
not be rendered in this HScene. |
static int |
IMAGE_STRETCH
A constant for use with
setRenderMode which specifies that any background image
rendered in this HScene should be
stretched to fill the extents of the HScene. |
static int |
IMAGE_TILE
A constant for use with
setRenderMode which specifies that any background image
rendered in this HScene should be
tiled starting from the top left origin of the HScene. |
static int |
NO_BACKGROUND_FILL
A constant for use with the
setBackgroundMode method
which indicates that the HScene
should not fill its bounding rectangle with any
color before painting any background image and children. |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Modifier | Constructor and Description |
|---|---|
protected |
HScene()
It is not intended that applications should directly construct
HScene objects. |
| Modifier and Type | Method and Description |
|---|---|
Component |
addAfter(Component component,
Component front)
|
Component |
addBefore(Component component,
Component behind)
Adds a
java.awt.Component to this HScene directly in front of a
previously added java.awt.Component. |
boolean |
addShortcut(int keyCode,
HActionable comp)
Adds a shortcut key to action the specified
HActionable. |
void |
addWindowListener(WindowListener wl)
Add a listener to receive any java.awt.event.WindowEvents sent
from this
HScene. |
void |
dispose()
Disposes of this HScene.
|
void |
enableShortcuts(boolean enable)
Enables or disables all short cuts that are currently set on
the Scene.
|
int[] |
getAllShortcutKeycodes()
Returns all keycodes added in the HScene as shortcuts.
|
Image |
getBackgroundImage()
Retrieve any image used as a background for this
HScene. |
int |
getBackgroundMode()
Get the background mode of this
HScene. |
Component |
getFocusOwner()
|
HEventGroup |
getKeyEvents()
Return the key codes which this HScene is interested in receiving when it
has input focus.
|
HScreenRectangle |
getPixelCoordinatesHScreenRectangle(Rectangle r)
Returns an HScreenRectangle which corresponds to the graphics
(AWT) pixel area specified by the parameter in this HScene.
|
int |
getRenderMode()
Get the rendering mode of any background image associated with
this
HScene. |
HSceneTemplate |
getSceneTemplate()
Return an
HSceneTemplate
describing this HScene. |
HActionable |
getShortcutComponent(int keyCode)
Retrieve the
HActionable
associated with the specified shortcut key. |
int |
getShortcutKeycode(HActionable comp)
Returns the keycode associated with the specified HActionable
component.
|
boolean |
isDoubleBuffered()
Returns
true if all the drawing done during the update and
paint methods for this specific HScene object is automatically double buffered. |
boolean |
isEnableShortcuts()
Returns the status of all short cuts that are currently set on
the HScene.
|
boolean |
isOpaque()
Returns true if the entire
HScene
area, as given by the java.awt.Component#getBounds
method, is fully opaque, i.e. |
boolean |
isVisible()
Determines if the
HScene (or more
properly its added child components) is Visible. |
void |
paint(Graphics g)
HScene objects override the paint
method (defined in java.awt.Component) to paint
the added "child" components on top of an optional
background color or image. |
boolean |
pop(Component component)
Moves the specified
java.awt.Component one
component nearer in the Z-order, i.e. |
boolean |
popInFrontOf(Component move,
Component behind)
Puts the specified
java.awt.Component in front of
another java.awt.Component in the Z-order of this
HScene. |
boolean |
popToFront(Component component)
Brings the specified
java.awt.Component to the
"front" of the Z-order in this HScene. |
protected void |
processWindowEvent(WindowEvent we)
Process a java.awt.event.WindowEvent for this
HScene. |
boolean |
push(Component component)
Moves the specified
java.awt.Component one
component further away in the Z-order, i.e. |
boolean |
pushBehind(Component move,
Component front)
Puts the specified
java.awt.Component behind
another java.awt.Component in the Z-order of this
HScene. |
boolean |
pushToBack(Component component)
Place the specified
java.awt.Component at the
"back" of the Z-order in this HScene. |
void |
removeShortcut(int keyCode)
Removes the specified short-cut key.
|
void |
removeWindowListener(WindowListener wl)
Remove a listener so that it no longer receives any
java.awt.event.WindowEvents.
|
void |
setActive(boolean focus)
Set whether the HScene is prepared to accept focus.
|
void |
setBackgroundImage(Image image)
Set an image which shall be painted in the background of the
HScene, after the background has
been drawn according to the current mode set with setBackgroundMode,
but before any children are drawn. |
void |
setBackgroundMode(int mode)
Set the background mode of this
HScene. |
void |
setKeyEvents(HEventGroup keyCodes)
Define the key codes which this HScene is interested in receiving when
it has input focus.
|
boolean |
setRenderMode(int mode)
Set the rendering mode of any background image associated with
this
HScene. |
void |
setVisible(boolean visible)
Shows or hides this
HScene depending
on the value of the input parameter visible. |
void |
show()
Shows this
HScene, and brings it to the
front. |
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, 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, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final int IMAGE_NONE
setRenderMode which specifies that a background image should
not be rendered in this HScene.public static final int IMAGE_STRETCH
setRenderMode which specifies that any background image
rendered in this HScene should be
stretched to fill the extents of the HScene.public static final int IMAGE_CENTER
setRenderMode which specifies that any background image
rendered in this HScene should be
centered in the extents of the HScene. No tiling or scaling of the image shall be performed.public static final int IMAGE_TILE
setRenderMode which specifies that any background image
rendered in this HScene should be
tiled starting from the top left origin of the HScene. No scaling of the image shall be
performed.public static final int NO_BACKGROUND_FILL
setBackgroundMode method
which indicates that the HScene
should not fill its bounding rectangle with any
color before painting any background image and children.public static final int BACKGROUND_FILL
setBackgroundMode method
which indicates that the HScene
should fill its bounding rectangle with its current background
color before painting any background image and children.protected HScene()
HScene objects. HScene objects should be constructed via
the HSceneFactory classes
factory methods.
Creates an HScene object. See the
class description for details of constructor parameters and
default values.
HSceneFactorypublic void setVisible(boolean visible)
HScene depending
on the value of the input parameter visible. An
HScene is initially not visible, a
call to setVisible should be used to make it
visible. This method does not cause the
HScene to request the input focus.setVisible in class Componentvisible - If true, makes this HScene visible; otherwise, hides this HScene.show()public boolean isVisible()
public void paint(Graphics g)
HScene objects override the paint
method (defined in java.awt.Component) to paint
the added "child" components on top of an optional
background color or image. The paint behavior is as follows:
BACKGROUND_FILL, the entire
HScene is first filled using the
current background color.
setBackgroundImage
method, and the current image rendering mode as set
using setRenderMode is
not IMAGE_NONE, the specified image is painted. Scaling and
tiling are performed according to the render mode set.
public int getBackgroundMode()
HScene. The return value specifies whether the paint method
should draw the background (i.e. a rectangle filling the bounds
of the HScene).NO_BACKGROUND_FILL or BACKGROUND_FILL.public void setBackgroundMode(int mode)
HScene. The value specifies whether the paint method
should draw the background (i.e. a rectangle filling the bounds
of the HScene).
Note that the background mode will affect the return value of
the isOpaque method, depending
on the value of the mode parameter. A fill mode of
BACKGROUND_FILL
implies that isOpaque must
return true.
mode - one of NO_BACKGROUND_FILL or BACKGROUND_FILL. If mode is
not a valid value, an IllegalArgumentException will be thrown.public void setBackgroundImage(Image image)
HScene, after the background has
been drawn according to the current mode set with setBackgroundMode,
but before any children are drawn. The image is rendered
according to the current render mode set with setRenderMode.
Note that the use of a background image in this way may affect
the return value of the isOpaque
method, depending on the image and the current rendering mode.
image - the image to be used as a background. If this
parameter is null any current image is
removed. Note that depending on the current render mode any
image set may not actually be rendered.setRenderMode(int)public Image getBackgroundImage()
HScene.null if
no image is set. Note that depending on the current render mode
any image set may not actually be rendered.setRenderMode(int)public boolean setRenderMode(int mode)
HScene. Note that the
minimum requirement is to support only the
IMAGE_NONE mode. Support of the other modes is
platform and implementation specific.
mode - the rendering mode, one of IMAGE_NONE, IMAGE_STRETCH, IMAGE_CENTER or IMAGE_TILE.true if the mode was set successfully,
false if the mode is not supported by the
platform.public int getRenderMode()
HScene.IMAGE_NONE, IMAGE_STRETCH, IMAGE_CENTER or IMAGE_TILE.public boolean isDoubleBuffered()
true if all the drawing done during the update and
paint methods for this specific HScene object is automatically double buffered.isDoubleBuffered in class Componenttrue if all the drawing done during the
update and paint methods for this specific HScene object is automatically
double buffered, or false if drawing is not double
buffered. The default value for the double buffering setting
is platform-specific.public boolean isOpaque()
HScene
area, as given by the java.awt.Component#getBounds
method, is fully opaque, i.e. its paint method (or surrogate
methods) guarantee that all pixels are painted in an opaque
Color.
By default, the return value depends on the value of the
current background mode, as set by the
setBackgroundMode
method. The return value should be overridden by subclasses
that can guarantee full opacity. The consequences of an invalid
overridden value are implementation specific.
public Component addBefore(Component component, Component behind)
java.awt.Component to this HScene directly in front of a
previously added java.awt.Component.
If component has already been added to this
container, then addBefore moves
component in front of behind. If
behind and component are the same
component which was already added to this container,
addBefore does not change the ordering of the
components and returns component.
This method affects the Z-order of the
java.awt.Component children within the HScene, and may also implicitly
change the numeric ordering of those children.
addBefore in interface HComponentOrderingcomponent - is the java.awt.Component to be
added to the HScenebehind - is the java.awt.Component, which
component will be placed in front of, i.e.
behind will be directly behind the added
java.awt.Componentjava.awt.Component is successfully
added or was already present, then it will be returned from
this call. If the
java.awt.Component is not successfully added,
e.g. behind is not a
java.awt.Component currently added to the HScene, then null will
be returned. This method must be implemented in a thread safe manner.
public Component addAfter(Component component, Component front)
java.awt.Component to this HScene directly behind a previously
added java.awt.Component.
If component has already been added to this
container, then addAfter moves component behind
front. If front and
component are the same component which was already
added to this container, addAfter does not change
the ordering of the components and returns
component.
This method affects the Z-order of the
java.awt.Component children within the HScene, and may also implicitly
change the numeric ordering of those children.
addAfter in interface HComponentOrderingcomponent - is the java.awt.Component to be
added to the HScenefront - is the java.awt.Component, which
component will be placed behind, i.e.
front will be directly in front of the added
java.awt.Componentjava.awt.Component is successfully
added or was already present, then it will be returned from
this call. If the
java.awt.Component is not successfully added,
e.g. front is not a java.awt.Component currently
added to the HScene, then
null will be returned.
This method must be implemented in a thread safe manner.
public boolean popToFront(Component component)
java.awt.Component to the
"front" of the Z-order in this HScene.
If component is already at the front of the
Z-order, the order is unchanged and popToFront
returns true.
popToFront in interface HComponentOrderingcomponent - The java.awt.Component to bring to the
"front" of the Z-order of this HScene.true on success,
false on failure, for example when the
java.awt.Component has yet to be added to the
HScene. If this method
fails, the Z-order is unchanged.public boolean pushToBack(Component component)
java.awt.Component at the
"back" of the Z-order in this HScene.
If component is already at the back the Z-order is
unchanged and pushToBack returns true.
pushToBack in interface HComponentOrderingcomponent - The java.awt.Component to place
at the "back" of the Z-order of this HScene.true on success,
false on failure, for example when the
java.awt.Component has yet to be added to the
HScene. If the component was
not added to the container pushToBack does not change the
Z-order.public boolean pop(Component component)
java.awt.Component one
component nearer in the Z-order, i.e. swapping it with the
java.awt.Component that was directly in front of
it.
If component is already at the front of the
Z-order, the order is unchanged and pop returns
true.
pop in interface HComponentOrderingcomponent - The java.awt.Component to be moved.true on success, false on failure, for example
if the java.awt.Component has yet to be added to
the HScene.public boolean push(Component component)
java.awt.Component one
component further away in the Z-order, i.e. swapping it with
the java.awt.Component that was directly behind
it.
If component is already at the back of the
Z-order, the order is unchanged and push returns
true.
push in interface HComponentOrderingcomponent - The java.awt.Component to be
moved.true on success,
false on failure, for example if the
java.awt.Component has yet to be added to the
HScene.public boolean popInFrontOf(Component move, Component behind)
java.awt.Component in front of
another java.awt.Component in the Z-order of this
HScene.
If move and behind are the same
component which has been added to the container
popInFront does not change the Z-order and returns
true.
popInFrontOf in interface HComponentOrderingmove - The java.awt.Component to be moved
directly in front of the "behind" Component in the
Z-order of this HScene.behind - The java.awt.Component which the
"move" Component should be placed directly in front
of.true on success,
false on failure, for example when either
java.awt.Component has yet to be added to the
HScene. If this method
fails, the Z-order is unchanged.public boolean pushBehind(Component move, Component front)
java.awt.Component behind
another java.awt.Component in the Z-order of this
HScene.
If move and front are the same
component which has been added to the container
pushBehind does not change the Z-order and returns
true.
pushBehind in interface HComponentOrderingmove - The java.awt.Component to be moved
directly behind the "front" Component in the Z-order
of this HScene.front - The java.awt.Component which the
"move" Component should be placed directly behind.true on success,
false on failure, for example when either
java.awt.Component has yet to be added to the
HScene.public void addWindowListener(WindowListener wl)
HScene. 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.wl - The java.awt.event.WindowListener to be notified of
any java.awt.event.WindowEvents.public void removeWindowListener(WindowListener wl)
wl - The java.awt.event.WindowListener to be removed from
notification of any java.awt.event.WindowEvents.protected void processWindowEvent(WindowEvent we)
HScene.we - the java.awt.event.WindowEvent to be processed.public Component getFocusOwner()
public void show()
HScene, and brings it to the
front.
If this HScene is not yet visible,
show makes it visible. If this
HScene is already visible, then this
method brings it to the front. This method does not cause the
HScene to request the input focus.
show in class ComponentsetVisible(boolean)public void dispose()
HSceneFactory.dispose.
Calling this method on an HScene that was already disposed
will have no effect.public boolean addShortcut(int keyCode,
HActionable comp)
HActionable. Generating the defined
java.awt.KeyEvent or HRcEvent keycode causes the specified component to become
actioned --- potentially any keyCode may have a shortcut
associated with it. The shortcut will only be added if the
HActionable component is a child
component in the container hierarchy of which the HScene is the root container. If this is
not the case this method shall return false.
Note that a maximum of one HActionable may be associated with a given keyCode. An HActionable can have at most one
associated shortcut keycode. Calling addShortcut repeatedly with the
same HActionable will result in
the previous short cut being removed. A short cut can be set on
an invisible HActionable and
therefore it is possible to provide short-cuts that have no
user representation.
If the relevant keyCode is received by the HScene, then the HActionable will be actioned by the
HScene sending it an ACTION_PERFORMED.
Note that it is the responsibility of the application to ensure that
the keyCode used is included in the set registered with the setKeyEvents
method and is one which the platform can generate, i.e. where the method
HRcCapabilities.isSupported() returns true.
keyCode - the keycode that represents the short cut. If
keycode is java.awt.event.KeyEvent#VK_UNDEFINED, then the
shortcut will not be added, any existing shortcut for this
component will not be changed and this method shall return false.comp - The actionable component that will be actioned.public void removeShortcut(int keyCode)
keyCode - The keycode that represents the short cutpublic HActionable getShortcutComponent(int keyCode)
HActionable
associated with the specified shortcut key.keyCode - the shortcut key code to be queried for an
associated HActionable.HActionable
associated with the specified key if keyCode is a
valid shortcut key for this HScene,
null otherwise.public void enableShortcuts(boolean enable)
addShortcut or removeShortcut.
Note enableShortcuts(false) does not remove existing added HScene shortcuts - they are merely disabled
and may be subsequently re-enabled with enableShortcuts(true).
enable - a value of true indicates all shortcuts are to be
enabled, and a value of false indicates all shortcuts are to be
disabled.public boolean isEnableShortcuts()
enableShortcuts(boolean)public int getShortcutKeycode(HActionable comp)
comp - the HActionable to return the keycode that it is
associated with.public int[] getAllShortcutKeycodes()
public HScreenRectangle getPixelCoordinatesHScreenRectangle(Rectangle r)
r - the AWT pixel area within this HScene (i.e. within the
HScene's coordinate space), specified as an java.awt.Rectangle.public HSceneTemplate getSceneTemplate()
HSceneTemplate
describing this HScene. This
template can be queried in order to obtain the size & position
of the HScene in screen coordinates
and the display device used for the HScene, etc.HSceneTemplate
describing of the HScene.public void setActive(boolean focus)
focus - true if the HScene can accept focus otherwise falsepublic void setKeyEvents(HEventGroup keyCodes)
Applications may not receive all the keys in which they have declared an interest for a number of reasons.
The default set of key codes is a subset of the key codes for which HRcCapabilities.isSupported(keyCode) returns true as modified by platform policy. It represents the maximum set of key codes which an application can receive. Hence applications which never wish to receive fewer keys than this need not use this method.
Defining a key code in this method shall not result in a "virtual" keyboard being displayed. It is implementation dependent whether this method has an effect on key events generated from virtual keyboards where implementations provide these.
Listing a key code more than once in the input to this method shall have the same effect as listing it once. Unknown key codes shall be ignored and shall not cause an error condition. Applications may still receive key codes in which they have not declared an interest however this is platform dependent.
keyCodes - the key codes which this HScene is interested in receivingpublic HEventGroup getKeyEvents()
Copyright © 2012 code4tv.com. All Rights Reserved.