About the visual editor for Java

The visual editor for Java is a code-centric Java editor that helps you design applications that have a graphical user interface (GUI). The visual editor is based on the JavaBeans component model and supports visual construction using the Standard Widget Toolkit (SWT), the Abstract Window Toolkit (AWT), or Swing.

The visual editor is designed to work with .java source files, letting you edit the source and the design simultaneously. The visual editor does not have its own perspective. If you use the visual editor in the Java perspective, the visual editor for Java uses any customization that you have made to the position of the Tasks view, the Console view and the Outline view.

You can use the visual editor for Java to create a class using visual components, or Java beans, from a design palette. This class can be an executable application (a class with a main method) or it can be a Java bean that you intend to include in another class. To be used as a Java bean by the visual editor for Java there is no interface that must be implemented and the only requirement is that the editor knows how to instantiate the class. For most purposes this means that the class should be public and have a public null constructor. The null constructor can be explicit or implicit, although there are a few exceptions that the visual editor for Java recognizes, such as java.awt.Dialog subclasses. They are instantiated using the constructor that takes an argument of java.awt.Frame. The visual editor adds an explicit constructor that calls the initialize method, which is used to set up the initial state of the Java bean.

The workbench has a number of editors that can be used to edit a .java source file. The Java Editor lets you write your source manually, while the visual editor for Java combines a Source view with a Design view where you can lay out and preview visual components.

The visual editor Design and Source views
The visual editor for Java editor is divided into two windows: the Design view previews the Java beans in a graphical representation, and the Source view shows the associated Java code.

The visual editor design palette
The visual editor for Java includes a palette of components and other selection tools for you to use in the Design view.

The visual editor Properties view
The Properties view shows the properties for the selected Java bean that is selected in either the Design view or the Java Beans view.

The Java Beans view
The Java Beans view of the visual editor for Java shows a tree view of the components, events, and listeners used by the Java class that you are composing.

Source code generation in the visual editor
As you make changes to a visual class in the Design view, the Java source is updated. Likewise, as you edit the Java source, the graphical design view is updated to reflect the code changes.

How it works: the visual editor and Java Beans
A model of live Java beans is maintained by the visual editor, allowing you to see the graphical representation of Java beans that are java.awt.Component subclasses, and to display the values in the Properties view for unset properties.

Setting visual editor preferences
You can set preferences that affect the appearance of the visual editor, the way the visual editor generates and parses Java code, and other preferences.

 

Parent topic

Editing Java in the visual editor