Overblog
Suivre ce blog
Editer l'article Administration Créer mon blog
15 février 2008 5 15 /02 /février /2008 20:17

Purpose

Here is a Pluggable Java Component that allows to have non rectangular buttons.

Because it uses the Gradient features, it needs, at least the Sun java plugin 1.4
It won't run against JInitiator

You can have shapes described by polygon coordinate pairs, and also button made by a single letter, a word or even, by a complete sentence.


Amazing Button



The Java code

     amazingbutton.java



The implementation class of the Push Button Item

     oracle.forms.fd.AmazingButton


The methods you can set

Because it is a PJC that extends VButton, you can use the standard Set_Item_Property() built-in to set the standard button's properties.



Draw a circle button - SET_CIRCLE

Set_Custom_Property( 'BL.BT', 1, 'SET_CIRCLE','');

 

Draw a losange button - SET_LOSANGE

Set_Custom_Property( 'BL.BT', 1, 'SET_LOSANGE','');


 

Draw a polygon button - SET_POLYGON

Set_Custom_Property( 'BL.BT', 1, 'SET_POLYGON','x,y[,x,y[,...]]');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_POLYGON','24,0,47,34,47,58,38,58,24,37,10,58,1,58,0,33,24,1');

 

Draw a text button - SET_TEXT

Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT','text[,font_name[,font_weight[,font_size]]]');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT','The text,Tahoma,B,45');

 

 

Set the text shadow color - SET_SHADOW_COLOR

Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_SHADOW','rgb_color');

default color is grey (r160g160b160)

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_SHADOW','r129g25b222');

 

 

Set the text shadow shift - SET_SHADOW_SHIFT

Set_Custom_Property( 'BL.BT', 1, 'SET_SHADOW_SHIFT','x_shift,y_shift');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_SHADOW','-5,-4');


When no given x=4 and y=3.

If you want to hide the shadow, provide 0,0

 

  

Set the text position - SET_TEXT_POSITION

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

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_POSITION','left');

 

  

Set the text x,y position - SET_TEXT_AT

Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_AT','x_pos,y_pos');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_AT','10,10');

 

 

 

Set the gradient colors - SET_GRADIENT

Set_Custom_Property( 'BL.BT', 1, 'SET_GRADIENT','rgb_color,rgb_color');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_GRADIENT','r230g154b117,r230g78b0');


 

Set the border color - SET_BORDER_COLOR

Set_Custom_Property( 'BL.BT', 1, 'SET_BORDER_COLOR','rgb_color');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_BORDER_COLOR','r225g50b30');


 

Set the rotation angle - SET_ROTATION

Set_Custom_Property( 'BL.BT', 1, 'SET_ROTATION','angle');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_ROTATION','90');


 

Scale the shape to fit the button's size - SCALE

Set_Custom_Property( 'BL.BT', 1, 'SCALE','true | false');

If not used, the shape is scaled by default.

e.g.
-- don't scale the shape --
Set_Custom_Property( 'BL.BT', 1, 'SCALE','false');


 

Draw the button's bounding box - DRAW_BORDER

Set_Custom_Property( 'BL.BT', 1, 'DRAW_BORDER','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'DRAW_BORDER','true');


 

Draw all buttons' bounding boxes - DRAW_BORDER_ALL

Set_Custom_Property( 'BL.BT', 1, 'DRAW_BORDER_ALL','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'DRAW_BORDER_ALL','true');


 

 

Draw the shape's bounding box - DRAW_CLIP_BORDER

Set_Custom_Property( 'BL.BT', 1, 'DRAW_CLIP_BORDER','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'DRAW_CLIP_BORDER','true');


 

Draw all shapes' bounding boxes - DRAW_CLIP_BORDER_ALL

Set_Custom_Property( 'BL.BT', 1, 'DRAW_CLIP_BORDER_ALL','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'DRAW_CLIP_BORDER_ALL','true');



 

Set a bevel background - SET_RELIEF

Set_Custom_Property( 'BL.BT', 1, 'SET_RELIEF','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_RELIEF','true');



 

Set a bevel background on every button - SET_RELIEF_ALL

Set_Custom_Property( 'BL.BT', 1, 'SET_RELIEF_ALL','true | false');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_RELIEF_ALL','true');



 

 

Set the Text button shadow thickness - SET_TEXT_THICKNESS

Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_THICKNESS','horizontal_thickness,vertical_thickness');

e.g.
Set_Custom_Property( 'BL.BT', 1, 'SET_TEXT_THICKNESS','6,6');




The sample dialog


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

 

Partager cet article

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

commentaires