Forums Register Login

jtables[]

+Pie Number of slices to send: Send
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();
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1204 times.
Similar Threads
JAVA: Trying to create checkboxes according to the number of rows in a text file
Sample maintenance disply
Forcing size of JPanel
Creating and opening a window if the button is clicked in an applet
JTextField in JScrollPane
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:34:51.