Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Swing

 
sudhir pavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i have a product table which some N' number products.
Based on Product count i need to loop to add the swing components to get the input data.
currently it has been hard coded. i.e code change every time when a new product added.
and also i need apply scrollbar for the above case.

can you help me out from here.
 
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
By "product table" I take you to mean JTable.
JTable is not aware of the actual data it displays but relies on the backing data model. If you correctly manipulate the model, the table will update itself to reflect the changes.
Recommended reading: http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#fire

To get the scroll bar working properly, wrap your table inside a JScrollPane and add the scroll pane to a container with a border layout
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!