Rollover Button Information

The Rollover Button Pluggable Java Component (PJC) provides an enhanced Forms button which has two new features.  Firstly it can simply be turned into an Oracle Look and Feel rounded button with either or both sides of the button rounded.  Secondly it can act as a web style rollover button which can contain two images, an image which is shown when the button is in a normal state and a second image which is displayed when the mouse moves over the button (or rolls over it).  This feature can be used to create active buttons which, for instance, are normally gray, but color as the user moves the mouse over them, giving better visual feedback as to where and what the user is about to click on. 

Modules In This Demo

The Rollover button demo consists of the following files (relative directories shown in brackets):

  1. rollover.fmb/fmx [forms]- The demo form
  2. RolloverButton.java [src/oracle/forms/demos/enhancedItems] - source code for the PJC class
  3. rolloverbutton.jar [classes]- the compiled and jarred java class.

The doc directory and the classes directory contain the JavaDoc for the code and the compiled classes respectively. An images directory is also supplied which contains all the images used by the standard rollovers described below.

Reusing the code

Setting up Forms Services

In order for an application to be able to use the Rollover Button PJC the relevant configuration in the formsweb.cfg file has to ensure that the supplied rolloverbutton.jar (or another jar file containing the compiled RolloverButton.class) is included in the relevant archive setting.

An entry in the formsweb.cfg file for an application that used the RolloverButton PJC  would look like this:

[Rollover]
pageTitle=OracleAS Forms Services - Rollover Button Demo
IE=jinitiator
baseHTMLJInitiator=demobasejini.html
archive_jini=frmall_jinit.jar,rolloverbutton.jar
form=rolloverforms/java
width=675
height=480
separateFrame=false
splashScreen=no
lookAndFeel=oracle
colorScheme=blue
background=/formsdemo/images/blue.gif

Using the PJC in your Form

To use the Rollover Button PJC you must first create a normal Forms button, with the Iconic property set to No, and set the Implementation Class property for this item to oracle.forms.demos.enhancedItems.RolloverButton.  Note that this property is case sensitive and must be entered exactly as shown.

Using the PJC to create Oracle Look and Feel Buttons

To create a rounded edge to the button, simply include a leading or trailing rounded bracket in the label property (you can define this at build time).  The brackets will be stripped out of the final label.  So an instance of the PJC with the label "(Press)" will create a button with both ends rounded and the label "Press".  "(Press" would create a button with just the left side rounded and the right side squared.

Using the Rollover Button Feature

To use rollover images with the PJC One of three methods can be adopted:

  1. The standard button images as used in the Forms demos are all included in the rolloverbutton.jar file.  To use one of these images simply set the Label property of the button to a value which consists of the keyword [ROLLOVER] followed by the name of the function required - e.g. exit (use lowercase).  The PJC will then automatically load the correct images for the button from the JAR file.  So in this case [ROLLOVER]exit would load the on and off images for an exit button.  No code is required in PL/SQL to set up the button.  The following function icons are defined in the JAR file. 
  2. Defining Images Declaratively - Rather than using the hard-coded images you can also explicitly define the On and OFF images in the label, using a comma to separate the pair with the ON image first and the OFF image next.  You still use the [ROLLOVER] tag to prefix the label.  The image names you use should include the path to the images (relative to the JAR or Codebase) and the extension for the image e.g. .gif
    So the declaration in the label property for an exit button might be:
    [ROLLOVER]/image_btn/exit_on.gif,/image_btn/exit_off.gif
  3. Defining Images at Runtime - The images for a button can be changed at runtime in two ways.
    1. Simply use SET_ITEM_PROPERTY(<name>, LABEL, <value>) where value is a string in one of the formats prefixed with [ROLLOVER] as above.
    2. Use SET_CUSTOM_PROPERTY with the custom properties IMAGE_NAME_ON and IMAGE_NAME_OFF to define the on and off images respectively.
      SET_CUSTOM_PROPERTY ('CONTROL.EXIT_PB', 1, 'IMAGE_NAME_ON', '/image_btn/exit_on.gif');

Custom Property Summary

Property Get Set Valid Values / Return Value Purpose
IMAGE_NAME_ON Yes Yes String Defines the name of the image that is shown when the mouse rolls over the button
IMAGE_NAME_OFF Yes Yes String Defines the image shown when the mouse is not over the button
DEBUGMESSAGES No Yes 'true' | 'false' Enables/disables debugging to the Java Console for this instance of the control.
DEBUGMESSAGES_ALL No Yes 'true' | 'false' Enables/disables debugging to the Java Console for all instances of the control.