• Post Reply Bookmark Topic Watch Topic
  • New Topic

adding a table dynamicly to frame

 
ayoub belkas
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to add a number of tables to my frame , depending on the out come of something

so put this

int x=17;
int y=95;
for(int i=0;i<5;i++)
{
table[i].setBounds(x+50,y+50, 525, 44);
contentPane.add(table[i]);
}

but nothing happing any one has some sorte of idia
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After you finish adding invoke revalidate() and repaint() (in that order) on the content pane.

On a related note, using null layout with bounds is always a bad idea. The correct way is to use a proper layout manager. More on it here
https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
 
ayoub belkas
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:After you finish adding invoke revalidate() and repaint() (in that order) on the content pane.

On a related note, using null layout with bounds is always a bad idea. The correct way is to use a proper layout manager. More on it here
https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html



can you pleas edit my code still new to java or show me a better example
thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!