wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes Programming With Keystrokes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Programming With Keystrokes" Watch "Programming With Keystrokes" New topic
Author

Programming With Keystrokes

Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

I have overridden the default ENTER keystroke for a JTable to allow for a customized function when ENTER is pressed.
I also want the UP and DOWN arrow keys to allow the user to move through each table cell vertically. This works by default, but no longer works after the first time ENTER
is pressed, even though I have used requestFocus on JTable after the dismissal of custom JDialog that appears upon pressing ENTER. Do I also have to reprogram the UP and DOWN keystrokes to keep vertical movement in the JTable?

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2157
    
    7
Works fine for me when I display a JOptionPane in the ActionListener. Don't know why your custom dialog would be any difference.

Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

Isn't the problem caused by the table losing the focus after performing the ENTER key action? Just guessing.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2157
    
    7
Martin Vajsar wrote:Isn't the problem caused by the table losing the focus after performing the ENTER key action? Just guessing.


The original question states that the poster has tried adding a request focus after the dialog is dismissed.

Also, why does the code work for me even though I don't request focus?

Who knows? That is why we need a SSCCE, otherwise all we can do is guess.
Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

I am using a JXLayer<JComponent>layer with Blur effect over the JInternalFrame in which I have the JTable. When the custom dialog is launched the Layer and blur effect kick in which has the effect of making the contents of the undecorated custom JDialog appear sharper. It could have something to do with this, so I will check this.
Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

Just as I suspected, it has to do with the JXLayer with Blur effect over the JInternalFrame in which I have placed the JTable.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2157
    
    7
Just as I suspected, it has to do with the JXLayer


Just as I suspected, your original question did not contain enough information for us to solve your problem.

I have answered several of your questions in the past and several times I have asked for a SSCCE with your original question.

Yet again you did not provide a SSCCE so you have again wasted the time of everyone who has taken the time in an attempt to answer this question. The whole point of a SSCCE is for you to narrow down the problem so we don't waste time guessing!

I for one will no longer be answering your questions unless a proper SSCCE is posted, I've wasted too much time guessing and asking for a SSCCE in the past.
 
 
subject: Programming With Keystrokes
 
Similar Threads
Tabbing out of a JTable
jtable
JTable Trouble
JTable
jtable