Name: jk109818 Date: 02/27/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Server VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION : Sun OS 5.8
ADDITIONAL OPERATING SYSTEMS : Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Tested on Sun Rays as well an Linux windowing environments.
A DESCRIPTION OF THE PROBLEM :
On Solaris/CDE and Linux/KDE, and probably all other X
windowing systems, copy paste is accomplished with selecting
text to be copied with the left mouse button and pasting
with center mouse. This method of copy paste still works on
JTextAreas even after they are set "uneditable". No other
method of inserting text that I know of allows text
insertion when the area is set uneditable.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Copy the code, below, compile and run.
2. Attempt to paste using one click method.
3. Press button to see pasted text output to console.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected:
The paste should not work on an uneditable text area.
Actual:
The one click paste succeeds on the uneditable area.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//Here is a small sample program to duplicate this bug. The button which outputs
//the area's contents to the screen provides proof that the text has been
//inserted.
import javax.swing.*;
import java.awt.event.*;
public class JTest {
JTextArea jt;
JFrame frame;
public JTest() {
frame = new JFrame("JTextArea Bug");
jt = new JTextArea(10,7);
jt.setEditable(false);
JButton button = new JButton("output to stout");
button.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println(jt.getText());
}
});
Box box = new Box(BoxLayout.Y_AXIS);
box.add(jt);
box.add(button);
frame.getContentPane().add(box);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
new JTest();
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
None known to me
(Review ID: 143474)
======================================================================