This figure shows the components of the VE. (Tomcat web hosting)

This figure shows the components of the VE. At the top left you see the selection menu for the GUI elements. Adjoining to the right is the working area, consisting of the design area and the source code editor. On the far left is the Outline View, as already known from the Java editor. At the bottom I have docked the Java Beans View to the right of the Properties View (see the Arranging Editors and Views section in Chapter 4), in order to allow for comfortable editing. You may store this arrangement as your own perspective (see the Managing Perspectives section in Chapter 4). As you can see in the Outline View (and in the source code, too), these actions have generated the methods getJFrame(), getJContentPane(), and getJLabel(). All that remains to do is to invoke the method getJFrame() from the main() method. To do so, modify the main() method in the source code area as follows: public static void main(String[] args) { HelloVE hello = new HelloVE(); javax.swing.JFrame frame = hello.getJFrame(); frame.setVisible(true); } After saving this code with Ctrl+S, you can execute this program immediately by issuing the command Run > Run As > Java Application. Beans and Bean Properties All the components available in the VE s GUI element menu are provided in the form of Java Beans. Java Beans are Java classes that follow certain coding standards. For example, a Java Bean must always have a standard constructor without any parameters. The features of such a Java Bean are described in an associated class, a BeanInfo class. The VE uses this information via introspection to display the component in an appropriate form and to generate code. Generic Beans The VE is not restricted to AWT and Swing components. In principle, any Java Bean can be placed onto the design area. You may even write your own beans, which then can be used in the VE. You can select such beans by clicking the Choose Bean button in the selection menu. Detailed information about the implementation of Java Beans is found in the book Java Beans 101 by Steams. The Java Beans View shows the hierarchy of beans used in the design area, so it is easy to keep an overview of the construction of the GUI. The Java Beans View also helps during the selection of components, for example, if a component is hidden in the design area by another component. In this case you can use the Java Beans View to select the component. Properties The properties of a bean are displayed in the Properties View and can be modified there. In the above example, the label text is not centered correctly, despite the fact that the JLabel component was placed into the Center area. The reason is that the component stretches across the whole content pane, and its 48 Chapter 3
The UK has been a member of the European Union since 1973. The attitude of the present government towards further integration is conservative, with the official opposition favoring a return of some powers and competencies to the UK.From our experience, we can recommend Cheap UK Web Hosting services.

Leave a Reply