/** * When the dragging is detected, we place the content of the LabelCell * in the DragBoard. */ void setOnDragDetected() { setOnDragDetected(event -> { boolean isParentTask = getTreeItem().getParent().equals(root); boolean isEmpty = getTreeItem().getValue().getText().equals(""); if (!isEmpty && isParentTask) { Dragboard db = startDragAndDrop(TransferMode.MOVE); ClipboardContent content = new ClipboardContent(); content.put(controller.DATA_FORMAT, getTreeItem() .getValue()); db.setContent(content); } event.consume(); }); }
@FXML private void initialize() throws IOException { root.getChildren().addListener((ListChangeListener<? super Node>) change -> { while (change.next()) { for (Node node : change.getAddedSubList()) { if (node instanceof WidgetGallery.WidgetGalleryItem) { WidgetGallery.WidgetGalleryItem galleryItem = (WidgetGallery.WidgetGalleryItem) node; galleryItem.setOnDragDetected(event -> { Dragboard dragboard = galleryItem.startDragAndDrop(TransferMode.COPY); // TODO type safety ClipboardContent clipboard = new ClipboardContent(); clipboard.put(DataFormats.widgetType, galleryItem.getWidget().getName()); dragboard.setContent(clipboard); event.consume(); }); } } } }); }
/** * Adds to the letter the possibility to be dragged on another element. * * @param letterElement The element to be dragged * @param letter The corresponding letter object */ public static void makeLetterDraggable(Node letterElement, LetterInterface letter) { // When an user starts to drag a letter letterElement.setOnDragDetected(event -> { Dragboard dragboard = letterElement.startDragAndDrop(TransferMode.ANY); dragboard.setDragView(letterElement.snapshot(null, null)); letterElement.setVisible(false); ClipboardContent clipboardContent = new ClipboardContent(); clipboardContent.put(LetterInterface.DATA_FORMAT, letter); dragboard.setContent(clipboardContent); event.consume(); }); // When the user has dropped the letter letterElement.setOnDragDone(event -> letterElement.setVisible(true)); }
@Override protected String call() throws Exception { final String url = PictureUploadUtil.getUrl(file.getAbsolutePath()); Platform.runLater(() -> { labelHint.setText(""); Alert alert = new Alert( Alert.AlertType.INFORMATION, url, new ButtonType("复制到剪切板", ButtonBar.ButtonData.YES) ); alert.setTitle("上传成功"); alert.setHeaderText(null); Optional<ButtonType> buttonType = alert.showAndWait(); if (buttonType.get().getButtonData().equals(ButtonBar.ButtonData.YES)) { Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent cc = new ClipboardContent(); cc.putString(url); clipboard.setContent(cc); } }); return url; }
private void setMenuItemDefaultActions() { connectMenuItem.setOnAction(__ -> { getFirstIfAnythingSelected().ifPresent(server -> GTAController.tryToConnect(server.getAddress(), server.getPort())); }); visitWebsiteMenuItem.setOnAction(__ -> getFirstIfAnythingSelected().ifPresent(server -> OSUtility.browse(server.getWebsite()))); addToFavouritesMenuItem.setOnAction(__ -> { final List<SampServer> serverList = getSelectionModel().getSelectedItems(); serverList.forEach(FavouritesController::addServerToFavourites); }); removeFromFavouritesMenuItem.setOnAction(__ -> deleteSelectedFavourites()); copyIpAddressAndPortMenuItem.setOnAction(__ -> { final Optional<SampServer> serverOptional = getFirstIfAnythingSelected(); serverOptional.ifPresent(server -> { final ClipboardContent content = new ClipboardContent(); content.putString(server.getAddress() + ":" + server.getPort()); Clipboard.getSystemClipboard().setContent(content); }); }); }
@FXThread @Override protected void execute(@Nullable final ActionEvent event) { super.execute(event); final Array<ResourceElement> elements = getElements(); final Array<Path> files = ArrayFactory.newArray(Path.class, elements.size()); elements.forEach(files, (resource, toStore) -> toStore.add(resource.getFile())); final ClipboardContent content = new ClipboardContent(); EditorUtil.addCopiedFile(files, content); final Clipboard clipboard = Clipboard.getSystemClipboard(); clipboard.setContent(content); }
@FXThread @Override protected void execute(@Nullable final ActionEvent event) { super.execute(event); final List<File> files = getElements().stream() .map(ResourceElement::getFile) .map(Path::toFile) .collect(toList()); final ClipboardContent content = new ClipboardContent(); content.putFiles(files); content.put(EditorUtil.JAVA_PARAM, "cut"); final Clipboard clipboard = Clipboard.getSystemClipboard(); clipboard.setContent(content); }
private void initializeSetOnDragDetected() { // LoggerFacade.INSTANCE.debug(this.getClass(), "Initialize setOnDragDetected"); // NOI18N super.setOnDragDetected(event -> { if (super.getItem() == null) { return; } final Dragboard dragboard = startDragAndDrop(TransferMode.MOVE); final ClipboardContent content = new ClipboardContent(); content.putString(String.valueOf(super.getItem().getProjectId())); // dragboard.setDragView( // birdImages.get( // items.indexOf( // getItem() // ) // ) // ); dragboard.setContent(content); event.consume(); }); }
/** * 트리 드래그 디텍트 이벤트 처리. <br/> * 트리내에 구성된 파일의 위치정보를 드래그 드롭 기능으로 <br/> * 전달해주는 역할을 수행한다.<br/> * <br/> * * @작성자 : KYJ * @작성일 : 2017. 11. 21. * @param ev */ public void treeProjectFileOnDragDetected(MouseEvent ev) { TreeItem<JavaProjectFileWrapper> selectedItem = treeProjectFile.getSelectionModel().getSelectedItem(); if (selectedItem == null || selectedItem.getValue() == null) { return; } File file = selectedItem.getValue().getFile(); if (file == null || !file.exists()) return; Dragboard board = treeProjectFile.startDragAndDrop(TransferMode.LINK); ClipboardContent content = new ClipboardContent(); content.putFiles(Arrays.asList(file)); board.setContent(content); ev.consume(); }
private void keyOnPressd(KeyEvent e) { if (e.isControlDown() && e.getCode() == KeyCode.C) { if (e.isConsumed()) return; ObservableList<TreeItem<XMLMeta>> items = this.getSelectionModel().getSelectedItems(); Clipboard c = Clipboard.getSystemClipboard(); ClipboardContent cc = new ClipboardContent(); StringBuffer sb = new StringBuffer(); for (TreeItem<XMLMeta> item : items) { sb.append(item.getValue().getText()).append("\n"); } cc.putString(sb.toString()); c.setContent(cc); e.consume(); } }
public CodeAreaClipboardItemListView() { // List<ClipboardContent> clipBoardItems = parent.getClipBoardItems(); setCellFactory(TextFieldListCell.forListView(new StringConverter<ClipboardContent>() { @Override public String toString(ClipboardContent object) { return object.getString(); } @Override public ClipboardContent fromString(String string) { return null; } })); setOnKeyPressed(this::onKeyPress); setOnMouseClicked(this::onMouseClick); }
void onKeyPress(KeyEvent e) { if (e.getCode() == KeyCode.ESCAPE) { if (e.isConsumed()) return; if (this.window != null) { this.window.hide(); } e.consume(); } else if (e.getCode() == KeyCode.ENTER) { if (e.isConsumed()) return; ClipboardContent selectedItem = getSelectionModel().getSelectedItem(); if (selectItemAction(selectedItem)) this.window.hide(); e.consume(); } }
/** * Get table selection and copy it to the clipboard. * @param table * @return */ private ObservableList<CsvData> cutSelectionToClipboard(TableView<CsvData> table) { StringBuilder clipboardString = new StringBuilder(); ObservableList<CsvData> tmpData = table.getSelectionModel().getSelectedItems(); int colNum = CSVmanager.getColNums()-1; String text; if (tmpData != null) { for (int i=0;i<tmpData.size();i++) { for(int k=0;k<colNum;k++) { text = tmpData.get(i).getDataValue(k, i); clipboardString.append(text); clipboardString.append(","); } clipboardString.append("\n"); } // create clipboard content final ClipboardContent clipboardContent = new ClipboardContent(); clipboardContent.putString(clipboardString.toString()); // set clipboard content Clipboard.getSystemClipboard().setContent(clipboardContent); } return tmpData; }
@Override public void handle(final MouseEvent event) { final Pane pane = (Pane) event.getSource(); final ImageView view = (ImageView) pane.getChildren().get(0); final Dragboard db = view.startDragAndDrop(TransferMode.COPY); final ClipboardContent content = new ClipboardContent(); content.putString(view.getId()); final ComponentPane componentPane = loadComponent(pane.getChildren().get(0).getId().toLowerCase()); workspace.getChildren().add(componentPane); componentPane.applyCss(); final WritableImage w = componentPane.snapshot(null,null); workspace.getChildren().remove(componentPane); content.putImage(w); db.setContent(content); event.consume(); }
@FXML void copyValue() { if (!tableTree.isFocused()) { return; } TreeItem<ReferenceDescription> item = tableTree.getSelectionModel().getSelectedItem(); if (item != null && item.getValue() != null) { try { StringWriter writer = new StringWriter(); XmlEncoder encoder = new XmlEncoder(); encoder.setOutput(writer); writer.write("<ReferenceDescription>"); ReferenceDescription.encode(item.getValue(), encoder); writer.write("</ReferenceDescription>"); writer.flush(); Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putString(writer.toString()); clipboard.setContent(content); } catch (Exception e) { logger.error(e.getMessage(), e); } } }
@FXML public void initialize() { copyBtn.setOnAction(e -> { final ClipboardContent content = new ClipboardContent(); content.putString(textArea.getText()); Clipboard.getSystemClipboard().setContent(content); }); // Select the entire URL on focus gain wowheadUrl.focusedProperty().addListener((ChangeListener<Boolean>) (value, oldValue, newValue) -> { if (newValue) { Platform.runLater(wowheadUrl::selectAll); } }); supportedArticleTypes.setText("Supported article types: " + Stream.of(ParserType.values()).map(Object::toString).collect(Collectors.joining(", "))); }
private void copy2clipboard(TableView source) { StringBuilder out = new StringBuilder(); ObservableList<Integer> selectedCells = source.getSelectionModel().getSelectedIndices(); int columns = source.getColumns().size(); for (Integer row : selectedCells) { for (int idx = 0; idx < columns; idx++) { TableColumn tc = (TableColumn) source.getColumns().get(idx); Object item = tc.getCellData((int) row); out.append(item.toString()); if (idx != columns - 1) { out.append('\t'); } } out.append("\n"); } ClipboardContent clipboardContent = new ClipboardContent(); clipboardContent.putString(out.toString()); Clipboard.getSystemClipboard().setContent(clipboardContent); }
@SuppressWarnings("unused") @FXML void onCmdCopyEntry(ActionEvent evt) { UserCertStoreEntry entry = getSelectedStoreEntry(); if (entry != null) { List<Path> entryFilePaths = entry.getFilePaths(); if (!entryFilePaths.isEmpty()) { List<File> entryFiles = entryFilePaths.stream().map((p) -> p.toFile()).collect(Collectors.toList()); Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putFiles(entryFiles); clipboard.setContent(content); } } }
@SuppressWarnings("unused") @FXML void onCmdCopyEntryAttributes(ActionEvent evt) { TreeItem<AttributeModel> rootItem = this.ctlDetailsView.getRoot(); if (rootItem != null) { StringWriter buffer = new StringWriter(); PrintWriter writer = new PrintWriter(buffer); for (TreeItem<AttributeModel> attributeItem : rootItem.getChildren()) { copyEntryAttributesHelper(writer, attributeItem, ""); } writer.flush(); Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putString(buffer.toString()); clipboard.setContent(content); } }
private void createPopOver(final TMAEntry entry, final boolean isOverlay) { // Request full resolution image Image image = isOverlay ? cache.getOverlay(entry, -1) : cache.getImage(entry, -1); if (image == null) return; // Create PopOver to show larger image ImageView imageView = new ImageView(image); imageView.setPreserveRatio(true); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); // TODO: Consider setting max width/height elsewhere, so user can adjust? imageView.setFitWidth(Math.min(primaryScreenBounds.getWidth()*0.5, image.getWidth())); imageView.setFitHeight(Math.min(primaryScreenBounds.getHeight()*0.75, image.getHeight())); // Enable copying to clipboard miCopy.setOnAction(e -> { ClipboardContent content = new ClipboardContent(); content.putImage(image); Clipboard.getSystemClipboard().setContent(content); }); imageView.setOnContextMenuRequested(e -> menu.show(this, e.getScreenX(), e.getScreenY())); popOver = new PopOver(imageView); String name = this.getTreeTableRow().getItem() == null ? null : this.getTreeTableRow().getItem().getName(); if (name != null) popOver.setTitle(name); }
private void doDragDetected(MouseEvent e) { ObservableList<TreeItem<File>> items = assetTree.getSelectionModel().getSelectedItems(); if (items.isEmpty()) { e.consume(); return; } List<File> files = new ArrayList<>(items.size()); items.filtered(t -> t.getValue() != null).forEach(t -> {files.add(t.getValue());}); if (files.size() <= 0) { e.consume(); return; } Dragboard db = assetTree.startDragAndDrop(TransferMode.COPY_OR_MOVE); ClipboardContent clipboardContent = new ClipboardContent(); clipboardContent.put(DataFormat.FILES, files); db.setContent(clipboardContent); e.consume(); }
private void setMapContextMenu() { imgView.setOnContextMenuRequested(event -> { MenuItem copyMap = new MenuItem(" Copy map image"); copyMap.setOnAction(mapEvent -> { Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putImage(imgView.getImage()); clipboard.setContent(content); }); ContextMenu menu = new ContextMenu(copyMap); menu.show(imgView.getScene().getWindow(), event.getScreenX(), event.getScreenY()); }); }
private void setDragEvent(final SourceTreeCell cell) { // The drag starts on a gesture source cell.setOnDragDetected(event -> { SourceTreeItem item = (SourceTreeItem) cell.getTreeItem(); if (item != null && item.getState() == PathState.NORMAL) { Dragboard db = cell.startDragAndDrop(TransferMode.COPY); ClipboardContent content = new ClipboardContent(); String s = "source node - " + item.getPath(); if (s != null) { content.putString(s); db.setContent(content); } event.consume(); } }); }
private void setOnDragDetected(SchemaTreeCell cell) { cell.setOnDragDetected(event -> { TreeItem item = cell.getTreeItem(); Dragboard db = cell.startDragAndDrop(TransferMode.MOVE); ClipboardContent content = new ClipboardContent(); String s = ""; if (item instanceof SchemaNode) { s = "scheme node - " + ((SchemaNode) item).getDob().getId(); } else if (item instanceof SipPreviewNode) { s = "sip preview - " + ((SipPreviewNode) item).getSip().getId(); } content.putString(s); db.setContent(content); event.consume(); }); }
public void handleCopySpectra(Event event) { StringBuilder sb = new StringBuilder(); for (MsSpectrumDataSet dataset : datasets) { MsSpectrum spectrum = dataset.getSpectrum(); String spectrumString = TxtExportAlgorithm.spectrumToString(spectrum); String splash = SplashCalculationAlgorithm.calculateSplash(spectrum); sb.append("# "); sb.append(dataset.getName()); sb.append("\n"); sb.append("# SPLASH ID: "); sb.append(splash); sb.append("\n"); sb.append(spectrumString); sb.append("\n"); } final Clipboard clipboard = Clipboard.getSystemClipboard(); final ClipboardContent content = new ClipboardContent(); content.putString(sb.toString()); clipboard.setContent(content); }
/** Copy currently selected widgets to clipboard * @return Widgets that were copied or <code>null</code> */ public List<Widget> copyToClipboard() { if (selection_tracker.isInlineEditorActive()) return null; final List<Widget> widgets = selection.getSelection(); if (widgets.isEmpty()) return null; final String xml; try { xml = ModelWriter.getXML(widgets); } catch (Exception ex) { logger.log(Level.WARNING, "Cannot create content for clipboard", ex); return null; } final ClipboardContent content = new ClipboardContent(); content.putString(xml); Clipboard.getSystemClipboard().setContent(content); return widgets; }
/** Copy PV name to clipboard when middle button clicked * @param event Mouse pressed event */ private void hookMiddleButtonCopy(final MouseEvent event) { if (event.getButton() != MouseButton.MIDDLE) return; final String pv_name = ((PVWidget)model_widget).propPVName().getValue(); // Copy to copy/paste clipboard final ClipboardContent content = new ClipboardContent(); content.putString(pv_name); Clipboard.getSystemClipboard().setContent(content); // Copy to the 'selection' buffer used by X11 // for middle-button copy/paste // Note: This is AWT API! // JavaFX has no API, https://bugs.openjdk.java.net/browse/JDK-8088117 Toolkit.getDefaultToolkit().getSystemSelection().setContents(new StringSelection(pv_name), null); }
/** * @see javafx.event.EventHandler#handle(javafx.event.Event) */ @Override public void handle(MouseEvent event) { /* drag was detected, start a drag-and-drop gesture */ /* allow any transfer mode */ if (node_ != null) { Dragboard db = node_.startDragAndDrop(TransferMode.COPY); /* Put a string on a dragboard */ String drag = idProvider_.getConceptId(); if (drag != null && drag.length() > 0) { ClipboardContent content = new ClipboardContent(); content.putString(drag); db.setContent(content); AppContext.getService(DragRegistry.class).conceptDragStarted(); event.consume(); } } }
@FXML void editCopyImageMenu_onAction(ActionEvent event) { Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); // for paste as file, e.g. in Windows Explorer try { File tempTokenFile = fileSaveUtil.getTempFileName(false, useFileNumberingCheckbox.isSelected(), fileNameTextField.getText(), fileNameSuffixTextField); writeTokenImage(tempTokenFile); content.putFiles(java.util.Collections.singletonList(tempTokenFile)); tempTokenFile.deleteOnExit(); } catch (Exception e) { log.error(e); } // for paste as image, e.g. in GIMP content.putImage(tokenImageView.getImage()); // Finally, put contents on clip board clipboard.setContent(content); }
@FXML void tokenImageView_OnDragDetected(MouseEvent event) { Dragboard db = tokenImageView.startDragAndDrop(TransferMode.ANY); ClipboardContent content = new ClipboardContent(); boolean saveAsToken = false; try { File tempTokenFile = fileSaveUtil.getTempFileName(saveAsToken, useFileNumberingCheckbox.isSelected(), fileNameTextField.getText(), fileNameSuffixTextField); writeTokenImage(tempTokenFile); content.putFiles(java.util.Collections.singletonList(tempTokenFile)); tempTokenFile.deleteOnExit(); } catch (Exception e) { log.error(e); } finally { content.putImage(tokenImageView.getImage()); db.setContent(content); event.consume(); } }
/** * Transfers the currently selected text to the clipboard, * leaving the current selection. */ default void copy() { IndexRange selection = getSelection(); if(selection.getLength() > 0) { ClipboardContent content = new ClipboardContent(); content.putString(getSelectedText()); getStyleCodecs().ifPresent(codecs -> { Codec<StyledDocument<PS, SEG, S>> codec = ReadOnlyStyledDocument.codec(codecs._1, codecs._2, getSegOps()); DataFormat format = dataFormat(codec.getName()); StyledDocument<PS, SEG, S> doc = subDocument(selection.getStart(), selection.getEnd()); ByteArrayOutputStream os = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(os); try { codec.encode(dos, doc); content.put(format, os.toByteArray()); } catch (IOException e) { System.err.println("Codec error: Exception in encoding '" + codec.getName() + "':"); e.printStackTrace(); } }); Clipboard.getSystemClipboard().setContent(content); } }
/** * Returns all actions which can be invoked for this media item. * * They are usually visualized by a toolbar or a context menu * for each media. * */ public List<Runnable> getActions(){ List<Runnable> actions = new ArrayList<Runnable>(); for(IMediaHandler handler : mediaPresenter.getAllMediaHandlers()){ actions.add(new MediaHandlerAction(this, handler)); } // Add some hardcoded actions... actions.add(new NamedAction("Copy Link", new Runnable() { @Override public void run() { ResourceLocation mediaResource = getMediaResource(); final Clipboard clipboard = Clipboard.getSystemClipboard(); final ClipboardContent content = new ClipboardContent(); content.putString(mediaResource.getPath()); clipboard.setContent(content); } })); return actions; }
@FXML public void copyAddress(ActionEvent event) { try { ClipboardContent content = new ClipboardContent(); content.putString(getAddress()); Clipboard.getSystemClipboard().setContent(content); } catch (Exception e) { e.printStackTrace(); } }
@FXML private void copyButtonAction(ActionEvent event) { String fullText = makeStringFromTextFlow(); final Clipboard clipboard = Clipboard.getSystemClipboard(); final ClipboardContent content = new ClipboardContent(); content.putString(fullText); clipboard.setContent(content); }
@Override public ListCell<Expression> call(ListView<Expression> param) { ListCell<Expression> cell = new ListCell<Expression>() { @Override public void updateItem(Expression expression, boolean empty) { super.updateItem(expression, empty); if (empty) { setText(null); setGraphic(null); } else { setText(expression.getName()); } } }; cell.setOnDragDetected(event -> { if (!cell.isEmpty()) { Dragboard db = cell.startDragAndDrop(TransferMode.COPY); db.setDragView(new Image(SQUID_LOGO_SANS_TEXT_URL, 32, 32, true, true)); ClipboardContent cc = new ClipboardContent(); cc.putString("[\"" + cell.getItem().getName() + "\"]"); db.setContent(cc); dragExpressionSource.set(cell); } }); cell.setCursor(Cursor.CLOSED_HAND); return cell; }
@Override public ListCell<SquidRatiosModel> call(ListView<SquidRatiosModel> param) { ListCell<SquidRatiosModel> cell = new ListCell<SquidRatiosModel>() { @Override public void updateItem(SquidRatiosModel expression, boolean empty) { super.updateItem(expression, empty); if (empty) { setText(null); setGraphic(null); } else { setText(expression.getRatioName()); } } }; cell.setOnDragDetected(event -> { if (!cell.isEmpty()) { Dragboard db = cell.startDragAndDrop(TransferMode.COPY); db.setDragView(new Image(SQUID_LOGO_SANS_TEXT_URL, 32, 32, true, true)); ClipboardContent cc = new ClipboardContent(); cc.putString("[\"" + cell.getItem().getRatioName() + "\"]"); db.setContent(cc); dragSquidRatioModelSource.set(cell.getItem()); } }); cell.setCursor(Cursor.CLOSED_HAND); return cell; }
@Override public ListCell<String> call(ListView<String> param) { ListCell<String> cell = new ListCell<String>() { @Override public void updateItem(String operationOrFunction, boolean empty) { super.updateItem(operationOrFunction, empty); if (empty) { setText(null); setGraphic(null); } else { setText(operationOrFunction); } } }; cell.setOnDragDetected(event -> { if (!cell.isEmpty()) { Dragboard db = cell.startDragAndDrop(TransferMode.COPY); db.setDragView(new Image(SQUID_LOGO_SANS_TEXT_URL, 32, 32, true, true)); ClipboardContent cc = new ClipboardContent(); cc.putString(cell.getItem()); db.setContent(cc); dragSource.set(cell.getItem()); } }); cell.setCursor(Cursor.CLOSED_HAND); return cell; }
private void dragStart (MouseEvent event) { Dragboard db = startDragAndDrop(TransferMode.MOVE); ClipboardContent cc = new ClipboardContent(); db.setDragView(myFactory.getTransferImage(this), 0, 0); cc.putString(serialize(getItem(), getListView().getItems().indexOf(getItem()))); db.setContent(cc); event.consume(); }
private void dragStart () { Dragboard db = startDragAndDrop(TransferMode.COPY); ClipboardContent cc = new ClipboardContent(); cc.putString(HOLDER); db.setContent(cc); db.setDragView(getDragImage()); myTarget.draw().setOnDragOver(event -> dragOver(event)); myTarget.draw().setOnDragDropped(event -> drop(event)); }
@FXML protected void copyAddress(ActionEvent event) { // User clicked icon or menu item. Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putString(addressStr.get()); content.putHtml(String.format("<a href='%s'>%s</a>", uri(), addressStr.get())); clipboard.setContent(content); }