This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Programming With Keystrokes  RSS feed

 
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
Rancher
Posts: 3000
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works fine for me when I display a JOptionPane in the ActionListener. Don't know why your custom dialog would be any difference.

 
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't the problem caused by the table losing the focus after performing the ENTER key action? Just guessing.
 
Rob Camick
Rancher
Posts: 3000
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 3000
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!