Frequently Asked Questions


Q:  Is it possible to add parameters to the VisualMust generated constructors ?
A:  Yes it is, if you stay compatible with the Java classes. Remember that some classes, such as applets or beans, should have a constructor without parameters.

/**
 * Constructor: MyApplicationName
 * @param java.lang.String[] args the command line arguments
 * @return instance of MyApplicationName
 */
public MyApplicationName(java.lang.String[] args)
   {
    super();
    /* Remove this comment and specialize processing here. */
   } /* End of Constructor: MyApplicationName */

Q:  What is the best location to initialize components for my application ?
A:  The best location is within your application constructor, after the super() method. You may have access to each component using the get_<BeanName> method.

/**
 * Constructor: MyApplicationName
 * @return instance of MyApplicationName
 */
public MyApplicationName()
   {
    super();
    /* Remove this comment and specialize processing here. */
   } /* End of Constructor: MyApplicationName */

Q:  How could I overload methods for a component without creating a bean ?
A:  First, you should overload the createInstance_<BeanName>() method.
Then, you will be able to create your own instance. The following example shows how to overload the getToolTipText() method.

/**
 * Method: createInstance_MyLabel <br>
 * @param None
 * @return Instance of javax.swing.JLabel
 */
protected javax.swing.JLabel createInstance_MyLabel()
   {
    return new javax.swing.JLabel()
       {
        /**
         * Returns the tooltip string.
         */
        public String getToolTipText()
           {
            return new java.util.Date().toString();
           }
       };
   } /* End of Method: createInstance_MyLabel */

Q:  What is the best way to set one's own table model ?
A: The init_<BeanName>() method, generated in the Abstract.java file, is quite candidate to be overloaded by your application source code.

/**
 * Method: init_MyTable  <br>
 * @param Instance of javax.swing.JTable
 * @return javax.swing.JTable
 */
protected javax.swing.JTable init_MyTable(javax.swing.JTable self)
   {
    self.setModel(new MyDefaultTableModel());
    super.init_MyTable(self);
    return self;
   } /* End of Method: init_MyTable */

Q:  A pool of objects, what for ?
A:  You may have to share reusable objects between several developers or several applications. In this case, you may put them into an ODB file. Let's take the example of creating an ODB named "Utilities" : if this ODB contains a logo window and several popup menus that might be used in several applications, you may have access to these components (from another application) by using the following code :

    Utilities utilities = new Utilities();
    ...
    utilities.get_MyLogo().show();
    utilities.get_MyPopupMenu().show(invoker,x,y);

Note that both components MyLogo and MyPopupMenu will be created only if they are used.