Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8128389

Native clipboard/dragboard: passing data to native application doesn't work.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • fx2.0.2
    • fx2.0.2
    • javafx
    • 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();
          }
      }

            psafrata Pavel Ĺ afrata
            anazarov Andrey Nazarov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: