Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Jframe and JTable

 
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
 
Rancher
Posts: 3204
29
  • 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.
 
Marshal
Posts: 70210
280
  • 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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • 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
Netbeans IDE Opera Java
  • 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
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic