This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to Add a JDialog? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How to Add a JDialog?" Watch "How to Add a JDialog?" New topic

How to Add a JDialog?

Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
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

SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCJD, SCEA in progress
K. Tsang

Joined: Sep 13, 2007
Posts: 3135

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.

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
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 !
I agree. Here's the link:
subject: How to Add a JDialog?
It's not a secret anymore!