LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Java 1.6.0u6 JTextField: Cannot enter text (https://www.linuxquestions.org/questions/linux-software-2/java-1-6-0u6-jtextfield-cannot-enter-text-644212/)

make 05-23-2008 12:57 AM

Java 1.6.0u6 JTextField: Cannot enter text
 
Did I just discover a new Java bug?

The JTextField-textboxes suddenly stop accepting text. The cursor blinks in it, but you cannot enter anything. I can restart the program and enter text for some time again. Suddenly it won't accept it anymore. Sometimes it won't accept text right after starting the program.

When I uninstall JRE 1.6.0 and put 1.5.0 back instead, this won't happen. However, I have to use 1.6.0 because my program uses the ScriptManager that didn't exist in older versions.

Some info:
- The bug affects every single JTextField-component in the program, they're all locked out after the bug appears
- Nothing in my code is ever disabling or locking those JTextFields
- I don't use a 3D desktop, like compiz
- Metacity is my window decorator
- I've tried the AWT_TOOLKIT-fix, won't help
- I am using the Sun's Java implementation, since for example Icedtea won't work with the ScriptManager (doesn't have it?)
- I have the latest Sun JRE, 1.6.0 update 6, which I have installed both ways - tried the RPM's from repos and Sun's own BIN installer from their website
- I am using Mandriva 2008.1
- The bug appears under every single Linux PC I've tested, including various distros (at least Ubuntu) and under every single window manager I've tries (including GNOME, KDE, IceWM and some others), BUT the bug does NOT appear under Windows for some reason (JRE 1.6.0 is not available for OS X, so I can't test that)

This is a serious issue that prevents my program to be used entirely! Is there any fix or hack for this? Anything at all?

make 05-24-2008 07:16 AM

I think I discovered a solution. I'll still keep on testing it, but so far it really seems to work.

The answer is to use TextField instead of JTextField. Of course, replacing all your components in the program might be time-consuming, as these controls aren't 100 % identical with functions and classes.

There's an even quicker solution: add a useless, extra TextField into your program's main window. For some reason beyond my understanding, this prevents the lock-up bug appearing with the JTextField components! And even if it would happen to appear, just click in the useless TextField component, then back to the locked JTextField. Now you can enter text again! It seems that after one time the lock-up bug won't even appear anymore, until you restart your program.

To me this seems like a definite bug in Java itself, since such a weird hack is needed. But personally, I am just glad I don't have to re-write my apps for Java 1.5.0, that'd be weeks of work.

m3lis 05-14-2013 03:19 AM

same for java 7
 
hello. i have stumbled across the same issue, and I am using java 1.7

have you found any further information from java regarding the issue, or another workaround?

any help appreciated

thanks


All times are GMT -5. The time now is 11:50 PM.