| Developer's Daily | JBuilder Education |
| main | java | perl | unix | DevDirectory |
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.
| 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:
[Ctrl][Shift] keys simultaneously;
Your Designer should now look like the image in Figure 2, where a second JButton has been created.
| 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.
| 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.