Also gut:
public class FrameForm
extends ChildFrame implements ActionListener
{
public JTextArea txtComment;
public JTextField txtID;
public int intCurrIndex=0;
GridBagLayout gbl;
public FrameForm(String strTitle)
{
super(strTitle);
cp.setBackground(Color.WHITE);
gbl = new GridBagLayout();
new LookFeel(this);
}
public void init() {
//Initialisiert Layout
final int LABELHEIGHT=1;
final int LABELWIDTH=40;
place(new JLabel("ID"),0,0,LABELWIDTH,LABELHEIGHT,1,1,20);
place(txtID = new JTextField(),0,1,FIELDWIDTH,FIELDHEIGHT,1,1,80);
//... und so weitere Felder...
***************************************************
public class ChildFrame
extends JInternalFrame
{
public Container cp;
public GridBagLayout gbl;
public GridBagConstraints gbc;
public ChildFrame(String strTitle)
{
super(strTitle);
cp = this.getContentPane();
gbl = new GridBagLayout();
gbc = new GridBagConstraints();
setIconifiable(true);
setMaximizable(true);
setResizable(true);
setClosable(true);
setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
}
public void place(JComponent comp, int row, int col, int width,int height)
{
place(comp,row,col,width,height,1,1,0);
}
public void place(JComponent comp, int row, int col, int width,int height,int rowspan,int colspan,int weightx)
{
cp.setLayout(gbl);
gbc.gridy = row;
gbc.gridx = col;
gbc.gridwidth = colspan;
gbc.gridheight = rowspan;
gbc.ipadx = width;
gbc.ipady = height;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(1,3,1,1);
gbc.weightx = weightx;
gbc.fill = GridBagConstraints.BOTH;
gbl.setConstraints(comp,gbc);
cp.add(comp);
}
public void init(){ }
}
So sieht das aus..aber alle Felder werden beim vergrössern zentriert. Die Frage ist wie ich das JGridBagLayout im JInternalFrame links oben platzieren kann...?
Gruss JLearner