Problem behavior when overriding DeletePrefCharAction

  • Thread starter Gerald Rosenberg
  • Start date
G

Gerald Rosenberg

I have extended HTMLEditorKit to override DeletePrevCharAction. The new
action is added to the ActionMap of a JTextPane.

The problem is that, in response to a backspace key (physical) press, my
custom DeletePrevCharAction.actionPerformed(evt) method is called
*twice* in rapid succession if my code is executed using JDK 1.4.2.
Running the exact same code under JDK 1.5 obtains the correct/desired
behavior: the actionPerformed method is called only once per key press.

Is this a known problem or is there something additional/special that
needs to be done to replace the backspace action in 1.4.2?

Googling suggests that there were known backspace key handling problems
as between JDK 1.3 and 1.4 -- registering a new backspace key action had
to handle both pressed and typed events in 1.3, but nothing as between
1.4.x and 1.5.

What do I need to do to ensure that backspaces are handled consistently
under both 1.4.2 and 1.5?

Thanks
 
J

jan V

Is this a known problem or is there something additional/special that
needs to be done to replace the backspace action in 1.4.2?

Are you familiar with Sun's Java Bug Database? If so, check the database and
see if this behaviour has been reported as a bug. If it's not, consider
filing a bug report yourself. If it's really a bug, then filing a bug report
is the most likely way Sun is going to become aware of the problem...
Googling suggests that there were known backspace key handling problems

Googling for Java bugs? Geee... I think you'll love the Bug Database !
 
G

Gerald Rosenberg

Are you familiar with Sun's Java Bug Database?

Very. But I was not able to find any relevant bug report before I first
posted. I also reviewed Sun's documentation of the differences between
the different JDK releases, but again found nothing of evident
relevance.

Rather than just throwing junk into the bugbase and seeing if it would
stick, I was hoping for someone with practical experience would respond
-- there was interesting and helpful commentary from Kleopatra, Linda
Radecke, Chris Smith, and others regarding the prior related issue.

So, has anyone seen or know of any differences in how 1.4.2 and 1.5
handle action maps, backspace key handling, JTextPanes, etc. that might
explain why I am seeing two actionPerformed's under 1.4.2, but only one
under 1.5?

FWIW, I have also overridden DeleteNextCharAction for the Delete key in
exactly the same manner, yet the resulting behavior is entirely
consistent under both 1.4.2 and 1.5. So the problem seems peculiar to
the backspace key.

Thanks.
Googling for Java bugs?

Is there a better way to review the collective Java experience than
searching Google groups?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,082
Members
48,773
Latest member
Kaybee

Latest Threads

Top