JDK-5042122 : REGRESSION: TextField.setEnabled(false) does not grey out text.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2004-05-04
  • Updated: 2005-04-18
  • Resolved: 2005-04-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b33Fixed
Related Reports
Relates :  
Description
Name: gm110360			Date: 05/04/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

A DESCRIPTION OF THE PROBLEM :
Textfield.setEnabled( false ); does not grey out the field. You cant edit the text, or place a cursor.


REPRODUCIBILITY :
This bug can be reproduced always.

Release Regression From : 1.4.2
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Incident Review ID: 260687) 
======================================================================
###@###.### 10/6/04 15:14 GMT

Comments
SUGGESTED FIX ------- XTextFieldPeer.java ------- *** /tmp/sccs.7LaaHR Mon Mar 21 20:27:30 2005 --- XTextFieldPeer.java Mon Mar 21 20:26:20 2005 *************** *** 82,87 **** --- 82,89 ---- setEditable(txt.isEditable()); + setEnabled(target.isEnabled()); + // After this line we should not change the component's text firstChangeSkipped = true; } *************** *** 136,143 **** setBackground(target.getBackground()); } - /** * @see java.awt.peer.TextComponentPeer */ --- 138,155 ---- setBackground(target.getBackground()); } /** + * @see java.awt.peer.ComponentPeer + */ + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + if (xtext != null) { + xtext.setEnabled(enabled); + xtext.repaint(); + } + } + + /** * @see java.awt.peer.TextComponentPeer */ ------- XTextAreaPeer.java ------- *** /tmp/sccs.H4ayHR Mon Mar 21 20:27:43 2005 --- XTextAreaPeer.java Mon Mar 21 20:26:07 2005 *************** *** 141,146 **** --- 141,148 ---- setEditable(target.isEditable()); + setEnabled(target.isEnabled()); + setScrollBarVisibility(); // set the text of this object to the text of its target setTextImpl(target.getText()); //?? should this be setText *************** *** 437,442 **** --- 439,455 ---- setBackground(target.getBackground()); } + /** + * @see java.awt.peer.ComponentPeer + */ + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + if (jtext != null) { + jtext.setEnabled(enabled); + jtext.repaint(); + } + } + /** * @see java.awt.peer.TextComponentPeer ###@###.### 2005-03-21 17:39:01 GMT
21-03-2005

EVALUATION Name: dkR10074 Date: 05/06/2004 The problem is common for both TextArea and TextField components. To fix this we have to override peer's enable() and disable() methods of TextArea and TextField classes. However, there will be a case when setEnabled() is called while peer is null. It has to be fixed too. This is XAWT related problem only. ###@###.### 2004-05-06 ====================================================================== There's a non-uniformity on Windows - disabled TextArea does gray out the background, disabled TextField does not. We should probably fix this also. ###@###.### 2005-03-21 17:39:01 GMT
21-03-2005