Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SWING+JTABLE(Urgent Please)

 
Faisal Ahmed
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody!
Please help me to solve the problems below:
#1.I want ScrollBars in a FORM(extend JFrame) which is populated with
many Components.How can i do this.
#2.I have made JDialog opens from a FORM(extends JFrame) through
'Findbtn'.JDialog populated with JTable has been used for fetching data
from database. but the problem is how can I get text from JTable
to the textfield of Form.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#1. Create an extra JPanel. Instead of adding components directly to the content pane of the frame, add them to this panel. Put this panel in a JScrollPane, and then add the JScrollPane to the content pane.

#2. There are lots of ways to do this... you can extend dialog to have methods to set each field, you can have one method that takes some kind of collection (like a hashtable) that is filled out with the data, instead of a collection, you can pass the table model and the row number you want to display... etc. There is no built in way to do this, but there are several ways to do it yourself...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic