• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Best idea to make these

 
Ranch Hand
Posts: 66
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
The idea is have a main window with different buttons that each of them open other window that have jtext, jbutton and jtable

What is the best controls to achieve that? All jframes?
Could you suggest me? I'm newbie in Java
Thanks and sorry for my English

 
Saloon Keeper
Posts: 10308
217
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends. If the other windows are only temporary, and control must return to the original window at a later time, then it's better to use a JDialog. If the new window has a lifetime that's completely separate from the original window, then you can use JFrame.
 
david luis
Ranch Hand
Posts: 66
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Depends. If the other windows are only temporary, and control must return to the original window at a later time, then it's better to use a JDialog. If the new window has a lifetime that's completely separate from the original window, then you can use JFrame.


Thanks. I thought I will use jframe with jdialog.
Is possible to pass some values between jframe and jdialog?
 
Stephan van Hulst
Saloon Keeper
Posts: 10308
217
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. How to do this kind of depends on how complex the dialog is that you want to display. If you want to create a simple dialog where a user inputs data through few components, without input validation or intricate layouts, then you can just pass values to one of the show...() methods of JOptionPane. If you want to perform input validation or layout the dialog in some custom way, then you will want to extend JDialog and provide it with a constructor which you can use to pass values.

To return data to the frame from the dialog when it closes, just query the dialog's components after the dialog has closed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!