Overblog Suivre ce blog
Editer l'article Administration Créer mon blog
26 janvier 2007 5 26 /01 /janvier /2007 19:44

Here is a Swing JButton that overloads a standard PJC's button.
It needs the JRE 1.4 (Sun Java Plug-in)

     Swing button

It allows to have a standard Forms button with some nice decoration features.

You can apply a gradient color, set rounded borders, justify the label and also have a shadow behind the label.
Because it is firstly a PJC, you can set most of the common properties with the Set_Item_Property() built-in (label, position, foreground color, background color, etc...).

The gradient feature is part of the JRE 1.4 so this bean need the Sun Java plug-in to run.


The Java code

     SwingButton.java      CButton.java

The implementation class of the Button item


The methods you can call


  • Set the gradient parameter

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_GRADIENT_COLOR', '255,255,0,255,0,0');

    It takes two RGB colors, the starting color then the ending color.

  • Set the label's shadow color

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_SHADOW_COLOR', 'r,g,b');

    On the screenshot, you can see a white shadow behind the label.

  • Set the buttons's border color

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_BORDER_COLOR', 'r,g,b');

  • Set the gradient direction

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_GRADIENT_DIR', 'direction');

    Where direction can take one of the following value:

      1 : left to right
      2 : right to left
      3 : up to down (like the screen-shot)
      4 : down to up

  • Set the text position

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_TEXT_POSITION', 'left | center | right' ) ;

  • Set the image position

    Set_Custom_Property('BL.SWINGBUTTON', 1, 'SET_IMAGE_POSITION', 'HV' );

    Where H can be:
    Left, Center, Right

    and V can be:
    Top, Middle, Bottom



  • Set the current image name

    Set_Custom_Property('BL.SWINGBUTTON', 1, 'SET_IMAGE', 'image_name[,position]');

    position is facultative and by default CM (Center Middle)

    image_name can be a url (http://...) a client machine file (d:/...) or a JAR file.

  • Set the mouse ON image (that appears when the mouse enters the button)

    Set_Custom_Property('BL.SWINGBUTTON', 1, 'SET_IMAGE_ON', 'image_name' ) ;

  • Set the rounded setting

    Set_Custom_Property( 'BL.SWINGBUTTON', 1, 'SET_ROUNDED', 'horizontal diameter,vertical diameter' ) ;

The sample dialog

   . Download the swingbutton.zip file
   . Unzip the files
   . copy the swingbutton.jar file in the /forms/java directory
   . Edit your /forms/server/formsweb.cfg file to add the jar file
   . Open the SWINGBUTTON.fmb module (Oracle Forms 9.0.2)
   . Compile all and run the module

   The swingbutton.jar file have to be signed.
   The swingbutton.jar file provided with the article is already signed.

Partager cet article

Repost 0
Published by Oracle Forms community - dans PJC - Buttons
commenter cet article


forms12c_hacker 12/04/2017 16:12

FRM-40007 in 12c on a variation of one of these type of buttons I used from here.

forms12c_hacker 14/04/2017 15:37

Update: we found some obscure patch that fixed a lot of issues including this one with disconnects (ora-03114, frm-40007, frm-41352). stupid oracle. everything is working great again. Next up - using this stuff with JWS!

Nava Topper 01/11/2007 08:09

I dont know where to add the jar in the formsweb.cfg, please advise.Thnaks

Oracle Forms community 02/11/2007 09:41

Add the jar filename to the archive and archive_jini tags.

Kazem 14/05/2007 07:59

  I think this PJC is great and adds a very good Look to the buttons and the form in general.
   But I am facing one problem and I don't know there is a solution for it, when I try to set visible to false for the button (SET_ITEM_PROPERY('MY_BUTTON_NAME',visible,property_false)), the button keeps showing on the canvas!! Is there any reason for this? and any solution?

Oracle Forms community 14/05/2007 20:15

I have corrected the bean and put the new JAR file in the zip. You can so re-download the zip file.Francois