Class GlassTutorial

java.lang.Object
com.codename1.ui.util.GlassTutorial
All Implemented Interfaces:
Painter

public class GlassTutorial extends Object implements Painter

A Glass Tutorial appears on top of the UI especially on a touch device but could be on any device and points to/circles components within the UI coupled with explanation of what they do and a tint of the screen. It is implemented as a GlassPane on top of a Form which is automatically removed when a user touches the screen or presses a button.

To position elements within the glass tutorial the elements must be associated with a component instance of the underlying UI and positioned relatively to said component.

The GlassTutorial uses the "GlassTutorial" UIID to paint itself it then paints the hint components in their proper places.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addHint(Component hintComponent, Component destinationComponent, String position)
    Places a hint within the glass in a position relative to the destinationComponent, the position is indicated with border layout attributes.
    void
    Draws inside the given rectangle clipping area.
    void
    Install the glass tutorial on a form and seamlessly dismiss it when no longer necessary

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • Constructor Details

    • GlassTutorial

      public GlassTutorial()
  • Method Details

    • addHint

      public void addHint(Component hintComponent, Component destinationComponent, String position)

      Places a hint within the glass in a position relative to the destinationComponent, the position is indicated with border layout attributes. Notice you can place multiple components on a single element and they will be rendered in order e.g. a component with a border can be used to "circle" the destination by placing it in the CENTER position and another arrow with text can be places in the south position below.

      Parameters
      • hintComponent: The component that would be renderered in the given position

      • destinationComponent: the "hinted" component over which the hint will show

      • position: @param position the position relative to the destinationComponent in BorderLayout values e.g. to place the hint above the component just place it in BorderLayout.NORTH. The center will stretch the component but the other sides will give the component its exact preferred size.

    • showOn

      public void showOn(Form f)

      Install the glass tutorial on a form and seamlessly dismiss it when no longer necessary

      Parameters
      • f: the form
    • paint

      public void paint(Graphics g, Rectangle rect)

      Draws inside the given rectangle clipping area.

      Parameters
      • g: the Graphics object

      • rect: the given rectangle cliping area

      Specified by:
      paint in interface Painter