Overblog Suivre ce blog
Editer l'article Administration Créer mon blog
21 décembre 2007 5 21 /12 /décembre /2007 13:14


Here is a Java bean that allows to choose a date from a Java swing calendar.

The Java calendar itself is from Kai Toedter - Released under GNU Lesser General Public License - www.toedter.com

It needs the Sun Java plugin to run (won't run with JInitiator).

(the JInitiator 1.3.28 compatible version is downlodable at the end of the article)


Just double-click a day in the calendar to send an event to Forms with the date parameters.

The Java code


The implementation class of the Bean Item


The properties you can set

Set some properties

Set_Custom_Property('BL.BEAN', 1, 'SET_PROPERTY', 'property_name,property_value');

property_name can be one of the following:

  • title : set the frame title
  • background : set the background color
  • foreground : set the foreground color
  • decorationforeground : set the decoration foreground color (Sun plugin only)
  • sundayforeground : set the sunday foreground color (Sun plugin only)
  • weekdayforeground : set the week day foreground color (Sun plugin only)
  • date : set the starting date (year,month,day) (Sun plugin only)
  • locale : set a new Locale
  • plasticLAF : set the PlasticLAF Look & Feel
  • log : set the trace to the Java console (true | false)

colors are sent with the following format : rXgXbX where x must be between 0 and 255

e.g. :
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','plasticLAF,true');
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','log,true');
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','title,Choose...');
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','locale,US');
Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','foreground,r128g50b50');

Set_Custom_Property('BL.BEAN',1, 'SET_PROPERTY','date,2007,12,25');

Show the calendar

Set_Custom_Property('BL.BEAN', 1, 'SHOW_CALENDAR', '[x_position,y_position]');



If x_position and y_position are given, the calendar will be shown at this position (top-left corner).

-- show calendar --
Set_Custom_Property('BL.BEAN',1, 'SHOW_CALENDAR','');

-- show calendar at position 50,50 --
Set_Custom_Property('BL.BEAN',1, 'SHOW_CALENDAR','50,50');


The event received from the Bean


this event tells Forms that a date has been chosen in the calendar.
You can get it in a WHEN-CUSTOM-ITEM-EVENT event:

    eventName varchar2(30) := :system.custom_item_event;
    eventValues ParamList;
    eventValueType number;
    LC$Date   varchar2(256); -- complete date
    LC$Day    varchar2(256); -- day number (1-31)
    LC$Month  varchar2(256); -- month number (1-12)
    LC$Year   varchar2(256); -- year number
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'CALENDAR_EVENT_DATE',eventValueType, LC$Date);
      get_parameter_attr(eventValues,'CALENDAR_EVENT_DAY',eventValueType, LC$Day);
      get_parameter_attr(eventValues,'CALENDAR_EVENT_MONTH',eventValueType, LC$Month);
      get_parameter_attr(eventValues,'CALENDAR_EVENT_YEAR',eventValueType, LC$Year);
      Message('Selected date:'|| LC$Date || '(' || LC$Day||'/'||LC$Month||'/'||LC$Year || ')');
      Synchronize ;           
   END IF;  

The sample dialog

     . Download the JCalendar.zip file
     . Unzip the file
     . copy the FJCalendar.jar, jcalendar-1.3.2.jar and looks-2.0.1.jar files in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add these 3 JAR files
     . Open the JCALENDAR.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module

     the FJCalendar.jar file must be signed.
     the jar file provided in this article is already signed.

Jinitiator 1.3.28 compatible version

     . Download the JCalendarJinit.zip file
     . Unzip the file
     . copy the JCalendarJinit.jar and jcalendar.jar files in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add these 2 JAR files

     . The Implementation Class property must be : oracle.forms.fd.JCalendarJinit

Partager cet article

Repost 0
Published by Oracle Forms community - dans Bean - general
commenter cet article


Mark Hurd 04/04/2017 08:59

This short article posted only at the web site is truly good.

Michael 29/03/2016 23:05

I am having trouble running this in Netbeans, how do i do this? Any help would be greatly appreciated.

pervej 24/08/2015 15:38

nedd class file of JCalendar.java
file.when i compile it is giving error.i am using xp os and java 1.6

SIjo 31/10/2015 08:33

I also need class file of Jcalendar.java
forms date clicked shows calendar but on java date nothing happens no calendar is seen

Miguel 20/12/2010 16:13

So far I have no problem with java-plugin version. I use https and your Roguelle signed FJCalendar.jar. No problem.

The only problem I have is the Jinit version. Do I have to change the implementation version in the form to execute the proper containter Jacalendar_Jinit?


Oracle Forms community 20/12/2010 18:50

As it is indicated at the end of the article, the Implementation Class for the JInitiator version is : oracle.forms.fd.JCalendarJinit

Miguel Morales 18/12/2010 01:11

If the article says the FJCalendar.jar is already signed, I will still need to resign it?  Not certain of that ultimate step.



Oracle Forms community 18/12/2010 08:44

You need to re-sign it only if you already have other signed JARs in the same archive tag, so that you do not mix different signatures.