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 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