I have an application that enables/disables fields on a JFrame form. Upon startup the JTextField are disabled using: jtf.setEnabled(false); Once needed the field is enabled using: jtf.setEnabled(true); The problem I am experiencing is that the first time the text field is enabled, I cannot see the highlight or the cursor. I can "pretend" to highlight the text and am able to change the text so it is getting focus and it is editable. Once the field is disabled then enabled again (form is reset) for the second time, the highlight and the cursor work fine. I tried enabling/disabling/enabling/disabling and the first time I tried to maintain the text in the field, the same problem occurred. The exact same functions are called on the form when it is loaded as well as when it is reset. This is only happening on JTextField components. The JRadioButtons and JComboBoxes are working fine every time. Has this happened to anyone else?
Could you say what look & feel, platform, java version, and swing version( if applicable ) are you using? Any of these could impact the problem. Using Metal L&F, Windows L&F, or Motif L&F on a Windows NT machine with Java 1.3 I had no problems like you described...
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
posted 18 years ago
I am using the JDK1.3.1, using the regular javax.swing.*, I am not using a layout, I am absolutely positioning the fields using setBounds on the components. Still not sure why this problem is happening! repaint() didn't work, but it was worth a shot Thanks for the suggestions!
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop