Creating a new Window from java source...

  • mr_reggatta

    mr_reggatta - 2006-06-28

    Hi all!
    I'm creating my personal window (i need to implement a really customized Window with many JComponent)from java source and i need to add the compiereToolbar...
    How can i do?!
    I think the solution is close to the APanel class but i can't resolve yet...
    thank U all

    • Oliver

      Oliver - 2006-06-28

      hey mr. reggatta,

      compiere brings a construct for such custom windows. These customs are called Forms (like the ones globalqss wrote on one of your other threads). They contains the usual compiere toolbar and menu but with a custom "centerpanel". Take a look at FormFrame. Thats the enclosing JFrame for your form. There's a method openForm (int AD_Form_ID) which load your form.

      Thus you have to register your form-class within Compiere. The formclass should extend CPanel. At best take a look at the default-formclasses (the ones globalqss named). There you can get a good idea of the whole thing.

      good luck,

    • mr_reggatta

      mr_reggatta - 2006-07-04

      Hi Oliver!
      I will try...i will take a look to the
      If I find somethings good, i will share it with U all ;-)
      thx U oliver

    • mr_reggatta

      mr_reggatta - 2006-07-04

      Oliver! Very Good!
      I have seen the and it was very good for me!
      I've created my own form...
      Just a question:
      I'd like to add also the compiere JToolBar, have you some ideas?
      Thanks in advance...regards!

      • Oliver

        Oliver - 2006-07-04

        good to hear...but the main issue with putting the Toolbar into a form is, that the default toolbar of every window (not form!) within compiere is relating to window-specific items, like Tabs. Forms dont have tabs unless you program these yourself. So you cant just copy the toolbar into your form.

        But you can get the toolbar as itself and adjust the actions which are taken on events (like press on the save-button). Take a look into the class org.compiere.apps.APanel

        There you'll find the toolbar :
        private JToolBar toolBar = new JToolBar();
        and the lines which initialize this one.

        You can copy these into your form including the action-methods cmd_* (i.e. private void cmd_help()). These methods you'll need to adjust to your form. The method cmd_save(...) might save your form-items then or so. the end you can't reuse the window-toolbar but you can reprogram that one for your form for sure. APanel might help to get the identical toolbar again...

        good luck,


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks