Package javafx.scene.input

Examples of javafx.scene.input.Clipboard


    final MenuItem copy = new MenuItem("copy");
    copy.setAccelerator(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN));
    copy.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        final Clipboard clipboard = Clipboard.getSystemClipboard();
          final ClipboardContent content = new ClipboardContent();
          content.putString(treeView.getSelectionModel().getSelectedItem().getValue().displayname);
          clipboard.setContent(content);
      }
    });
    copy.disableProperty().bind(treeView.getSelectionModel().selectedItemProperty().isNull());
    contextMenu.getItems().add(copy);
    treeView.setContextMenu(contextMenu);
View Full Code Here


    });
   
    copyButton.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        final Clipboard clipboard = Clipboard.getSystemClipboard();
          final ClipboardContent content = new ClipboardContent();
          content.putString(resultTextarea.getText());
          clipboard.setContent(content);
      }
    });
   
    timeColumn.prefWidthProperty().bind(resultTable.widthProperty().subtract(3).multiply(0.15));
        loglevelColumn.prefWidthProperty().bind(resultTable.widthProperty().subtract(3).multiply(0.05));
View Full Code Here

        ContextMenu menue = new ContextMenu();
        MenuItem item = new MenuItem("copy to clipboard");
        item.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            final Clipboard clipboard = Clipboard.getSystemClipboard();
              final ClipboardContent content = new ClipboardContent();
              content.putString(area.getText());
              clipboard.setContent(content);
          }
        });
        menue.getItems().add(item);
        area.setContextMenu(menue);
       
View Full Code Here

    });
   
    copyButton.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        final Clipboard clipboard = Clipboard.getSystemClipboard();
          final ClipboardContent content = new ClipboardContent();
          content.putString(resultTextarea.getText());
          clipboard.setContent(content);
      }
    });
    }
View Full Code Here

        if (selection == null || selection.length() == 0) {
            return;
        }
        Platform.runLater(() -> {
            try {
                Clipboard clipboard = Clipboard.getSystemClipboard();
                ClipboardContent content = new ClipboardContent();
                content.putString(selection);
                clipboard.setContent(content);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
    }
View Full Code Here

        if (selection == null || selection.length() == 0) {
            return;
        }
        Platform.runLater(() -> {
            try {
                Clipboard clipboard = Clipboard.getSystemClipboard();
                ClipboardContent content = new ClipboardContent();
                content.putString(selection);
                clipboard.setContent(content);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
    }
View Full Code Here

        if (selection == null || selection.length() == 0) {
            return;
        }
        Platform.runLater(() -> {
            try {
                Clipboard clipboard = Clipboard.getSystemClipboard();
                ClipboardContent content = new ClipboardContent();
                content.putString(selection);
                clipboard.setContent(content);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
    }
View Full Code Here

                                if (pfx.equals("[")){
                                    statusField.appendText(outPath + "\n");
                                }else {
                                    String fullHTMLString = "";
                                    try {
                                    final Clipboard clipboard = Clipboard.getSystemClipboard();
                                    final ClipboardContent content = new ClipboardContent();
                                    // br fix required because html output-method seems to be affected by xhtml namespace
                                    fullHTMLString = HTMLRender.getFileContent("file:///" + outPath).replace("<br></br>", "<br />");
                                    fullHTMLString = fullHTMLString.replace("<body>", "<body style=\"background-color:#454545;\">");
                                    int initStart = fullHTMLString.indexOf("style=") + 1;
                                    int start = fullHTMLString.indexOf("style=", initStart) + 7;
                                    int end = fullHTMLString.lastIndexOf("</pre>") + 6;
                                    String divString = "<pre style=\"white-space: nowrap; ";
                                    String preString = divString + fullHTMLString.substring(start, end);
                                    content.putString(preString);
                                    clipboard.setContent(content);
                                    } catch (Exception e){}
                                    eng.loadContent(fullHTMLString);
                                    //eng.load("file:///" + outPath);
                                }
                        }
View Full Code Here

        Tooltip tooltip = new Tooltip(String.format("%s: %s", icon.name(), icon.toUnicode()));
        Button b = AwesomeDude.createIconButton(icon, text, "2em", "0.8em", ContentDisplay.TOP);
        b.setTooltip(tooltip);
        b.setPrefWidth(180.0);
        b.setOnAction((ActionEvent t) -> {
            Clipboard clipboard = Clipboard.getSystemClipboard();
            final ClipboardContent content = new ClipboardContent();
            content.putString(icon.name());
            clipboard.setContent(content);
        });
        return b;
    }
View Full Code Here

    }

    @FXML
    protected void copyAddress(ActionEvent event) {
        // User clicked icon or menu item.
        Clipboard clipboard = Clipboard.getSystemClipboard();
        ClipboardContent content = new ClipboardContent();
        content.putString(getAddress());
        content.putHtml(String.format("<a href='%s'>%s</a>", uri(), getAddress()));
        clipboard.setContent(content);
    }
View Full Code Here

TOP

Related Classes of javafx.scene.input.Clipboard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.