I'm thinking of using an
IDE for the gui construction.
I use a null layout and put the components where I want them. Then I
switch to a gridbag layout and get the source code generated.
JBuilder produces code that is clearly generated from an IDE.
However, Sun studio 8 produces code, with few refactoring, can be mistaken for a programmer written rather than computer generated.
For example, see below.
Can I use this approach? It makes life much easier than designing by hand.
Please let me know.
S
Generated code:
java.awt.GridBagConstraints gridBagConstraints;
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
getContentPane().setLayout(new java.awt.GridBagLayout());
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Name:");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.ipadx = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(40, 50, 0, 0);
getContentPane().add(jLabel1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 2;
gridBagConstraints.ipadx = 104;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(40, 26, 0, 81);
getContentPane().add(jTextField1, gridBagConstraints);
jButton1.setText("Push");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.ipadx = 18;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(70, 36, 69, 0);
getContentPane().add(jButton1, gridBagConstraints);
pack();