Using Jbuilder to Make a Swing GUI

Here are some random observations:

Applicable to All Java Forms

  1. Rename your objects, not doing so makes the code unreadable and you will need to be able to read the code.
  2. 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.
  3. Add borders to your components while designing
  4. Start with absolute positioning and convert it to GridBag.
  5. Keep a big reference manual handy for looking up specifics, like which events you need to hook to get a pop up to show.
  6. 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

  1. 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.
  2. 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.
  3. For an applet I was working on I had to manually add my menu bar to the code with this.setJMenuBar(myMenuBar)

Beating my head against CVS

CVSNT – seems like it needs to be configured, no UI to do so.
winCVS – This is a user interface? More like a bunch of unintelligible menu selections

pushOK plug in for VB6.0 — Ah, this is more like it. However, you have to hack a .ini file & register a MS dll in the Visual Studio folders to get the SCC plug in to show up. The plug in showed up right away in the Visual Interdev environment. Still, it failed to reload one of my projects after I put into a repository. So far it looks like it would be good for putting code into and getting it out of the repository, for other tasks, looks like I still need to learn to use winCVS or the like.

Getting MS Explorer to Swing

I want to write an application that uses the Swing library and runs on any MS Explorer machine, without the client installing extra software or changing evironment variables, or spending a day dowloanding.

Here is what I’ve learned:

1) People complain about Swing, for being big & slow, but it has more features & better looks than VB forms. The other UI for java include: HTML, AWT, commercial & free non-Sun component libraries, & command line. For my main goal right now (showing off), these other options don’t measure up.
2) Mozilla 1.0 requires a manual file copy to get the Java plug-in to work
3) MSIE can do Swing if you unjar the file swingall.jar, but loading it from local on a fast machine takes a while. Also, you get a lot of security access errors as the swing form tries to figure out what kind of machine it is one (for plugable look and feel)
4) JBuilder has to be set to build for all VMs to get an applet that MSIE can open.
5) MSIE doesn’t seem to be able to open a jar archive without special software, although for some reason creating a CLASSPATH environment variable pointing to the swingall.jar file seems to work. (So a jar is OK if it local, bad if you download it? I don’t understand.)
6) Using jarg on javaswing reduces it from 2.2MB to 1.6MB, which is not much of an improvement & the applet gets a little broken in the shrinking process.
7) Putting java files into a jar is easier if you don’t use a manifest file & just use : jar cvf newjar.jar *
You execute this command in the root of all your classes & packages that you want in the jar.
8) Packages and jars are headaches, don’t try to include them in your build process if you are still learning. The errors caused by package and jar problems look a lot like other problems (namely they all give Class not found errors)
9) MSIE (using VM5) sometimes crashes the entire computer, I’m not sure if it was Swing related.
10) Command line programs should be run using lots of 1 line .bat files. Some applications have such complicated switch syntax it is like writting a mini program.
11) Downloading a .jar application and running it is fairly easy, two files often will suffice (the jar file & a batch file with
ava -jar myapp.jar
12)