File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Problem with Jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Problem with Jtable" Watch "Problem with Jtable" New topic

Problem with Jtable

Saraswathy Krishnamoorth
Ranch Hand

Joined: Mar 07, 2003
Posts: 73
I have a Panel which has a JTable and "MakeReservation" button. For JTable the selectionModel is set to ListSelectionModel.SINGLE_SELECTION. The button "MakeReservation" is set as the default button. When the user selectes a row and presses enter, the cursor moves to the next row. Though "MakeReservation" button is set as default button. What should be done to make the makeReservation button be activated when user selects a row and presses enter. Please help. Thanks.
[ April 14, 2003: Message edited by: Saraswathy Krishnamoorth ]
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Don't worry about it. When the cursor is in the JTable, The Enter key will function as the JTable will handle it. You can always add a KeyListener to the JTable, but that isn't necessary.
Don't worry that the Enter key won't fire your Button's Action. It won't affect your grade on the assignment.

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Saraswathy Krishnamoorth
Ranch Hand

Joined: Mar 07, 2003
Posts: 73
Thanks Mark.
I agree. Here's the link:
subject: Problem with Jtable
It's not a secret anymore!