Tip 49: Design GridBag Layouts Easily

Not only is the NetBeans GUI Builder Matisse the ideal choice for creating GUIs with the new dynamic FreeDesign, but it also assists you with another common layout, GridBag.

Create a new project and use File > New File to create a new JFrame. When the JFrame comes up in the GUI Builder’s Design view, right-click and select Set Layout > GridBagLayout, as shown in Figure 41.

FIGURE 41: Switching to a different layout manager

image

Press Ctrl-Shift-8 (Mac: Command-Shift-8) to open the Component Palette; select GUI components and drop them onto the JFrame. In this example, I added a JButton, a JLabel, and a JTextField. ...

Get 100 NetBeans™ IDE Tips & Tricks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.