Re: visual editor & gridbagLayout problem.
I think it is related to things I should do and not to do with Visual
Editor.
(Are there any rules ?)
I need gridBagConstraint to be private, so I can use it anywhere on code,
but it is declared on the initialize routine, by defualt, so what else can I
do ?
My code :
--------------
import java.awt.ComponentOrientation;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JLabel;
public class myObject extends JPanel {
private static final long serialVersionUID = 1L;
private JLabel jLabel = null; // @jve:decl-index=0:visual-constraint="35,11"
private GridBagConstraints gridBagConstraints; // this I have declared
manually.
* This is the default constructor
*/
public MyObject() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
GridBagLayout gbl;
gbl = new GridBagLayout();
jLabel = new JLabel();
jLabel.setText("JLabel");
gridBagConstraints = new GridBagConstraints();
setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.weightx = 1;
gridBagConstraints.weighty = 1;
gridBagConstraints.ipadx = 150;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new Insets(1, 1, 1, 1);
gridBagConstraints.anchor = GridBagConstraints.WEST;
setSize(300, 200);
setLayout(gbl);
add(jLabel, gridBagConstraints);
}
} // @jve:decl-index=0:visual-constraint="29,4"