hi
trying to do array of jtables and put them on JPanel
why my jtable showing at part of screen center ? and why it's not resizing to full horizotal size of screen ? label l2 cover column headers at table
thanks
My declarations
TableC tablec[];
JScrollPane jsp;
JLabel label;
JPanel jp;
GridBagLayout gbl;
GridBagConstraints gbc;
in constructor i have
jsp=new JScrollPane(jp);
tablec=new TableC[100];
GridBagLayout gbl=new GridBagLayout();
GridBagConstraints gbc=new GridBagConstraints();
gbc.fill=GridBagConstraints.BOTH;
getContentPane().add(jsp);
setMainInfo(1);
public void setMainInfo(int num)
{
int i;
JLabel l2,l3;
l2=new JLabel("l2");
l3=new JLabel("l3");
for (i=0;i<num;i++)
{
gbc.gridwidth=GridBagConstraints.REMAINDER;gbl.setConstraints(l2,gbc);
jp.add(l2,gbc);
tablec[i]=new TableC(this);
gbc.gridwidth=GridBagConstraints.REMAINDER;
gbl.setConstraints(tablec[i],gbc);
jp.add(tablec[i],gbc);
gbc.gridwidth=GridBagConstraints.REMAINDER;gbl.setConstraints(l3,gbc);
jp.add(l3,gbc);
}
repaint();
trying to do array of jtables and put them on JPanel
why my jtable showing at part of screen center ? and why it's not resizing to full horizotal size of screen ? label l2 cover column headers at table
thanks
My declarations
TableC tablec[];
JScrollPane jsp;
JLabel label;
JPanel jp;
GridBagLayout gbl;
GridBagConstraints gbc;
in constructor i have
jsp=new JScrollPane(jp);
tablec=new TableC[100];
GridBagLayout gbl=new GridBagLayout();
GridBagConstraints gbc=new GridBagConstraints();
gbc.fill=GridBagConstraints.BOTH;
getContentPane().add(jsp);
setMainInfo(1);
public void setMainInfo(int num)
{
int i;
JLabel l2,l3;
l2=new JLabel("l2");
l3=new JLabel("l3");
for (i=0;i<num;i++)
{
gbc.gridwidth=GridBagConstraints.REMAINDER;gbl.setConstraints(l2,gbc);
jp.add(l2,gbc);
tablec[i]=new TableC(this);
gbc.gridwidth=GridBagConstraints.REMAINDER;
gbl.setConstraints(tablec[i],gbc);
jp.add(tablec[i],gbc);
gbc.gridwidth=GridBagConstraints.REMAINDER;gbl.setConstraints(l3,gbc);
jp.add(l3,gbc);
}
repaint();