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

[Linux] clipboard doesn't work for html

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: fx2.1
    • Fix Version/s: fx2.1
    • Component/s: javafx
    • Labels:
    • Environment:

      2.1.0b08
      Linux Ubuntu 10.04
      OpenJDK 7.0

      Description

      Run code and press button "Put to clipboard"

      package javafx;

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.ButtonBuilder;
      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 SimpleApp extends Application {

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

          @Override
          public void start(Stage stage) throws Exception {
              VBox rbox = new VBox(10);

              final ClipboardContent content = new ClipboardContent();

              rbox.getChildren().add(ButtonBuilder.create().text("Put to clipboard").onAction(new EventHandler<ActionEvent>() {

                  @Override
                  public void handle(ActionEvent t) {
                      content.put(DF_CUSTOM_STRING, CONTENT_HTML);
                      Clipboard.getSystemClipboard().setContent(content);
                  }
              }).build());

              rbox.getChildren().add(ButtonBuilder.create().text("paste from clipboard").onAction(new EventHandler<ActionEvent>() {

                  @Override
                  public void handle(ActionEvent t) {
                      System.out.println(Clipboard.getSystemClipboard().getContent(DF_CUSTOM_STRING));
                  }
              }).build());

              Scene scene = new Scene(rbox, 300, 300);
              stage.setScene(scene);
              stage.show();
          }
          final static String CONTENT_HTML =
                  "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
                  + "<html xmlns=\"http://www.w3.org/1999/xhtml\">"
                  + "<head></head>"
                  + "<body><i><b>Hello!</b></i></body>"
                  + "</html>";
          final static DataFormat DF_CUSTOM_STRING = new DataFormat("dndwithcontrols.custom.html");
      }

      run:
      (<unknown>:14929): Gtk-CRITICAL **: gtk_clipboard_set_with_data: assertion `targets != NULL' failed

        Attachments

          Activity

            People

            • Assignee:
              msladecek Martin Sládeček
              Reporter:
              akirov Alexander Kirov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: