An open-file dialog box with image preview
By francois degrelle on Friday, March 27 2015, 14:36 - PJC - Javabean - Permalink
Purpose
When you want to load images from the client machine to the database, you would like
to choose the right image file with a preview of each image.
This is a Javabean component that allows to display a JfileChooser dialog box with image preview.
It also allows to display at the same time different file types.
The java code
Get the complete code here
Forms configuration
- Copy the GetImageFileName.jar file in the /forms/java directory
- Sign the GetImageFileName.jar file with your own certificate
- Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jinit variable
Registring the bean
- Open the form
- Add a javabean component to any block
- Register the bean (be sure that it is not in a When-New-Form-Instance trigger, or use a timer)
FBean.Register_Bean('BLOCK.BEAN_ITEM',1,'oracle.forms.fd.GetImageFileName');
Invoke the bean's GetFile() function
image_file_name := FBean.Invoke_char('BLOCK.BEAN_ITEM',1,'GetFile','"Dialog box title","start directory"');
e.g.
:BL1.File := FBean.Invoke_char('BL1.IMAGEPICKER',1,'GetFile','"Select an image file name","M:\"');
The sample dialog
- Download the imagefilechooser.zip file
- Unzip the imagefilechooser.zip file
- Copy the imagefilechooser.jar file in your /forms/java/ directory
- Edit your /forms/server/formsweb.cfg file
- Open the IMAGEFILECHOOSER.fmb module (Oracle Forms 9.0.2)
- Compile all and run the module