Letters typed into JTextField appear in reverse order

I was working on a JTextField in a NetBeans Platform application (Java Swing), and started to see some bizarre behavior. The cursor would remain to the left of each letter typed, and as a result the letters would appear backwards. Or rather, the word would be spelled backwards as the letters would be in reverse order. Rendering was also messed up, as most new letters would not be visible unless the cursor had passed through them. Once it occurs, the problem spreads to other text fields.

I hadn’t noticed, but an Exception had actually been thrown, probably messing up the JTextField’s listeners in some way. The easy answer is to fix the exception. If I had noticed it earlier I wouldn’t have been so baffled!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.