Here are some random observations:
Applicable to All Java Forms
- Rename your objects, not doing so makes the code unreadable and you will need to be able to read the code.
- A typical pattern is to have an Border layout, with the title or button in the north, a status bar, instructions or buttons in the south and a nested panel in the center that holds the fields with labels.
- Add borders to your components while designing
- Start with absolute positioning and convert it to GridBag.
- Keep a big reference manual handy for looking up specifics, like which events you need to hook to get a pop up to show.
- Applets don’t resize, their size is set by the APPLET tag. Resizing is a key feature of a Java Swing form, it allows you to put the same form on monitors of different resolutions. Get around this limitation by creating a launch button in the applet, and on the click event handler, open a new frame. Put all the UI into that new frame.
Jbuilder Specific
- You will have to edit the source code from time to time, JBuilder can’t always guess which panel you want a control to go to.
- Sometimes, Jbuilder fails to add a panel to the UI, but leaves the code. You have to do a
panelX.add(myNestedPanel)
command to get it back on the designer. - For an applet I was working on I had to manually add my menu bar to the code with
this.setJMenuBar(myMenuBar)