Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Add a JDialog?

 
Ulises Pulido
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All:

My question is, how am I able to add a JDialog when the user does a double click or presses enter over a row in a JTable, I am looking for a listener that might help me on this but I could not find it ?

What I want is that when the user double clicks or presses enter in the JTable a JDialog appear that will help the user to see the data that is on the Row of the JTable and if it has no user yet the user can insert it in this dialog and the update on the database will be done?

I hope you can help me on this

 
K. Tsang
Bartender
Posts: 3502
14
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well your question isn't really adding a JDialog for the table row but a table list selection listener. In my GUI design, when a row is selected, I used the list selection listener to enable my "book" button (disabled by default). The book button is a Swing action rather than an action listener. Once you have that adding the double click or enter to pop up a JDialog shouldn't be that hard I think.
 
Ulises Pulido
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What a great Idea!! thanks K. Tsang I will implement it as you state, and maybe I can add another button saying view details, that can show the details even if the row was already booked.

Thanks a lot !
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic