Visual Editor, Swing, and GridBagLayout

I’ve been using the Visual Editor to build some user interfaces for an Eclipse application that I’m building. As a distraction, I thought it might be fun to spend a few minutes cobbling together a Swing JFrame (okay, maybe “fun” isn’t the right word).

Below is what it looks like in the editor:

At the point I took the screen shot, I was about to drop a new JLabel between the two already placed ones. The “03” by the cursor is feedback indicating that I’m about to drop the widget at position x=0, y=3. The form itself is pretty simple: just a bunch of JLabels and JTextFields. The JTextArea is in a JScrollPane and I threw in the slider for kicks. The two push buttons at the bottom are in a nested JPanel with a FlowLayout layout.

I’ve always hated using the GridBagLayout; it’s just too weird and complex for my little brain. But Visual Editor makes it a lot easier (the grid lines make it a lot easier). I managed to put this example together in about five minutes. My little brain can handle that…

This entry was posted in Uncategorized. Bookmark the permalink.

1 Response to Visual Editor, Swing, and GridBagLayout

  1. Ed Burnette says:

    I think it would be interesting if the editor would go ahead and place the item where the cursor is but move it around as the cursor moved. Like the way Eclipse moves the trim area.

Leave a comment