The ColorPicker Javabean provides a swing based color selection dialog within the Forms Client. The actual integration is carried out using the Forms FBean package which registers and integrates with the JavaBean at runtime.
The JavaBean is used from the HyperLink and Ticker demos, and can be seen in the sample Forms that come with those demos
The ColorPicker demo consists of the following files (relative directories shown in brackets):
The doc directory and the classes directory contain the JavaDoc for the code and the compiled classes respectively
In order for an application to be able to use the ColorPicker JavaBean the relevant configuration in the formsweb.cfg file has to ensure that the supplied colorpicker.jar (or another jar file containing the compiled ColorPicker.class) is included in the relevant archive setting.
An entry in the formsweb.cfg file for an application that used the ColorPicker might look like this:
[ColorPicker] pageTitle=OracleAS Forms Services - ColorPicker Demo IE=jinitiator baseHTMLJInitiator=demobasejini.html archive_jini=frmall_jinit.jar,colorpicker.jar form=colorpickerforms/java width=675 height=480 separateFrame=false splashScreen=no lookAndFeel=oracle colorScheme=blue background=/formsdemo/images/blue.gif
To use the ColorPicker JavaBean you must first create a normal Forms Bean area. You do not need to set the implementation class for this field as this will all be handled at runtime by the FBean integration.
In your startup code for the form you will need to register the JavaBean with Forms to do this call the FBean.Register_Bean procedure, passing the class of the ColorPicker Bean which is oracle.forms.demos.beans.ColorPicker
FBEAN.REGISTER_BEAN('CTL.ColorPicker',1,'oracle.forms.demos.beans.ColorPicker');
The first argument to FBean.Register_Bean is the name or id of the bean area. The second parameter defines the instance of the control that you wish to set the property on, in the case of this bean you only ever need one instance of the bean so this value will be 1. The third argument is the class of the JavaBean that you are registering.
The Color Selection dialog is simply called by executing the method showColorPicker() on the Java Bean. This takes two arguments:
If the user selects a color in the dialog, the return from the showColorPicker() method will be a string, also in the format "R G B". If the user does not select a color the return value will be null.
An example call to display the dialog would be:
-- Display the picker dialog with red as the initially selected color vcColor := FBEAN.INVOKE_CHAR('CTL.ColorPicker',1,'showColorPicker','"Select color","255 0 0"');
The first argument to FBean.Invoke_Char is the name or id of the bean area in which the ColorPicker was registered. The second parameter defines the instance of the control that you wish to set the property on. The third argument is the name of the method being call ed - This value is case sensitive. The fourth value is a single string which contains the two arguments to the method as strings enclosed in double quotes and separated by a comma.