-
Bug
-
Resolution: Fixed
-
P2
-
fx2.0.2
-
java6
windows 7
fx 2.0.2 b04
To reproduce run following code. Press "copy to clipboard". Paste in Oracle Open Office
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DataFormat;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ClipboardSample2 extends Application {
public static void main(String[] args) {
launch(args);
}
final static DataFormat DF = new DataFormat("custom.string");
private Parent getContent() {
VBox list = new VBox(10);
Button but = new Button("Copy string to clipboard");
but.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
Clipboard cb = Clipboard.getSystemClipboard();
ClipboardContent cc = new ClipboardContent();
cc.putString("Hello world!!!");
cb.setContent(cc);
}
});
Button but2 = new Button("Copy html to clipboard");
but2.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
Clipboard cb = Clipboard.getSystemClipboard();
ClipboardContent cc = new ClipboardContent();
cc.putHtml("<html><head></head><body><b>Hello World!!!</b></body></html>");
cb.setContent(cc);
}
});
list.getChildren().add(but);
list.getChildren().add(but2);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(200);
stage.setHeight(200);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.show();
}
}
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DataFormat;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ClipboardSample2 extends Application {
public static void main(String[] args) {
launch(args);
}
final static DataFormat DF = new DataFormat("custom.string");
private Parent getContent() {
VBox list = new VBox(10);
Button but = new Button("Copy string to clipboard");
but.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
Clipboard cb = Clipboard.getSystemClipboard();
ClipboardContent cc = new ClipboardContent();
cc.putString("Hello world!!!");
cb.setContent(cc);
}
});
Button but2 = new Button("Copy html to clipboard");
but2.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
Clipboard cb = Clipboard.getSystemClipboard();
ClipboardContent cc = new ClipboardContent();
cc.putHtml("<html><head></head><body><b>Hello World!!!</b></body></html>");
cb.setContent(cc);
}
});
list.getChildren().add(but);
list.getChildren().add(but2);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(200);
stage.setHeight(200);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.show();
}
}
- duplicates
-
JDK-8128948 Ensemble Copy Source does not work
-
- Closed
-
- relates to
-
JDK-8119601 Clipboard/dragboard: serialization of custom dataformats doesn't work for strings between two fx applications.
-
- Closed
-