Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Jframe and JTable  RSS feed

 
Mon Francis De Chavez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible that i have my jframe with table and another jframe with text field with button(submit). when i click submit the text will be go to table
 
Rob Camick
Ranch Hand
Posts: 2754
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An application should only contain a single JFrame. For your child window you should use a JDialog.

If you want to update the table from the dialog, then you need to pass the DefaultTableModel to the dialog as a parameter when you create the class. Then in the dialog you just update the TableModel with the data and the JTable will be updated automatically.
 
Campbell Ritchie
Sheriff
Posts: 53773
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Mon Francis De Chavez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to use that jDialog? because my plan is i want to create a simple registration system that has a jframe window with two button one for the admin and students. admin contains a jtable that has the record for students who will registered and the other one is students that will be register the the add button.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you discovered the Oracle tutorials? How to Make Dialogs
 
Mon Francis De Chavez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:An application should only contain a single JFrame. For your child window you should use a JDialog.

If you want to update the table from the dialog, then you need to pass the DefaultTableModel to the dialog as a parameter when you create the class. Then in the dialog you just update the TableModel with the data and the JTable will be updated automatically.


sir how it can help my program? can you help me?
 
Mon Francis De Chavez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:Have you discovered the Oracle tutorials? How to Make Dialogs

not totally.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to BeForthrightWhenCrossPostingToOtherSites <- that's a link
http://www.java-forums.org/awt-swing/92896-trouble-two-jframe-jbutton-jtable.html
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!