Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frame and Dialog problem

 
tee ming
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a program consists of 1 frame and 1 diolog, how can i link them together so that i can get the value in Dialog and set it into textField in Frame.
 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From your JFrame code, make a call like this...
String value = JOptionPane.showInputDialog(....)
You dont need to create your own custom dialog since JOptionPane does it for you. The method showInputDialog() is overloaded to accomodate different arguments, such as dialog title, dialog message, etc. In any event, a call to this static method will display a dialog window to the user with a text field to enter data. After the user clicks OK, the data they entered in the text field will be assigned to the 'value' variable in the code snippet above.
Hope it helps
SAF
 
tee ming
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi SAF,
I can't use the default dialog box because my dialog box need to have more than 1 textField and a passwordField. So can you help me solve the previous probelm, Thanks!
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"teeming"
your name is not in accordance with the javaranch guidelines.
Please take a moment and re-register after selecting a valid
name. you can find the guidelines at http://www.javaranch.com/name.jsp
thanks for your cooperation.
- satya
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic