• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

adding a table dynamicly to frame

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic