-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.4.0
-
sparc
-
solaris_7
Name: sdR10048 Date: 01/25/2001
public void javax.swing.JTextField.copy()
throws unexpected HeadlessException in headless mode.
Javadoc says:
--------------------------------------------------
public void copy()
Transfers the currently selected range in the associated text
model to the system clipboard, leaving the contents in the text
model. The current selection remains intact. Does nothing for
null selections.
See Also:
Toolkit.getSystemClipboard(), Clipboard
See example:
--------------------------------------------------
dsv@falcon ~/tmp
% cat Test.java
public class Test {
public static void main(String[] args) {
(new javax.swing.JTextField()).copy();
}
}
dsv@falcon ~/tmp
% java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b48)
Java HotSpot(TM) Client VM (build 1.4beta-B48, mixed mode)
dsv@falcon ~/tmp
% javac Test.java
dsv@falcon ~/tmp
% java -Djava.awt.headless=true Test
Exception in thread "main" java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getSystemClipboard(HeadlessToolkit.java:278)
at javax.swing.TransferHandler$TransferAction.getClipboard(TransferHandler.java:735)
at javax.swing.TransferHandler$TransferAction.actionPerformed(TransferHandler.java:716)
at javax.swing.text.JTextComponent.copy(JTextComponent.java:1056)
at Test.main(Test.java:3)
^C
--------------------------------------------------
======================================================================
- duplicates
-
JDK-4409197 JTextComponent.cut,copy,paste throws HeadlessException
- Resolved