Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8118183 DnD minor bugs and DnD test tools creation
  3. JDK-8118890

Native Clipboard: passing RTF to native application doesn't work.

    Details

      Description

      To reproduce run following code, press copy "RTF to clipboard", try to paste in Open Office Writer.



      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.layout.VBox;
      import javafx.stage.Stage;

      public class ClipboardSample extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          private Parent getContent() {
              VBox list = new VBox(10);
              Button but = new Button("Copy RTF to clipboard");
              but.setOnAction(new EventHandler<ActionEvent>() {

                  @Override
                  public void handle(ActionEvent t) {
                      Clipboard cb = Clipboard.getSystemClipboard();
                      ClipboardContent cc = new ClipboardContent();
                      cc.putRtf("{\\rtf1 This is some {\\b bold} text.\\par}");
                      cb.setContent(cc);
                  }
              });

              list.getChildren().add(but);
              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();
          }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                uta Alexey Utkin (Inactive)
                Reporter:
                anazarov Andrey Nazarov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: