• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BookContractor Prompt for CustomerId

 
Murali Kurukunda
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have started working on my UI design. I have a BookContractor button in the main screen and I want to add a prompt for customer ID when the user click on the BookContractor button. And I am having difficulty doing so.
Can someone provide me a code example of how to prompt the user to enter customerId when they click on the BookContractor button in GUI. I am thinking it would be a JDialog with a textField and a submit JButton and when the user clicks on the submit button the JDialog class stored the textField value so that it can be passed to the bookContractor method.

I guess I am not sure where to put this new JDialog code? I tried putting it inside the actionPerformed() of the BookContractor button. But not much success there.
I would appreciate any example code for this.
Thanks,
Murali
 
Bridget Kennedy
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at JOptionPane.showInputDialog() API. I believe this will do the job for you.
 
Murali Kurukunda
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I was not very clear in asking the question. My question is (even when using showInputDialog as you mentioned) where does the following code go?



First of all is the code correct for what I am trying to do? Does it go inside the actionPerformed() for the bookContractor button?

any example would be appreciated!

Murali
 
Murali Kurukunda
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The above code works for me. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic