All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fxmisc.richtext.demo.hyperlink.HyperlinkDemo Maven / Gradle / Ivy


package org.fxmisc.richtext.demo.hyperlink;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;

import org.fxmisc.flowless.VirtualizedScrollPane;

import java.awt.Desktop;

import java.io.IOException;

import java.net.URI;
import java.net.URISyntaxException;

import java.util.function.Consumer;

/**
 * 

Name: HyperlinkDemo

*

Description: Demonstrates the minimum needed to support custom objects (in this case, hyperlinks) alongside of text. * Note: demo does not handle cases where the link changes its state when it has already been visited. *

*

Comment: ... *

*

Copyright: Copyright (c) 2016-2019

*

Company: >StA-Soft<

* @author StA * @version 1.0 */ public class HyperlinkDemo extends Application { /** * Main-Methode. * @param args Kommandozeilenparameter */ public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { Consumer showLink = (string) -> { try { Desktop.getDesktop().browse(new URI(string)); } catch (IOException | URISyntaxException e) { throw new RuntimeException(e); } }; TextHyperlinkArea area = new TextHyperlinkArea(showLink); area.appendText("Some text in the area\n"); area.appendWithLink("Google.com", "http://www.google.com"); VirtualizedScrollPane vsPane = new VirtualizedScrollPane<>(area); Scene scene = new Scene(vsPane, 500, 500); primaryStage.setScene(scene); primaryStage.show(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy