-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.3.0
-
generic, x86
-
generic, linux, windows_nt
Name: sl110371 Date: 07/31/2000
MS-Windows 2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
SuSE 6.4 2.2.14-kernel
java version "1.3.0beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)
Calling setBackground-methods of the TextField-Objects and the TextArea-Objects
has no effect when they are set not editable: The preset background colour
(here: gray) is set, whatever Color object you specify.
Try following source code:
import java.awt.Color;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.TextArea;
import java.awt.TextField;
class Tf_ta_test extends Frame {
TextField tfEditable;
TextField tfNotEditable;
TextArea taEditable;
TextArea taNotEditable;
Tf_ta_test() {
this.setTitle("TextField/-Area-Test");
this.setFont(new Font("SansSerif",Font.PLAIN,12));
this.setBackground(Color.lightGray);
this.setLayout(new GridLayout(4,1));
this.addWindowListener(new FrameListener(this));
tfEditable = new TextField("Dieses Feld ist editierbar!");
tfEditable.setEditable(true);
tfEditable.setForeground(Color.blue);
tfEditable.setBackground(Color.orange);
tfNotEditable = new TextField("Dieses Feld ist nicht editierbar!");
tfNotEditable.setEditable(false);
tfNotEditable.setForeground(Color.blue);
tfNotEditable.setBackground(Color.orange);
taEditable = new TextArea("Diese Fl?che ist editierbar\n" +
"mit farbigem Hintergrund!", 2, 48);
taEditable.setEditable(true);
taEditable.setForeground(Color.blue);
taEditable.setBackground(Color.orange);
taNotEditable = new TextArea("Diese Fl?che ist nicht editierbar\n" +
"ohne farbigen Hintergrund!", 2, 48);
taNotEditable.setEditable(false);
taNotEditable.setForeground(Color.blue);
taNotEditable.setBackground(Color.orange);
this.add(tfEditable);
this.add(tfNotEditable);
this.add(taEditable);
this.add(taNotEditable);
this.pack();
this.show();
} // Konstruktor
void beenden() {
System.exit(0);
}
public static void main(String[] unusedArgs) {
new Tf_ta_test();
}
}
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
class FrameListener implements WindowListener {
Tf_ta_test mFrame;
public FrameListener(Tf_ta_test frame) {
mFrame = frame;
}
public void windowClosing(WindowEvent e) {
mFrame.beenden();
}
public void windowActivated(WindowEvent e) { }
public void windowClosed(WindowEvent e) { }
public void windowDeactivated(WindowEvent e) { }
public void windowDeiconified(WindowEvent e) { }
public void windowIconified(WindowEvent e) { }
public void windowOpened(WindowEvent e) { }
}
(Review ID: 107775)
======================================================================
- duplicates
-
JDK-4378070 REGRESSION:TextArea.setBackground(color) fail if setEditable(false) in SDK 1.3.0
-
- Closed
-
-
JDK-4403599 setBackground() with TextFields got useless after bug 'fix'...
-
- Closed
-
- relates to
-
JDK-4258667 Non-editable Text fields appearing white instead of gray
-
- Resolved
-
-
JDK-4405602 Should respect TextComponent.setBackground() even when non-editable
-
- Resolved
-