HVisible

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.havi.ui
Class HVisible

    java.lang.Object
      java.awt.Component
          org.havi.ui.HComponent
              org.havi.ui.HVisible

All Implemented Interfaces:
  ImageObserver, Serializable, TestOpacity, HMatteLayer, HState

Direct Known Subclasses:
  HListGroup, HSinglelineEntry, HStaticAnimation, HStaticIcon, HStaticRange, HStaticText

    public class HVisible

extends HComponent
implements HState

The `HVisible` class is the base class for all non-interactive components.

If a layout manager is associated with the Container into which a `HVisible` component is placed, the size and location of the component will be controlled by the layout manager.

`HVisible` provides the following features for the use of subclasses:

- support for interaction states.
- a mechanism to associate the component with a pluggable `HLook` class to which all drawing is delegated.
- support for state-related content which is drawn by the associated `HLook`.
- support for scalable and alignable content.
- support for private look data.
- support for preferred sizes when used with a layout manager.
- control over the background painting behavior.
- a pluggable text layout management mechanism.

Some of these features are discussed in more detail below.

### Interaction State

Interaction states for `HVisible` components are defined in the `HState` interface. The only interaction states valid for a plain (un-subclassed) `HVisible` are:

- `HState.NORMAL_STATE` - indicating that the component is in its normal interaction state.
- `HState.DISABLED_STATE` - indicating that the component is disabled. While this has no effect on user interaction with a plain `HVisible` (since there is no user interaction) it will affect the visual appearance.

Subclasses of `HVisible` may use other states. However, `setInteractionState(int)` is the only means by which state can be changed and will throw an IllegalArgumentException if the state is not valid for a particular component type. Subclasses of `HVisible` must not manipulate state in other ways.

The `getInteractionState` method is provided to allow any class to read the current state of a component.

### State-based content

Specific content may be set for any interaction state defined in `HState`, irrespective of whether the subclass of `HVisible` can ever be in that state.

Note that content is set on the various `STATE` constants defined in `HState`, and not on the `STATE_BIT` constants. A `java.lang.IllegalArgumentException` will be thrown by any method which takes a state as a parameter if a `STATE_BIT` rather than a `STATE` is passed.

By default it is possible to set content for any of eight discrete states. However, if no content has been set for a particular state, the associated `HLook` should use content from the nearest matching state as defined below:

State | Content if missing | Example style
--- | --- | ---
`HState.NORMAL_STATE` | none | no special style
`HState.FOCUSED_STATE` | `HState.NORMAL_STATE` | highlighted
`HState.ACTIONED_STATE` | `HState.FOCUSED_STATE` | pushed in
`HState.ACTIONED_FOCUSED_STATE` | `HState.FOCUSED_STATE` | highlighted & pushed in
`HState.DISABLED_STATE` | `HState.NORMAL_STATE` | grayed out
`HState.DISABLED_FOCUSED_STATE` | `HState.DISABLED_STATE` | grayed out & highlighted
`HState.DISABLED_ACTIONED_STATE` | `HState.ACTIONED_STATE` | grayed out & pushed in
`HState.DISABLED_ACTIONED_FOCUSED_STATE` | `HState.DISABLED_STATE` | grayed out & highlighted & pushed

It is recommended that HLook implementations be capable of drawing components in styles that allow the interaction state to be visually distinguished even when no content is set, or the content is the same for several states.

Content for any component may be changed "on the fly" using the setContent methods. However, some components (e.g. `HStaticAnimation` and `HAnimation`) may be asynchronously referencing their content (i.e. through a separate implementation-specific animation thread). Therefore the following restrictions apply to the `setAnimateContent(java.awt.Image[], int)` method when the instance of `HVisible` on which it is invoked implements the `HAnimateEffect` interface:

- The method must be synchronized with any implementation-specific animation thread such that content cannot be changed while a different thread is using it.
- If the animation was running the method should stop the animation in a synchronized manner before changing content.
- The method should reset the animation to a starting position defined by the current play mode. The repeat count of the animation should be reset to 0.
- If the animation was running the method should start the animation.

Alternative platform-specific animation schemes which do not use `HAnimateEffect` are outside the scope of this document. However, a similar strategy should be employed to avoid synchronization problems.

### Content Scaling and Alignment

Where state-based content is used, it is an implementation option to support scaling of the content to fit the HVisible. Some looks also support alignment of content. See the class description of `HLook` for details of which looks support scaling and alignment. See the fields description of this class for constants which can be used to specify scaling and alignment modes.

The following methods are used to get and set alignment of content:

- `setHorizontalAlignment(int)`
- `setVerticalAlignment(int)`
- `getHorizontalAlignment()`
- `getVerticalAlignment()`

The following methods are used to get and set the scaling of content. Scaling support is optional, however all implementations must support the `RESIZE_NONE` scaling mode. Platforms are not required to support scaling of textual content by default.

- `setResizeMode(int)`
- `getResizeMode()`

### Repaint Hints

An associated HLook provides a mechanism of efficiently repainting an `HVisible`, based on a hint which provides data about the change which triggered the redrawing. The `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method should be called in preference to `repaint` whenever the HVisible requires a redraw to change its appearance.

The `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method requires an array of one or more `HChangeData` objects, which contain a hint, and associated data. All keys have the type `int`, with values defined as constants in this class. The following hints are defined:

Hint (key) | Data (value) | Data Interpretation
--- | --- | ---
`TEXT_CONTENT_CHANGE` | Object[9] | [Integer changedState, String oldNORMAL_STATEtext, String oldFOCUSED_STATEtext, String oldACTIONED_STATEtext, String oldACTIONED_FOCUSED_STATEtext, String oldDISABLED_STATEtext, String oldDISABLED_FOCUSED_STATEtext, String oldDISABLED_ACTIONED_STATEtext, String oldDISABLED_ACTIONED_FOCUSED_STATEtext]
`GRAPHIC_CONTENT_CHANGE` | Object[9] | [Integer changedState, Image oldNORMAL_STATEimage, Image oldFOCUSED_STATEimage, Image oldACTIONED_STATEimage, Image oldACTIONED_FOCUSED_STATEimage, Image oldDISABLED_STATEimage, Image oldDISABLED_FOCUSED_STATEimage, Image oldDISABLED_ACTIONED_STATEimage, Image oldDISABLED_ACTIONED_FOCUSED_STATEimage]
`ANIMATE_CONTENT_CHANGE` | Object[9] | [Integer changedState, Image[] oldNORMAL_STATEanimation, Image[] oldFOCUSED_STATEanimation, Image[] oldACTIONED_STATEanimation, Image[] oldACTIONED_FOCUSED_STATEanimation, Image[] oldDISABLED_STATEanimation, Image[] oldDISABLED_FOCUSED_STATEanimation, Image[] oldDISABLED_ACTIONED_STATEanimation, Image[] oldDISABLED_ACTIONED_FOCUSED_STATEanimation]
`CONTENT_CHANGE` | Object[9] | [Integer changedState, Object oldNORMAL_STATEcontent, Object oldFOCUSED_STATEcontent, Object oldACTIONED_STATEcontent, Object oldACTIONED_FOCUSED_STATEcontent, Object oldDISABLED_STATEcontent, Object oldDISABLED_FOCUSED_STATEcontent, Object oldDISABLED_ACTIONED_STATEcontent, Object oldDISABLED_ACTIONED_FOCUSED_STATEcontent]
`STATE_CHANGE` | Integer | oldState
`CARET_POSITION_CHANGE` | Integer | oldPosition
`ECHO_CHAR_CHANGE` | Character | oldEcho
`EDIT_MODE_CHANGE` | Boolean | oldEditMode
`MIN_MAX_CHANGE` | Integer[2] | [oldMin, oldMax]
`THUMB_OFFSETS_CHANGE` | Integer[2] | [oldMin, oldMax]
`ORIENTATION_CHANGE` | Integer | oldOrientation
`ITEM_VALUE_CHANGE` | Integer | oldValue
`ADJUSTMENT_VALUE_CHANGE` | Integer | oldIndex
`LIST_CONTENT_CHANGE` | HListElement[] | oldContent
`LIST_ICONSIZE_CHANGE` | Dimension | oldSize
`LIST_LABELSIZE_CHANGE` | Dimension | oldSize
`LIST_MULTISELECTION_CHANGE` | Boolean | oldSelection
`LIST_SCROLLPOSITION_CHANGE` | Integer | oldScrollPosition
`SIZE_CHANGE` | Integer | oldSize
`BORDER_CHANGE` | Boolean | oldBorderMode
`REPEAT_COUNT_CHANGE` | Integer | oldRepeatCount
`ANIMATION_POSITION_CHANGE` | Integer | oldValue
`LIST_SELECTION_CHANGE` | HListElement[] | oldSelectedElements
`UNKNOWN_CHANGE` | Integer | UNKNOWN_CHANGE

Note that implementations of `HLook` may not actually implement more efficient drawing code for a given hint. In particular, simply repainting the entire `HVisible` is a valid implementation option.

The following code for the `HStaticRange.setRange(int, int)` method demonstrates how hint objects are used. Note that the values passed in the hint are always the old values, since the `HLook` can always retrieve the new values as needed from the `HVisible`. Variables starting with "my" are member variables of the class.

    public boolean setRange(int min, int max)
    {
      if (min >= max)
        return false;

      if (min != myMin || max != myMax)
      {
        // create hint object with the OLD values
        HChangeData oldRangeData =
          new HChangeData(HVisible.MIN_MAX_CHANGE,
                          new Integer[] { new Integer(myMin),
                                          new Integer(myMax) });

        // update the values
        myMin = min;
        myMax = max;

        Integer oldValue = new Integer(myValue);

        // behavior checking elided
        if (myValue < myMin)
          myValue = myMin;
        else if (myValue > myMax)
          myValue = myMax;
        else
          oldValue = null; // myValue is within new range

        HChangeData[] array;
        if (oldValue == null)
          array = new HChangeData[] { oldRangeData };
        else
          array = new HChangeDate[]
          { oldRangeData,
            new HChangeData( HVisible.ADJUSTMENT_VALUE_CHANGE,
                            oldValue )};

        // tell the look to repaint as needed
        if (myLook != null)
          myLook.widgetChanged(this, array);
      }
      return true;
    }

### Private HLook data

Private data for the use of an associated `HLook` to optimize the redraw of the component may be set on any `HVisible`. Examples of such data are:

- cached bitmap representations of complex drawing operations
- scrolling metrics and positions
- cached layout data

Data is set using the `setLookData(java.lang.Object, java.lang.Object)` method, and retrieved with the `getLookData(java.lang.Object)` method.

To keep the on-screen representation of an `HVisible` synchronized with its state, any class may call `setLookData(java.lang.Object, java.lang.Object)` with a parameter of `null` to invalidate any cached data. Instances of `HLook` must be able to regenerate any data they store on `HVisible` classes at any time. This mechanism is intended for implementation optimization only and shall not be used for storing content.

Use of this mechanism is an implementation option. If this mechanism is not used by an implementation, `getLookData(java.lang.Object)` shall always return `null` and `setLookData(java.lang.Object, java.lang.Object)` shall do nothing. Interoperable systems shall not assume that this mechanism is implemented.

### Preferred Sizes

The `setDefaultSize(java.awt.Dimension)` and `getDefaultSize()` methods provide support for a user-defined default preferred size to be passed to a layout manager. This value is returned to the layout manager through the `HLook.getPreferredSize(org.havi.ui.HVisible)` method and if set overrides any look-specific value based on content calculated by the `HLook`.

Note that the interpretation of the size passed to `setDefaultSize(java.awt.Dimension)` is not the overall size of the component, but the area available to the look to render the component into excluding any look-specific borders. Therefore when a layout manager is in use the actual size of the component is likely to be larger than this default size. See the descriptions of `HLook.getMinimumSize(org.havi.ui.HVisible)`, `HLook.getPreferredSize(org.havi.ui.HVisible)` and `HLook.getMaximumSize(org.havi.ui.HVisible)` in `HLook` for details of the exact algorithm used.

Note that constructors of `HVisible` and subclasses which accept `width` and `height` parameters shall set the default size to `[width, height]` as if these parameters were passed to `setDefaultSize(java.awt.Dimension)`. If a layout manager is in use the actual size of the component will probably be larger than this size after layout due to the `HLook` adding borders. However, if no layout manager is used the `width` and `height` parameters are simply used to set the actual size of the component.

### Background Painting

Normally the associated `HLook` does not paint the background of the `HVisible`, allowing for non-rectangular components and text overlaying bitmaps. However, `HVisible` provides for components which require their background to be painted through the setBackgroundMode method. Note that if the mode is set to `BACKGROUND_FILL` the return value of the `HComponent.isOpaque()` method may be true, depending on whether the current background color of the `HVisible` is opaque. If the background mode is set to `NO_BACKGROUND_FILL` the `HComponent.isOpaque()` method must return false.

### Event Handling

While implementations of `HVisible` may enable certain java.awt.AWTEvents, applications should assume that an `HVisible` class does not generate or respond to any java.awt.AWTEvents. If this behavior is required the standard AWT mechanisms (i.e. processEvent and similar functions) may be used to handle events on `HVisible` or subclasses. However, it is strongly recommended that component implementors use the HAVi events defined in the `org.havi.ui.event` package where possible.

For example, a component wishing to respond to user action should normally subclass `HComponent`, implement the `HActionInputPreferred` interface and handle `HActionEvent` events in the `HActionInputPreferred.processHActionEvent(org.havi.ui.event.HActionEvent)` method, instead of overriding `java.awt.Component#processEvent` or similar.

The parameters to the constructors are as follows, in cases where parameters are not used, then the constructor should use the default values.

### Default parameter values exposed in the constructors

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

### Default parameter values not exposed in the constructors

Description | Default value | Set method | Get method
--- | --- | --- | ---
Associated matte (`HMatte`). | none (i.e. getMatte() returns `null`) | `setMatte` | `getMatte`
The text layout manager responsible for text formatting. | An `HDefaultTextLayoutManager` object. | `setTextLayoutManager(org.havi.ui.HTextLayoutManager)` | `getTextLayoutManager()`
The background painting mode | `NO_BACKGROUND_FILL` | `setBackgroundMode(int)` | `getBackgroundMode()`
The default preferred size | not set (i.e. NO_DEFAULT_SIZE) unless specified by `width` and `height` parameters | `setDefaultSize(java.awt.Dimension)` | `getDefaultSize()`
The horizontal content alignment | `HALIGN_CENTER` | `setHorizontalAlignment(int)` | `getHorizontalAlignment()`
The vertical content alignment | `VALIGN_CENTER` | `setVerticalAlignment(int)` | `getVerticalAlignment()`
The content scaling mode | `RESIZE_NONE` | `setResizeMode(int)` | `getResizeMode()`
The border mode | `true` | `setBordersEnabled(boolean)` | `getBordersEnabled()`

See Also:
  Serialized Form

Field Summary
`static int` | `ADJUSTMENT_VALUE_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `ANIMATE_CONTENT_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `ANIMATION_POSITION_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `BACKGROUND_FILL` A constant for use with the `setBackgroundMode(int)` method of `HVisible` which indicates that an associated `HLook` should fill the bounding rectangle of the `HVisible` with its current background color before drawing any content.
`static int` | `BORDER_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `CARET_POSITION_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `CONTENT_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `ECHO_CHAR_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `EDIT_MODE_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `FIRST_CHANGE` A constant which indicates the first change value for use with the hinting mechanism.
`static int` | `GRAPHIC_CONTENT_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `HALIGN_CENTER` A constant for use with the `setHorizontalAlignment(int)` method of `HVisible` which indicates that content should be centered horizontally.
`static int` | `HALIGN_JUSTIFY` A constant for use with the `setHorizontalAlignment(int)` method of `HVisible` which indicates that content should be fully justified (horizontally).
`static int` | `HALIGN_LEFT` A constant for use with the `setHorizontalAlignment(int)` method of `HVisible` which indicates that content should be left aligned.
`static int` | `HALIGN_RIGHT` A constant for use with the `setHorizontalAlignment(int)` method of `HVisible` which indicates that content should be right aligned.
`static int` | `ITEM_VALUE_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `LAST_CHANGE` A constant which indicates the last defined value for use with the hinting mechanism.
`static int` | `LIST_CONTENT_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `LIST_ICONSIZE_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `LIST_LABELSIZE_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `LIST_MULTISELECTION_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `LIST_SCROLLPOSITION_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `LIST_SELECTION_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `MIN_MAX_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `NO_BACKGROUND_FILL` A constant for use with the `setBackgroundMode(int)` method of `HVisible` which indicates that an associated `HLook` should not fill the bounding rectangle of the `HVisible` with its current background color before drawing any content.
`static int` | `NO_DEFAULT_HEIGHT` A constant for use with the `setDefaultSize(java.awt.Dimension)` and `getDefaultSize()` methods of `HVisible` which indicates that no default height is desired for the `HVisible`.
`static Dimension` | `NO_DEFAULT_SIZE` A constant for use with the `setDefaultSize(java.awt.Dimension)` and `getDefaultSize()` methods of `HVisible` which indicates that no default size is desired for the `HVisible`.
`static int` | `NO_DEFAULT_WIDTH` A constant for use with the `setDefaultSize(java.awt.Dimension)` and `getDefaultSize()` methods of `HVisible` which indicates that no default width is desired for the `HVisible`.
`static int` | `ORIENTATION_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `REPEAT_COUNT_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `RESIZE_ARBITRARY` A constant for use with the `setResizeMode(int)` method of `HVisible` which indicates that content should be scaled to fit the component.
`static int` | `RESIZE_NONE` A constant for use with the `setResizeMode(int)` method of `HVisible` which indicates that content should not be scaled to fit the component.
`static int` | `RESIZE_PRESERVE_ASPECT` A constant for use with the `setResizeMode(int)` method of `HVisible` which indicates that content should be scaled to fit the component while preserving the aspect ratio of the content.
`static int` | `SIZE_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `STATE_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `TEXT_CONTENT_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `TEXT_VALUE_CHANGE` Deprecated. This constant shall not be used for the hinting mechanism. Looks shall treat it as `UNKNOWN_CHANGE`. See also `CARET_POSITION_CHANGE` and `TEXT_CONTENT_CHANGE`.
`static int` | `THUMB_OFFSETS_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `UNKNOWN_CHANGE` A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`).
`static int` | `VALIGN_BOTTOM` A constant for use with the `setVerticalAlignment(int)` method of `HVisible` which indicates that content should be vertically aligned to the bottom of the component.
`static int` | `VALIGN_CENTER` A constant for use with the `setVerticalAlignment(int)` method of `HVisible` which indicates that content should be centered vertically.
`static int` | `VALIGN_JUSTIFY` A constant for use with the `setVerticalAlignment(int)` method of `HVisible` which indicates that content should be fully justified (vertically).
`static int` | `VALIGN_TOP` A constant for use with the `setVerticalAlignment(int)` method of `HVisible` which indicates that content should be vertically aligned to the top of the component.

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
`HVisible()` Creates an `HVisible` component with no `HLook`.
`HVisible(HLook hlook)` Creates an `HVisible` component with the given `HLook`.
`HVisible(HLook hlook, int x, int y, int width, int height)` Creates an `HVisible` component with the given `HLook` and the specified location and size.

Method Summary
`Image[]` | `getAnimateContent(int state)` Gets the animate content for this component.
`int` | `getBackgroundMode()` Get the background mode of this `HVisible`.
`boolean` | `getBordersEnabled()` Returns the current border mode.
`Object` | `getContent(int state)` Gets the content for this component.
`Dimension` | `getDefaultSize()` Returns the default preferred size to be used for this component when a layout manager is in use.
`Image` | `getGraphicContent(int state)` Gets the graphic content for this component.
`int` | `getHorizontalAlignment()` Get the horizontal alignment of any state-based content rendered by an associated `HLook`.
`int` | `getInteractionState()` Return the interaction state the component is currently in.
`HLook` | `getLook()` Gets the `HLook` for this component.
`Object` | `getLookData(Object key)` Retrieve a look-specific private data object.
`Dimension` | `getMaximumSize()` Gets the maximum size of the `HVisible`.
`Dimension` | `getMinimumSize()` Gets the minimum size of the `HVisible`.
`Dimension` | `getPreferredSize()` Gets the preferred size of the `HVisible`.
`int` | `getResizeMode()` Get the scaling mode for scaling any state-based content rendered by an associated `HLook`.
`String` | `getTextContent(int state)` Gets the text content for this component.
`HTextLayoutManager` | `getTextLayoutManager()` Gets the text layout manager that is being used to layout this text.
`int` | `getVerticalAlignment()` Get the vertical alignment of any state-based content rendered by an associated `HLook`.
`boolean` | `isFocusTraversable()` By default an `HVisible` component is not focus-traversable.
`boolean` | `isOpaque()` Returns true if the entire `HVisible` area, as given by the java.awt.Component#getBounds method, is fully opaque, i.e.
`void` | `paint(Graphics g)` Draws the current state of the component, by calling the `HLook.showLook(java.awt.Graphics, org.havi.ui.HVisible, int)` method of the associated `HLook`.
`void` | `setAnimateContent(Image[] imageArray, int state)` Sets an array of graphical content (primarily used for animation), per state.
`void` | `setBackgroundMode(int mode)` Set the background drawing mode.
`void` | `setBordersEnabled(boolean enable)` The method en- or disables rendering of platform-specific borders.
`void` | `setContent(Object object, int state)` Sets a single piece of content for this component, per state.
`void` | `setDefaultSize(Dimension defaultSize)` Set the preferred default size for this component when a layout manager is in use.
`void` | `setEnabled(boolean b)` Modifies the `HState` of this `HVisible` by calling setInteractionState, depending on the value of b.
`void` | `setGraphicContent(Image image, int state)` Sets a single piece of graphical content for this component, per state.
`void` | `setHorizontalAlignment(int halign)` Set the horizontal alignment of any state-based content rendered by an associated `HLook`.
`void` | `setLook(HLook hlook)` Sets the `HLook` for this component.
`void` | `setLookData(Object key, Object data)` Set a look-specific private data object.
`void` | `setResizeMode(int resize)` Set the resize mode of this `HVisible`.
`void` | `setTextContent(String string, int state)` Sets a single piece of text content for this component, per state.
`void` | `setTextLayoutManager(HTextLayoutManager manager)` Sets the text layout manager that should be used to layout the text for this component.
`void` | `setVerticalAlignment(int valign)` Set the vertical alignment of any state-based content rendered by an associated `HLook`.
`void` | `update(Graphics g)` The update() method in `HVisible` overrides that in Component and does not clear the background of the component, it simply modifies the current Color of the Graphics object to match that of the components background Color, and calls the paint() method.

Methods inherited from class org.havi.ui.HComponent
`getMatte, isDoubleBuffered, isEnabled, setMatte`

Methods inherited from class java.awt.Component
`addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, areFocusTraversalKeysSet, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, doLayout, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getCursor, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, hasFocus, imageUpdate, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, list, list, list, list, list, paintAll, prepareImage, prepareImage, print, printAll, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, setBackground, setBounds, setBounds, setCursor, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### HALIGN_LEFT

    public static final int HALIGN_LEFT

  A constant for use with the `setHorizontalAlignment(int)` method of `HVisible` which indicates that content should be left aligned.

  See Also:
    Constant Field Values

### HALIGN_CENTER

    public static final int HALIGN_CENTER

  A constant for use with the `setHorizontalAlignment(int)` method of `HVisible` which indicates that content should be centered horizontally.

  See Also:
    Constant Field Values

### HALIGN_RIGHT

    public static final int HALIGN_RIGHT

  A constant for use with the `setHorizontalAlignment(int)` method of `HVisible` which indicates that content should be right aligned.

  See Also:
    Constant Field Values

### HALIGN_JUSTIFY

    public static final int HALIGN_JUSTIFY

  A constant for use with the `setHorizontalAlignment(int)` method of `HVisible` which indicates that content should be fully justified (horizontally).

  See Also:
    Constant Field Values

### VALIGN_TOP

    public static final int VALIGN_TOP

  A constant for use with the `setVerticalAlignment(int)` method of `HVisible` which indicates that content should be vertically aligned to the top of the component.

  See Also:
    Constant Field Values

### VALIGN_CENTER

    public static final int VALIGN_CENTER

  A constant for use with the `setVerticalAlignment(int)` method of `HVisible` which indicates that content should be centered vertically.

  See Also:
    Constant Field Values

### VALIGN_BOTTOM

    public static final int VALIGN_BOTTOM

  A constant for use with the `setVerticalAlignment(int)` method of `HVisible` which indicates that content should be vertically aligned to the bottom of the component.

  See Also:
    Constant Field Values

### VALIGN_JUSTIFY

    public static final int VALIGN_JUSTIFY

  A constant for use with the `setVerticalAlignment(int)` method of `HVisible` which indicates that content should be fully justified (vertically).

  See Also:
    Constant Field Values

### RESIZE_NONE

    public static final int RESIZE_NONE

  A constant for use with the `setResizeMode(int)` method of `HVisible` which indicates that content should not be scaled to fit the component.

  See Also:
    Constant Field Values

### RESIZE_PRESERVE_ASPECT

    public static final int RESIZE_PRESERVE_ASPECT

  A constant for use with the `setResizeMode(int)` method of `HVisible` which indicates that content should be scaled to fit the component while preserving the aspect ratio of the content. Areas of the component that are not filled by the content will be look dependent.

  See Also:
    Constant Field Values

### RESIZE_ARBITRARY

    public static final int RESIZE_ARBITRARY

  A constant for use with the `setResizeMode(int)` method of `HVisible` which indicates that content should be scaled to fit the component. Aspect ratios of the content need not be preserved.

  See Also:
    Constant Field Values

### NO_BACKGROUND_FILL

    public static final int NO_BACKGROUND_FILL

  A constant for use with the `setBackgroundMode(int)` method of `HVisible` which indicates that an associated `HLook` should not fill the bounding rectangle of the `HVisible` with its current background color before drawing any content. Therefore any previous content will NOT necessarily be erased during the repainting of the `HVisible`.

  See Also:
    Constant Field Values

### BACKGROUND_FILL

    public static final int BACKGROUND_FILL

  A constant for use with the `setBackgroundMode(int)` method of `HVisible` which indicates that an associated `HLook` should fill the bounding rectangle of the `HVisible` with its current background color before drawing any content. Any previous content will be erased during the repainting of the `HVisible`.

  See Also:
    Constant Field Values

### FIRST_CHANGE

    public static final int FIRST_CHANGE

  A constant which indicates the first change value for use with the hinting mechanism.

  See Also:
    Constant Field Values

### TEXT_CONTENT_CHANGE

    public static final int TEXT_CONTENT_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the text content has changed. The value for this hint is an array, `java.lang.Object[9]`, which contains the state for which the content changed (a `java.lang.Integer`) and the old content (a `java.lang.String`) for all 8 states.

  See Also:
    Constant Field Values

### GRAPHIC_CONTENT_CHANGE

    public static final int GRAPHIC_CONTENT_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the graphical content has changed. The value for this hint is an array, `java.lang.Object[9]`, which contains the state for which the content changed (a `java.lang.Integer`) and the old content (a `java.awt.Image`) for all 8 states.

  See Also:
    Constant Field Values

### ANIMATE_CONTENT_CHANGE

    public static final int ANIMATE_CONTENT_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the animated content has changed. The value for this hint is an array, `java.lang.Object[9]`, which contains the state for which the content changed (a `java.lang.Integer`) and the old content (a `java.awt.Image[]`) for all 8 states.

  See Also:
    Constant Field Values

### CONTENT_CHANGE

    public static final int CONTENT_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the miscellaneous content has changed. The value for this hint is an array, `java.lang.Object[9]`, which contains the state for which the content changed (a `java.lang.Integer`) and the old content (a `java.lang.Object`) for all 8 states.

  See Also:
    Constant Field Values

### STATE_CHANGE

    public static final int STATE_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the interaction state has changed. The value for this hint is a `java.lang.Integer` which has the value of the old state.

  See Also:
    Constant Field Values

### CARET_POSITION_CHANGE

    public static final int CARET_POSITION_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the caret position has changed. The value for this hint is a `java.lang.Integer` which has the value of the old caret position.

  See Also:
    Constant Field Values

### ECHO_CHAR_CHANGE

    public static final int ECHO_CHAR_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the echo character has changed. The value for this hint is a `java.lang.Character` which has the value of the old echo character.

  See Also:
    Constant Field Values

### EDIT_MODE_CHANGE

    public static final int EDIT_MODE_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the editing mode, adjustment mode or selection mode of the widget has changed. The value for this hint is a `java.lang.Boolean` which has the value of the old mode.

  See Also:
    Constant Field Values

### MIN_MAX_CHANGE

    public static final int MIN_MAX_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the range of an `HAdjustmentValue` component has changed. The value for this hint is an array, `java.lang.Object[2]`, which contains the old minimum and maximum extents of the range as `java.lang.Integer`.

  See Also:
    Constant Field Values

### THUMB_OFFSETS_CHANGE

    public static final int THUMB_OFFSETS_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the thumb offsets of an `HAdjustmentValue` component have changed. The value for this hint is an array, `java.lang.Object[2]`, which contains the old minimum and maximum thumb offsets as `java.lang.Integer`.

  See Also:
    Constant Field Values

### ADJUSTMENT_VALUE_CHANGE

    public static final int ADJUSTMENT_VALUE_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the value of an `HAdjustmentValue` component has changed. The value for this hint is a `java.lang.Integer` which contains the old index.

  See Also:
    Constant Field Values

### ORIENTATION_CHANGE

    public static final int ORIENTATION_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the orientation of an `HOrientable` component has changed. The value for this hint is a `java.lang.Integer` which has the value of the old orientation.

  See Also:
    Constant Field Values

### TEXT_VALUE_CHANGE

    public static final int TEXT_VALUE_CHANGE

  Deprecated. This constant shall not be used for the hinting mechanism. Looks shall treat it as `UNKNOWN_CHANGE`. See also `CARET_POSITION_CHANGE` and `TEXT_CONTENT_CHANGE`.
  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the value of an `HTextValue` component has changed. The value for this hint is a `java.lang.Integer` which contains the old value.

  See Also:
    Constant Field Values

### ITEM_VALUE_CHANGE

    public static final int ITEM_VALUE_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the value of an `HItemValue` component has changed. The value for this hint is a `java.lang.Integer` which contains the old value.

  See Also:
    Constant Field Values

### LIST_CONTENT_CHANGE

    public static final int LIST_CONTENT_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the content of an `HListGroup` component has changed. The value for this hint is a `java.lang.Integer` which contains the old content.

  See Also:
    Constant Field Values

### LIST_ICONSIZE_CHANGE

    public static final int LIST_ICONSIZE_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the iconsize of an `HListGroup` component has changed. The value for this hint is a `java.lang.Integer` which contains the old size.

  See Also:
    Constant Field Values

### LIST_LABELSIZE_CHANGE

    public static final int LIST_LABELSIZE_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the labelsize of an `HListGroup` component has changed. The value for this hint is a `java.lang.Integer` which contains the old size.

  See Also:
    Constant Field Values

### LIST_MULTISELECTION_CHANGE

    public static final int LIST_MULTISELECTION_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the multiselection setting of an `HListGroup` component has changed. The value for this hint is a `java.lang.Integer` which contains the old setting.

  See Also:
    Constant Field Values

### LIST_SCROLLPOSITION_CHANGE

    public static final int LIST_SCROLLPOSITION_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the scrollposition of an `HListGroup` component has changed. The value for this hint is a `java.lang.Integer` which contains the old position.

  See Also:
    Constant Field Values

### SIZE_CHANGE

    public static final int SIZE_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the size of an `HVisible` component has changed. The value for this hint is a `java.lang.Dimension` which contains the old size.

  See Also:
    Constant Field Values

### BORDER_CHANGE

    public static final int BORDER_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the border mode has changed. The value for this hint is a `java.lang.Boolean` which has the value of the old border mode.

  See Also:
    Constant Field Values

### REPEAT_COUNT_CHANGE

    public static final int REPEAT_COUNT_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that `HAnimateEffect.setRepeatCount(int)` was called. Note that this hint is also used, when the actual value has not changed. This is to notify a reset of an internal counter. The value for this hint is a `java.lang.Integer` which has the value of the old repeat count.

  See Also:
    Constant Field Values

### ANIMATION_POSITION_CHANGE

    public static final int ANIMATION_POSITION_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the value of an `HStaticAnimation` component has changed. The value for this hint is a `java.lang.Integer` which contains the old value.

  See Also:
    Constant Field Values

### LIST_SELECTION_CHANGE

    public static final int LIST_SELECTION_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that the selection in `HListGroup` was changed. The value for this hint is an `HListElement`[] or `null` for the old selection.

  See Also:
    Constant Field Values

### UNKNOWN_CHANGE

    public static final int UNKNOWN_CHANGE

  A constant for use with the hinting mechanism (see the `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` method in `HLook`). This hint indicates that some unspecified change has occurred. The value for this hint is a `java.lang.Integer` which also has the value UNKNOWN_CHANGE.

  See Also:
    Constant Field Values

### LAST_CHANGE

    public static final int LAST_CHANGE

  A constant which indicates the last defined value for use with the hinting mechanism.

  See Also:
    Constant Field Values

### NO_DEFAULT_WIDTH

    public static final int NO_DEFAULT_WIDTH

  A constant for use with the `setDefaultSize(java.awt.Dimension)` and `getDefaultSize()` methods of `HVisible` which indicates that no default width is desired for the `HVisible`.

  See Also:
    Constant Field Values

### NO_DEFAULT_HEIGHT

    public static final int NO_DEFAULT_HEIGHT

  A constant for use with the `setDefaultSize(java.awt.Dimension)` and `getDefaultSize()` methods of `HVisible` which indicates that no default height is desired for the `HVisible`.

  See Also:
    Constant Field Values

### NO_DEFAULT_SIZE

    public static final Dimension NO_DEFAULT_SIZE

  A constant for use with the `setDefaultSize(java.awt.Dimension)` and `getDefaultSize()` methods of `HVisible` which indicates that no default size is desired for the `HVisible`.

  The contents of the Dimension object cannot be relied upon. Comparisons must always be done using object identity, i.e. using the "==" operator.

Constructor Detail

### HVisible

    public HVisible()

  Creates an `HVisible` component with no `HLook`. See the class description for details of constructor parameters and default values.

### HVisible

    public HVisible(HLook hlook)

  Creates an `HVisible` component with the given `HLook`. See the class description for details of constructor parameters and default values.

  Applications shall not use `HLook`s with this constructor unless those `HLook`s are specified as working with HVisible. If an `HLook` is used which is specified as only working with specific sub-classes of `HVisible` then the failure mode is implementation dependent.

  Parameters:
    `hlook` - The `HLook` associated with the `HVisible` component.

### HVisible

    public HVisible(HLook hlook,
                    int x,
                    int y,
                    int width,
                    int height)

  Creates an `HVisible` component with the given `HLook` and the specified location and size. See the class description for details of constructor parameters and default values.

  Parameters:
    `hlook` - The `HLook` associated with the `HVisible` component.
    `x` - the x-coordinate of the `HVisible` component within its Container.
    `y` - the y-coordinate of the `HVisible` component within its Container.
    `width` - the width of the `HVisible` component in pixels.
    `height` - the height of the `HVisible` component in pixels.

Method Detail

### isFocusTraversable

    public boolean isFocusTraversable()

  By default an `HVisible` component is not focus-traversable.

  Overrides:
    `isFocusTraversable` in class `Component`
  Returns:
    false
  See Also:
    `Component.isFocusTraversable()`

### paint

    public void paint(Graphics g)

  Draws the current state of the component, by calling the `HLook.showLook(java.awt.Graphics, org.havi.ui.HVisible, int)` method of the associated `HLook`. If no `HLook` is associated with the component, (i.e. the `HVisible` was created with a null `HLook` or the look has been set to null using `setLook(org.havi.ui.HLook)`) then the paint method should do nothing. This mechanism may be used for components that wish to extend `HVisible`, and override the paint method, without supporting the `HLook` interface.

  Overrides:
    `paint` in class `Component`
  Parameters:
    `g` - the graphics context to use for painting.
  See Also:
    `Component.update(java.awt.Graphics)`

### update

    public void update(Graphics g)

  The update() method in `HVisible` overrides that in Component and does not clear the background of the component, it simply modifies the current Color of the Graphics object to match that of the components background Color, and calls the paint() method.

  Overrides:
    `update` in class `Component`
  Parameters:
    `g` - the graphics context to use for updating.
  See Also:
    `Component.paint(java.awt.Graphics)`, `Component.repaint()`

### setTextContent

    public void setTextContent(String string,
                               int state)

  Sets a single piece of text content for this component, per state. Different (single pieces of) content can be associated with the different states of a component.

  If the `HVisible` has an associated `HLook`, then it should repaint itself.

  Parameters:
    `string` - The content. If the content is null, then any currently assigned content shall be removed for the specified state.
    `state` - The state of the component for which this content should be displayed. Note that content is set on the `XXX_STATE` constants defined in `HState`, and not on the `XXX_STATE_BIT` constants. A `java.lang.IllegalArgumentException` will be thrown if a `STATE_BIT` rather than a `STATE` is passed.

### setGraphicContent

    public void setGraphicContent(Image image,
                                  int state)

  Sets a single piece of graphical content for this component, per state. Different (single pieces of) content can be associated with the different states of a component.

  Note that the content is not copied, merely its object reference.

  If the `HVisible` has an associated `HLook`, then it should repaint itself.

  Parameters:
    `image` - The content. If the content is null, then any currently assigned content shall be removed for the specified state.
    `state` - The state of the component for which this content should be displayed. Note that content is set on the `XXX_STATE` constants defined in `HState`, and not on the `XXX_STATE_BIT` constants. A `java.lang.IllegalArgumentException` will be thrown if a `STATE_BIT` rather than a `STATE` is passed.

### setAnimateContent

    public void setAnimateContent(Image[] imageArray,
                                  int state)

  Sets an array of graphical content (primarily used for animation), per state. Different (single arrays of) content can be associated with the different states of a component.

  Note that the content is not copied, merely its object reference.

  If the `HVisible` has an associated `HLook`, then it should repaint itself.

  Parameters:
    `imageArray` - An array of images that make up the animation. If the array is null, then any currently assigned content shall be removed for the specified state.
    `state` - The state of the component for which this content should be displayed. Note that content is set on the `XXX_STATE` constants defined in `HState`, and not on the `XXX_STATE_BIT` constants. A `java.lang.IllegalArgumentException` will be thrown if a `STATE_BIT` rather than a `STATE` is passed.

### setContent

    public void setContent(Object object,
                           int state)

  Sets a single piece of content for this component, per state. Different (single pieces of) content can be associated with the different states of a component.

  Note that the content is not copied, merely its object reference.

  If the `HVisible` has an associated `HLook`, then it should repaint itself.

  Parameters:
    `object` - The content. If the content is null, then any currently assigned content shall be removed for the specified state.
    `state` - The state of the component for which this content should be displayed. Note that content is set on the `XXX_STATE` constants defined in `HState`, and not on the `XXX_STATE_BIT` constants. A `java.lang.IllegalArgumentException` will be thrown if a `STATE_BIT` rather than a `STATE` is passed.

### getTextContent

    public String getTextContent(int state)

  Gets the text content for this component.

  Parameters:
    `state` - The state for which content is to be retrieved. Note that content is set on the `XXX_STATE` constants defined in `HState`, and not on the `XXX_STATE_BIT` constants. A `java.lang.IllegalArgumentException` will be thrown if a `STATE_BIT` rather than a `STATE` is passed.
  Returns:
    The text content associated with the specified state. If no text content has been set for the specified state, then `null` is returned.

### getGraphicContent

    public Image getGraphicContent(int state)

  Gets the graphic content for this component.

  Parameters:
    `state` - The state for which content is to be retrieved. Note that content is set on the `XXX_STATE` constants defined in `HState`, and not on the `XXX_STATE_BIT` constants. A `java.lang.IllegalArgumentException` will be thrown if a `STATE_BIT` rather than a `STATE` is passed.
  Returns:
    The graphical content associated with the specified state. If no graphical content has been set for the specified state, then `null` is returned.

### getAnimateContent

    public Image[] getAnimateContent(int state)

  Gets the animate content for this component.

  Parameters:
    `state` - The state for which content is to be retrieved. Note that content is set on the `XXX_STATE` constants defined in `HState`, and not on the `XXX_STATE_BIT` constants. A `java.lang.IllegalArgumentException` will be thrown if a `STATE_BIT` rather than a `STATE` is passed.
  Returns:
    The animate content associated with the specified state. If no animate content has been set for the specified state, then `null` is returned.

### getContent

    public Object getContent(int state)

  Gets the content for this component.

  Parameters:
    `state` - The state for which content is to be retrieved. Note that content is set on the `XXX_STATE` constants defined in `HState`, and not on the `XXX_STATE_BIT` constants. A `java.lang.IllegalArgumentException` will be thrown if a `STATE_BIT` rather than a `STATE` is passed.
  Returns:
    The content associated with the specified state. If no content has been set for the specified state, then `null` is returned.

### setLook

    public void setLook(HLook hlook)
                 throws HInvalidLookException

  Sets the `HLook` for this component.

  Parameters:
    `hlook` - The `HLook` that is to be used for this component. Note that this parameter may be null, in which case the component will not draw itself until a look is set.
  Throws:
    `HInvalidLookException` - If the Look is not compatible with this type of component, for example a graphic look being set on a text component, an HInvalidLookException is thrown. Note that HVisible itself will never throw this exception, but it may be thrown by a subclass which has overridden this method.

### getLook

    public HLook getLook()

  Gets the `HLook` for this component.

  Returns:
    the `HLook` that is being used by this component - if no `HLook` has been set, then returns null.

### getPreferredSize

    public Dimension getPreferredSize()

  Gets the preferred size of the `HVisible`. The getPreferredSize method of the `HLook` that is associated with this `HVisible` will be called to calculate the dimensions.

  Overrides:
    `getPreferredSize` in class `Component`
  Returns:
    A dimension object indicating this `HVisible`'s preferred size - if no `HLook` has been associated with the `HVisible`, then the current `HVisible` dimensions as determined with `getSize` will be returned.
  See Also:
    `HLook.getPreferredSize(org.havi.ui.HVisible)`

### getMaximumSize

    public Dimension getMaximumSize()

  Gets the maximum size of the `HVisible`. The getMaximumSize method of the `HLook` that is associated with this `HVisible` will be called to calculate the dimensions.

  Overrides:
    `getMaximumSize` in class `Component`
  Returns:
    A dimension object indicating this `HVisible`'s maximum size - if no `HLook` has been associated with the `HVisible`, then the current `HVisible` dimensions as determined with `getSize` will be returned.
  See Also:
    `HLook.getMaximumSize(org.havi.ui.HVisible)`

### getMinimumSize

    public Dimension getMinimumSize()

  Gets the minimum size of the `HVisible`. The getMinimumSize method of the `HLook` that is associated with this `HVisible` will be called to calculate the dimensions.

  Overrides:
    `getMinimumSize` in class `Component`
  Returns:
    A dimension object indicating this `HVisible`'s minimum size - if no `HLook` has been associated with the `HVisible`, then the current `HVisible` dimensions as determined with `getSize` will be returned.
  See Also:
    `HLook.getMinimumSize(org.havi.ui.HVisible)`

### getInteractionState

    public int getInteractionState()

  Return the interaction state the component is currently in.

  Returns:
    the interaction state the component is currently in.
  See Also:
    `HState`

### setTextLayoutManager

    public void setTextLayoutManager(HTextLayoutManager manager)

  Sets the text layout manager that should be used to layout the text for this component.

  Parameters:
    `manager` - the `HTextLayoutManager` to be used by this component.

### getTextLayoutManager

    public HTextLayoutManager getTextLayoutManager()

  Gets the text layout manager that is being used to layout this text.

  Returns:
    The `HTextLayoutManager` that is being used by this component.

### getBackgroundMode

    public int getBackgroundMode()

  Get the background mode of this `HVisible`. The return value specifies how the look should draw the background (i.e. a rectangle filling the bounds of the `HVisible`).

  Returns:
    one of `NO_BACKGROUND_FILL` or `BACKGROUND_FILL`.

### setBackgroundMode

    public void setBackgroundMode(int mode)

  Set the background drawing mode. The value specifies how the look should draw the background (i.e. a rectangle filling the bounds of the `HVisible`).

  Parameters:
    `mode` - one of `NO_BACKGROUND_FILL` or `BACKGROUND_FILL`

### isOpaque

    public boolean isOpaque()

  Returns true if the entire `HVisible` area, as given by the java.awt.Component#getBounds method, is fully opaque, i.e. its `HLook` guarantees that all pixels are painted in an opaque Color.

  This method will call the `HLook.isOpaque(org.havi.ui.HVisible)` method of an associated `HLook` if one is set. If no HLook is associated this method returns false.

  The default return value is implementation specific and depends on the background painting mode of the given `HVisible`. The consequences of an invalid overridden value are implementation specific.

  Specified by:
    `isOpaque` in interface `TestOpacity`
  Overrides:
    `isOpaque` in class `HComponent`
  Returns:
    true if all the pixels with the java.awt.Component#getBounds method are fully opaque, i.e. its associated `HLook` guarantees that all pixels are painted in an opaque Color.
  See Also:
    `Component.isLightweight()`

### setDefaultSize

    public void setDefaultSize(Dimension defaultSize)

  Set the preferred default size for this component when a layout manager is in use.

  Note that the size set with this method is not a guaranteed size; if set it will be passed to the layout manager through the `HLook.getPreferredSize(org.havi.ui.HVisible)` method. The default size of a component is to be interpreted as the area in which the component can be rendered, excluding look-specific borders.

  Valid arguments include `NO_DEFAULT_SIZE`, and Dimensions containing `NO_DEFAULT_WIDTH` or `NO_DEFAULT_HEIGHT`.

  Parameters:
    `defaultSize` - specifies the default preferred size. If this parameter is null a `java.lang.NullPointerException` will be thrown.

    If this parameter specifies a size smaller than an implementation-defined minimum size, the preferred size of this component shall be set to that implementation-defined minimum size.

### getDefaultSize

    public Dimension getDefaultSize()

  Returns the default preferred size to be used for this component when a layout manager is in use. If no default size has been set using the `setDefaultSize(java.awt.Dimension)` method `NO_DEFAULT_SIZE` is returned.

  If the parent Container into which the HVisible is placed has no layout manager the default preferred size has no effect.

  The default size of a component is to be interpreted as the area in which the component can be rendered, excluding look-specific borders.

  Returns:
    the default preferred size to be used for this component when a layout manager is in use.

### getLookData

    public Object getLookData(Object key)

  Retrieve a look-specific private data object. Instances of `HLook` may use this method to retrieve private data (e.g. layout hints, cached images etc.) from the HVisible. Use of this mechanism is an implementation option. If this mechanism is not used by an implementation, or no data has been set for the specified key this method returns `null`.

  Parameters:
    `key` - an object which uniquely identifies the type of look for which the private data is to be retrieved. Keys need not be unique across different instances of the same look class.
  Returns:
    a private data object as previously set using `setLookData(java.lang.Object, java.lang.Object)`, or `null`.
  See Also:
    `HLook`, `setLookData(java.lang.Object, java.lang.Object)`

### setLookData

    public void setLookData(Object key,
                            Object data)

  Set a look-specific private data object. Instances of `HLook` may use this method to set private data (e.g. layout hints, cached images etc.) on the HVisible. Use of this mechanism is an implementation option. If this mechanism is not used by an implementation, this method will have no effect and calls to `getLookData(java.lang.Object)` shall return `null`. If for this specified key a data object has been set,the old data object shall be replaced with the new one.

  Parameters:
    `key` - an object which uniquely identifies the type of look for which the private data is to be retrieved. Keys need not be unique across different instances of the same look class.
    `data` - a private data object, or null to remove any current object set on this HVisible.
  See Also:
    `HLook`, `getLookData(java.lang.Object)`

### setHorizontalAlignment

    public void setHorizontalAlignment(int halign)

  Set the horizontal alignment of any state-based content rendered by an associated `HLook`. If content is not used in the rendering of this HVisible calls to this method shall change the current alignment mode, but this will not affect the rendered representation.

  Parameters:
    `halign` - the new horizontal alignment mode, one of `HALIGN_LEFT`, `HALIGN_CENTER`, `HALIGN_RIGHT` or `HALIGN_JUSTIFY`.

### setVerticalAlignment

    public void setVerticalAlignment(int valign)

  Set the vertical alignment of any state-based content rendered by an associated `HLook`. If content is not used in the rendering of this HVisible calls to this method shall change the current alignment mode, but this will not affect the rendered representation.

  Parameters:
    `valign` - the new vertical alignment mode, one of `VALIGN_TOP`, `VALIGN_CENTER`, `VALIGN_BOTTOM` or `VALIGN_JUSTIFY`.

### getHorizontalAlignment

    public int getHorizontalAlignment()

  Get the horizontal alignment of any state-based content rendered by an associated `HLook`. If content is not used in the rendering of this HVisible the value returned shall be valid, but has no affect on the rendered representation.

  Returns:
    the current horizontal alignment mode, one of `HALIGN_LEFT`, `HALIGN_CENTER`, `HALIGN_RIGHT` or `HALIGN_JUSTIFY`.

### getVerticalAlignment

    public int getVerticalAlignment()

  Get the vertical alignment of any state-based content rendered by an associated `HLook`. If content is not used in the rendering of this HVisible the value returned shall be valid, but has no affect on the rendered representation.

  Returns:
    the current vertical alignment mode, one of `VALIGN_TOP`, `VALIGN_CENTER`, `VALIGN_BOTTOM` or `VALIGN_JUSTIFY`.

### setResizeMode

    public void setResizeMode(int resize)

  Set the resize mode of this `HVisible`. If the associated `HLook` does not render content or if scaling is not supported, changing the mode may have no visible effect.

  Parameters:
    `resize` - the new scaling mode, one of `RESIZE_NONE`, `RESIZE_PRESERVE_ASPECT` or `RESIZE_ARBITRARY`

### getResizeMode

    public int getResizeMode()

  Get the scaling mode for scaling any state-based content rendered by an associated `HLook`. If content is not used in the rendering of this HVisible the value returned shall be valid, but has no affect on the rendered representation.

  Returns:
    the current scaling mode, one of `RESIZE_NONE`, `RESIZE_PRESERVE_ASPECT` or `RESIZE_ARBITRARY`

### setEnabled

    public void setEnabled(boolean b)

  Modifies the `HState` of this `HVisible` by calling setInteractionState, depending on the value of b. This method should invoke the superclass method.

  Overrides:
    `setEnabled` in class `HComponent`
  Parameters:
    `b` - If true, this `HVisible` is enabled; otherwise this `HVisible` is disabled.
  See Also:
    `Component.isEnabled()`, `Component.isLightweight()`

### setBordersEnabled

    public void setBordersEnabled(boolean enable)

  The method en- or disables rendering of platform-specific borders. If `enable` is `true`, the associated `HLook` may render borders, if supported. If the specified parameter is `false`, no borders will be rendered and the whole area is available to the content Additionally, all values of the insets objects returned by `HLook.getInsets(org.havi.ui.HVisible)` will be zero.

  The setting shall only be used by `HAnimateLook`, `HGraphicLook` and `HTextLook`. Only for these looks shall `HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[])` with `BORDER_CHANGE` be called. All other looks shall ignore this value and the method shall not be called. The behavior of third party looks is not defined. The default value is `true`.

  Parameters:
    `enable` - the new border mode to enable or disable border rendering
  See Also:
    `getBordersEnabled()`

### getBordersEnabled

    public boolean getBordersEnabled()

  Returns the current border mode. Applications should rather call `HLook.getInsets(org.havi.ui.HVisible)` to find out, if any borders are rendered.

  Returns:
    the current border mode
  See Also:
    `setBordersEnabled(boolean)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD