Home > Articles

Employing the JBuilder Designers

This chapter is from the book

This chapter is from the book

JBuilder provides many different designers and wizards to allow you to be more productive in the development of your application. In this chapter, we will look at these designers and wizards to build our application efficiently and effectively. You will learn how to use these designers to produce a simple user interface, hook up events, and build navigation. As we explore these designers, you will experience the single biggest reason to use JBuilder and its available designers—productivity! We will investigate the following objectives:

  • Using the Screen Designer

  • Implementing event handling

  • Building a menu with the Menu Designer

Screen Designer

The JBuilder Screen Designer uses an amazing feature called a two-way designer. This allows user interfaces to be constructed either with code or by using the Screen Designer, interchangeably. This gives you the flexibility to use whatever technique works best. Often, you will find that you might switch back and forth between both, depending on what needs to be accomplished. For example, it might be easier to make changes to the code to change properties based on variables. Whereas in other instances, the designer would better meet the need to change the graphical layout of the user interface. We'll now look at the Screen Designer and see where to start.

Activating a Designer

Activating any designer, in this case the Screen Designer, is rather simple, although the response to the activation of the designer is more dramatic. This result includes parsing the user interface, building the interrelationship between all the components, and finally checking for syntactical errors. To access any of the design tools, you must open a source file (java, XML, jsp, and so on) in the Content pane and then click on its Design tab to load the appropriate designer. The designer in which the JBuilder initiates is the designer that was last used if multiple designers are appropriate for that situation. For example, if the Screen Designer, shown in Figure 3.1, was last used on a frame, the Designer pane defaults to the Screen Designer.

Figure 3.1Figure 3.1 JBuilder in Design view.

JBuilder provides tools for visually designing and programming Java classes, giving you the ability to produce new complex user interfaces. Like an artist having many different tools at his disposal, the visual design tools offer many options. The designer contains four main compartments: the Component tree, an Inspector, one of three different designers, and finally a Component palette. These three designers include a Menu Designer, Screen Designer, and Database Component Designer. The Database Component Designer will be addressed in Chapter 15, "Database Connectivity."


If you have an error in the jbInit() method of the class, you will not be able to enter the Screen Designer. This is not limited to just the Screen Designer, but also affects the Menu Designer and Database Component Designer. You may receive a variety of errors if the designer cannot parse the jbInit() method. For example, a missing semicolon on any line of code would produce com.borland.jbuilder.cmt.CmtParseException: Class '' not found, but all errors will be displayed under the Design tab of the Compiler window.

Component Tree

Let's drill down and look specifically at what the component tree offers. It is one of the most useful and often overlooked portions of the JBuilder IDE. The component tree replaces the source code Structure pane when the Design tab becomes activated. Its display contains a structured/organized view of all the components owned/contained within the frame. Its purpose is simple: to display the interrelationships between all components and containers for a given frame. The Component tree is divided into folders to allow for better organization of components within a user interface. For example, Figure 3.2 shows how the Component tree of the Screen Designer is divided into these folders.

Figure 3.2Figure 3.2 The Component tree is used to navigate either between designers or components within a designer.

The Component tree offers a number of productive features, such as

  • Add and manage non-UI components from the Component palette into your class by dragging and dropping them on the Component tree.

  • Move the mouse over a component to identify the base class name.

  • Select a visual or non-UI component to modify its properties and associated events in the Inspector.

  • Open a visual or non-UI component's associated designer (for example, the Menu Designer or Database Component Designer).

  • Rename a component.

  • Cut, copy, and paste components in your UI design.

  • Reorganize the relationship of components to containers.

The tree is organized into a number of different folders to allow for easy traversal through the frame design. These folders enable you to have an organized view of all components contained within this module. The following is a list of each of the folders and its containership rules:

  • UI components—This folder contains all the user interface components of a frame. More specifically, it demonstrates visually the relationship between containers and components.

  • Menu components—All menu components and containers appear under this folder. This includes pop-up menus in addition to fixed menus.

  • Data Access components—All nonvisual data model components appear in this location.

  • Other—Any JavaBean that is not defined in one of the three preceding categories (for example, Socket component).

Component Palette

The Component palette will be the most used section of JBuilder's Screen Designer. The palette divides all the building blocks, components, and other JavaBeans, of an application into a number of different categories and offers the ability to add many of your own. These building blocks are organized into different categories depending on the requirements and capabilities of the component. Each component ultimately represents a program element as a user-interface object, a database, or a system facility (see Figure 3.3). Each component, therefore, represents a true implementation of object-oriented behavior with properties, methods, and events.

Figure 3.3Figure 3.3 ToolTip text represents the component under design. The hierarchies represent the containership of each component in the tree. Each component is grouped into similar types of components in the tree (UI, Menu, Data Access, and Other).

Component Palette Organization

The organization of the Component palette is actually simple. Each component is grouped into an interrelated set. The following is a list of many of these sets:

  • Swing—This grouping contains all the components of swing that are not a container.

  • Swing Container—This set contains all the container swing level components.

  • DataExpress—The DataExpress tab contains all the Borland DataExpress JavaBeans.

  • db*—Any of the tabs that start with db contain swing or AWT components that have been extended to support a data model.

  • XML, CORBA, JClass, and many more—These will be discussed in subsequent chapters.

Managing the Component Palette

One of the great features of JBuilder is its capability to be customized and extended. One extension enables you to add new components to the Component palette. For example, you might want to include your own custom controls or add new components from third-party vendors. To do this, choose Tools, Configure Palette from the menu. This allows you to configure your palette properties either by reorganizing the existing components or adding new components under the Add Components tab. Figure 3.4 demonstrates the folder's visual. From this Palette Properties page, you have access to the following:

  • Add/reorganize component groups—To add a component group, select any existing component group and choose the Add button. You can also reorganize the order of the components within a group.

  • Add a new component—Choose the Add Components tab of the Palette Properties page. You can use this tool to add JavaBean components from a third-party class library or JavaBean-compliant object you have created.

  • Add a component image—Each component may have an associated image to aid in its functional clarity.

Figure 3.4Figure 3.4 The Configure palette enables you to customize any component group or component in addition to inserting new components.


The Inspector displays to the right of the design window. Its purpose is to display and manipulate the properties of a given component at design time. As changes are made in the Inspector, source code is immediately written to implement the change. As in the Screen Designer, the Menu Designer is also a two-way tool. In Figure 3.5 for example, the code written to configure the menu is also shown in the Menu Designer.

Figure 3.5Figure 3.5 The Inspector is used to change any design-time property and the designer interprets it to code.

The associated properties available to the Inspector for any given component are implemented in the BeanInfo class. This class defines for the Inspector what name and attribute types each property must be. In any case, JBuilder's Inspector reads the appropriate properties when the component is selected, in addition to making an appropriate custom editor available or using the default editors. In Listing 3.1, notice that when we changed the text for jButton1 in the Inspector, it created the code that is in bold.


In Listing 3.1, notice that as you build your user interface, no custom tags are included in your source code; that is the magnificence and simplicity of JBuilder and its patented two-way tool technology.

Listing 3.1 The Results of Changing the Property Text for jButton

 private void jbInit() throws Exception {
_ FrmDemo.class.getResource("[Your Icon]")));
  contentPane = (JPanel) this.getContentPane();
  this.setSize(new Dimension(400, 300));
  this.setTitle("Designer Demo");
  //Code to setup the menu
  contentPane.addMouseListener(new FrmDemo_contentPane_mouseAdapter(this));
  contentPane.add(jButton1, new XYConstraints(82, 63, -1, -1));


Properties not exposed in the BeanInfo class remain hidden. This means that they will not be displayed in the Inspector property list. The designer does not know about them unless a property manipulated for a given attribute was manipulated within the jbInit() method. In this case, the property will then appear in the Inspector, but only the default editors will be enabled for that attribute.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020