Developer's Daily JBuilder Education
  main | java | perl | unix | DevDirectory
   
Main Page
Java
Education
JBuilder
Articles
   

How to copy a bean in the JBuilder Designer
 

Introduction

From what I've seen of other IDE's, JBuilder's Designer is the best tool around for creating Java JFC/Swing applications in a drag-and-drop environment. Here's a quick example that shows an advanced method of copying beans in the Designer.


How to do it

First, start off with a simple example application like that shown in Figure 1. All I did to get to this point was (a) create a new project, (b) create an Application within that project (i.e., File|New...|Application), (c) set the layout of the ContentPane to be an XYLayout, and then (d) dragged and dropped a JButton onto the ContentPane.

The JBuilder Designer with a JButton.
Figure 1: The example JFrame contains one JButton (circled).

To create a second button very easily, as shown in Figure 2, just follow these steps:

Your Designer should now look like the image in Figure 2, where a second JButton has been created.

A second JButton is created and positioned right 
where you want it.
Figure 2: A second JButton is created and positioned right where you want it.

 

Other ways

Of course you can also copy the JButton by right-clicking on the first JButton, selecting Copy, and then selecting Paste. This is shown in Figure 3.

You can also right-click the original JButton, and then 
   follow the normal copy/paste procedure.
Figure 3: You can also right-click the original JButton, and then follow the normal copy/paste procedure.

This procedure is, of course, easier to remember, but one advantage I've found with the first approach, especially when I'm not using a simple XYLayout, is that you can easily control the position of the new JButton that you create.

 

 


Copyright © 1998 DevDaily Interactive, Inc.
All Rights Reserved.