A new advanced GUI Builder for Swing is nearly released from the long beta testing an bug fixing to his first stable version. That is not just yet another tool for Swing GUI building, it’s very interesting and convenience tool. His name is GUIDE. But, what it can do?
Supported layouts
GUIDE supports freeform layout with GridBagLayout and JGoodies’ FormLayout. I don’t know is GUIDE supports MigLayout or not…. In any case, it should be true in new versions, if right now he isn’t support precisely mentioned MigLayout.
Code generation and editing
GUIDE generates properly formatted , easy to read Java code. And thats true. We can easily collaborate with GUIDE and any IDE that you like – IntelliJ IDEA, Eclipse, NetBeans or just your lovely Text editor.
Perhaps, we create our new project structure with IntelliJ IDEA and thats structure may be the source location for GUIDE, where we will create our Java Form. After Frame creation and components location on the Container in GUIDE, the Java code will be generated in the IntelliJ IDEA’s project tree. That’s could possible simultaneously editing generated code in IDEA, Model and Controller creation (as JavaBeans), that will be accessible from GUIDE.
MVC separation
GUIDE facilitates proper separation of concerns by encouraging the use of one of the Model-View-Controller patterns. And sure, collaboration with our IDE’s project tree. In that way Unit tests creation is easy an pleasant.
More about MVC patterns look at Martin Folwer and Derek Greer’s articles on MVC patterns, with unit-testable example implementations of both the Passive View and Supervising Controller patterns.
IDE choice
GUIDE is a standalone application designed to work in conjunction with your IDE or text editor. About that issue I precisely mention and this has many advantages. No requirements for some particular IDE – you use what you like. That give advantages to us in mixed-IDE team environment and this is cool.
I hate fanatic warriors about that IDE is the best and that particular OS is more featured…
Automatic component generation
GUIDE supports automatic component generation from model or controller properties. We just can Drag a field property onto our design and GUIDE will generate a code for us.
Also, if the controller has PropertyChangeSupport, we can just Drag the whole bean onto the design, and GUIDE will create bound components for all bean properties. It just work!
Create personal components
We can create a re-usable components as separate components. Thus, we can use it late in any other projects without recreation it again and again.. Also, we can even Drag third party components from Jar files onto design preview, such as components from SwingX project or a great OSX components for Java called MacWidgets.
Here is the sample code generated by GUIDE taken from the examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | package featureTour.imageResources; import java.awt.*; import javax.swing.*; import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.layout.CellConstraints; public class ImageDemo { public static JFrame create() { JFrame frame = new JFrame(); JPanel contentPane = (JPanel) frame.getContentPane(); contentPane.setLayout(new FormLayout("12px, 20px:g, 13px", "12px, p, 14px, p, 6px, p, 20px:g")); JSeparator separator = new JSeparator(); separator.setPreferredSize(new Dimension(64, 12)); contentPane.add(separator, new CellConstraints(2, 6, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); JTextArea messageTextArea = new JTextArea(); messageTextArea.setLineWrap(true); messageTextArea.setName("messageTextArea"); messageTextArea.setOpaque(false); messageTextArea.setText("Blah, Blah, Blah."); messageTextArea.setWrapStyleWord(true); contentPane.add(messageTextArea, new CellConstraints(2, 4, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); JLabel imageLabel = new JLabel(); imageLabel.setIcon(new ImageIcon( ImageDemo.class.getResource("/imageResource.png"))); imageLabel.setName("imageLabel"); contentPane.add(imageLabel, new CellConstraints(2, 2, 1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT)); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setTitle("Image Demo"); frame.setBounds(new Rectangle(500, 0, 480, 319)); return frame; } } |
