Using Java API to subclass an object library using JAVA (without opening the FMB)

This java code simulate 'Drag and Drop' of an object group from and object library to a form to enhance object reuse.

mohammad abu-sheera from REALSOFT helped me in this code as well.

package mypackage;


import oracle.forms.jdapi.FormModule;

import oracle.forms.jdapi.Jdapi;

import oracle.forms.jdapi.JdapiIterator;

import oracle.forms.jdapi.ObjectGroup;

import oracle.forms.jdapi.ObjectLibrary;

import oracle.forms.jdapi.ObjectLibraryTab;


public class attach_it {

    public static void main(String[] args) {



        FormModule frm ="c:\\ammar.fmb");  -- This is form you want to subclass the object library to


        ObjectLibrary objlib ="c:\\ammar.olb"); -- this is the object library that contains the Object Group

        JdapiIterator tabs = objlib.getObjectLibraryTabs();   --  find the Tabs within the object library

        while (tabs.hasNext()){

             ObjectLibraryTab otabs = (ObjectLibraryTab);      


 --   The Tab contains only object libraries and therefore, type casting is of type

--  object library.  you could use other types or the general jdapiObject


                 JdapiIterator  tabobj = otabs.getTabObjects();

                 while (tabobj.hasNext()) {

                 ObjectGroup myobj = (ObjectGroup);

-- This create an Object Group in ammar.fmb and calls it OBJ_GRP.  The object group shall inherit all the properties within  myobj ObjectGroup

                            ObjectGroup newobj2 =   new ObjectGroup(frm, "OBJ_GRG", myobj); 







            // finally, free API resources






Oracle Tips home


Ammar Sajdi