Example usage for javafx.scene.control Hyperlink Hyperlink

List of usage examples for javafx.scene.control Hyperlink Hyperlink

Introduction

In this page you can find the example usage for javafx.scene.control Hyperlink Hyperlink.

Prototype

public Hyperlink(String text) 

Source Link

Document

Create a hyperlink with the specified text as its label.

Usage

From source file:com.bekwam.resignator.ResignatorAppMainViewController.java

@FXML
public void openJarsignerConfig() {

    clearValidationErrors();//from w  w  w  .  j a  v  a  2  s. c o  m

    if (StringUtils.isNotEmpty(activeConfiguration.getJDKHome())) {

        JarsignerConfigController jarsignerConfigView = jarsignerConfigControllerProvider.get();
        jarsignerConfigView.setParent(this);
        try {
            jarsignerConfigView.show();
        } catch (Exception exc) {
            String msg = "Error launching jarsigner config";
            logger.error(msg, exc);
            Alert alert = new Alert(Alert.AlertType.ERROR, msg);
            alert.showAndWait();
        }
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("[OPEN JARSIGNER CONFIG] JDK_HOME not set");
        }

        Alert alert = new Alert(Alert.AlertType.ERROR, "Set JDK_HOME in File > Settings");
        alert.setHeaderText("JDK_HOME not defined");

        FlowPane fp = new FlowPane();
        Label lbl = new Label("Set JDK_HOME in ");
        Hyperlink link = new Hyperlink("File > Settings");
        fp.getChildren().addAll(lbl, link);

        link.setOnAction((evt) -> {
            alert.close();
            openSettings();
        });

        alert.getDialogPane().contentProperty().set(fp);

        alert.showAndWait();
    }
}

From source file:net.thirdy.blackmarket.controls.Dialogs.java

public static void showAbout() {
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.setGraphic(new Region());
    alert.setTitle("Blackmarket " + BlackmarketApplication.VERSION);
    alert.setContentText("");
    alert.setHeaderText("");

    TextArea textArea = new TextArea("Copyright 2015 Vicente de Rivera III" + "\r\n"
            + "\r\n http://thirdy.github.io/blackmarket" + "\r\n"
            + "\r\n This program is free software; you can redistribute it and/or"
            + "\r\n modify it under the terms of the GNU General Public License"
            + "\r\n as published by the Free Software Foundation; either version 2"
            + "\r\n of the License, or (at your option) any later version." + "\r\n"
            + "\r\n This program is distributed in the hope that it will be useful,"
            + "\r\n but WITHOUT ANY WARRANTY; without even the implied warranty of"
            + "\r\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the"
            + "\r\n GNU General Public License for more details." + "\r\n"
            + "\r\n You should have received a copy of the GNU General Public License"
            + "\r\n along with this program; if not, write to the Free Software"
            + "\r\n Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA." + "\r\n");
    textArea.setEditable(false);/*from  w  ww. j a  va  2 s  .  c  o  m*/
    textArea.setWrapText(true);

    Hyperlink website = new Hyperlink("Visit Blackmarket Homepage");
    website.setOnAction(e -> {
        try {
            SwingUtil.openUrlViaBrowser("http://thirdy.github.io/blackmarket/");
        } catch (BlackmarketException ex) {
            logger.error(ex.getMessage(), ex);
        }
    });

    Hyperlink exwebsite = new Hyperlink("Visit Exile Tools Homepage");
    exwebsite.setOnAction(e -> {
        try {
            SwingUtil.openUrlViaBrowser("http://exiletools.com/");
        } catch (BlackmarketException ex) {
            logger.error(ex.getMessage(), ex);
        }
    });

    VBox content = new VBox(new ImageView(new Image("/images/blackmarket-logo.png")), new Label(
            "Blackmarket is fan-made software for Path of Exile but is not affiliated with Grinding Gear Games in any way."),
            new Label("A few tips:"), new Label("CTRL + Space - hot key to slide the search control pane"),
            new Label("CTRL + Enter - hot key to run the search"),
            new Label("Advance mode grants you power overwhelming of Elastic Search"),
            new Label("For more information and updates,"), website,
            new Label("Blackmarket uses Exile Tools Shop Indexer Elastic Search API:"), exwebsite,
            new Label("Comics by /u/gallio"),
            new Label("Blackmarket is 100% Free and Open Source Software under GPLv2:"), textArea);
    content.setSpacing(8);
    alert.getDialogPane().setContent(content);
    alert.showAndWait();

}

From source file:org.noroomattheinn.visibletesla.dialogs.VersionUpdater.java

public static boolean checkForNewerVersion(String thisVersion, Stage stage, final HostServices svcs,
        boolean experimentalOK) {

    final Versions versions = Versions.getVersionInfo(VersionsFile);
    if (versions == null)
        return false; // Missing, empty, or corrupt versions file

    List<Release> releases = versions.getReleases();

    if (releases != null && !releases.isEmpty()) {
        Release lastRelease = null;/*from  www  .  j a  va 2s. c om*/
        for (Release cur : releases) {
            if (cur.getInvisible())
                continue;
            if (cur.getExperimental() && !experimentalOK)
                continue;
            lastRelease = cur;
            break;
        }
        if (lastRelease == null)
            return false;
        String releaseNumber = lastRelease.getReleaseNumber();
        if (Utils.compareVersions(thisVersion, releaseNumber) < 0) {
            VBox customPane = new VBox();
            String msgText = String.format(
                    "A newer version of VisibleTesla is available:\n" + "Version: %s, Date: %tD", releaseNumber,
                    lastRelease.getReleaseDate());
            Label msg = new Label(msgText);
            Hyperlink platformLink = null;
            final URL platformURL;
            final String linkText;
            if (SystemUtils.IS_OS_MAC) {
                linkText = "Download the latest Mac version";
                platformURL = lastRelease.getMacURL();
            } else if (SystemUtils.IS_OS_WINDOWS) {
                linkText = "Download the latest Windows version";
                platformURL = lastRelease.getWindowsURL();
            } else {
                linkText = "Download the latest Generic version";
                platformURL = lastRelease.getReleaseURL();
            }
            if (platformURL != null) {
                platformLink = new Hyperlink(linkText);
                platformLink.setStyle("-fx-color: blue; -fx-text-fill: blue;");
                platformLink.setOnAction(new EventHandler<ActionEvent>() {
                    @Override
                    public void handle(ActionEvent t) {
                        svcs.showDocument(platformURL.toExternalForm());

                    }
                });
            }
            Hyperlink rnLink = new Hyperlink("Click to view the release notes");
            rnLink.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent t) {
                    svcs.showDocument(versions.getReleaseNotes().toExternalForm());

                }
            });
            customPane.getChildren().addAll(msg, rnLink);
            customPane.getChildren().add(platformLink);
            Dialogs.showCustomDialog(stage, customPane, "Newer Version Available", "Checking for Updates",
                    Dialogs.DialogOptions.OK, null);
            return true;
        }
    }
    return false;
}

From source file:ui.main.MainViewController.java

private synchronized void paintReceivedFile(Chat chat, String path, String time) {
    //this method paints the recieved picture message
    Task<HBox> recievedMessages = new Task<HBox>() {
        @Override/*w  w w . j a  v  a2 s  . co  m*/
        protected HBox call() throws Exception {
            Thread.sleep(100);
            VBox vbox = new VBox(); //to add text

            ImageView imageRec = new ImageView(chatterAvatar.getImage()); //image
            imageRec.setFitHeight(60);
            imageRec.setFitWidth(50);

            String strChatterName = chat.getParticipant(); //add name of the chatter with light color
            strChatterName = Character.toUpperCase(strChatterName.charAt(0))
                    + strChatterName.substring(1, strChatterName.indexOf("@"));
            Label chatterName = new Label(strChatterName);
            chatterName.setDisable(true);

            Label timeL = new Label(time);
            timeL.setDisable(true);
            timeL.setFont(new Font("Arial", 10));

            Hyperlink link = new Hyperlink("File Recieved: " + path);
            link.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<javafx.scene.input.MouseEvent>() {
                @Override
                public void handle(javafx.scene.input.MouseEvent event) {
                    try {
                        if (event.getButton() == MouseButton.PRIMARY) {
                            Runtime.getRuntime().exec("explorer.exe /select," + path);
                        }
                    } catch (IOException ex) {
                        Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            });
            vbox.getChildren().addAll(chatterName, link, timeL);
            vbox.setAlignment(Pos.CENTER_RIGHT);
            HBox hbox = new HBox();
            //bbl.setBubbleSpec(BubbleSpec.FACE_LEFT_CENTER);
            hbox.getChildren().addAll(imageRec, vbox);
            return hbox;
        }
    };

    recievedMessages.setOnSucceeded(event -> {
        chatList.getChildren().add(recievedMessages.getValue());
    });

    if (chat.getParticipant().contains(currentChat.getParticipant())) {
        Thread t = new Thread(recievedMessages);
        //t.setDaemon(true);
        t.start();
        try {
            t.join();
        } catch (InterruptedException ex) {
            Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    //set the received chat message appear on the screen
    if (chat.getParticipant().contains(currentChat.getParticipant())) {
        Thread t = new Thread(recievedMessages);
        t.start();
    }
    Task t = new Task() {
        @Override
        protected Object call() throws Exception {
            Thread.sleep(2500);
            return new Object();
        }
    };

    t.setOnSucceeded(value -> scrollPane.setVvalue(scrollPane.getHmax()));

    Thread thread1 = new Thread(t);
    thread1.start();

}

From source file:ui.main.MainViewController.java

private synchronized void paintSentFile(Chat chat, String path, String time) {
    //this method paints the recieved picture message
    Task<HBox> recievedMessages = new Task<HBox>() {
        @Override/* w w w .  j a v  a  2  s.  c  om*/
        protected HBox call() throws Exception {
            Thread.sleep(100);
            VBox vbox = new VBox(); //to add text

            ImageView imageRec = new ImageView(myAvatar.getImage()); //image
            imageRec.setFitHeight(60);
            imageRec.setFitWidth(50);

            Label timeL = new Label(time);
            timeL.setDisable(true);
            timeL.setFont(new Font("Arial", 10));

            Label chatterName = new Label(name.getText());
            chatterName.setDisable(true);

            Hyperlink link = new Hyperlink("File Sent: " + path);
            link.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<javafx.scene.input.MouseEvent>() {
                @Override
                public void handle(javafx.scene.input.MouseEvent event) {
                    try {
                        if (event.getButton() == MouseButton.PRIMARY) {
                            Runtime.getRuntime().exec("explorer.exe /select," + path);
                        }
                    } catch (IOException ex) {
                        Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            });
            vbox.getChildren().addAll(chatterName, link, timeL);
            vbox.setAlignment(Pos.CENTER_LEFT);
            HBox hbox = new HBox();
            hbox.setAlignment(Pos.CENTER_RIGHT);
            //bbl.setBubbleSpec(BubbleSpec.FACE_LEFT_CENTER);
            hbox.getChildren().addAll(vbox, imageRec);
            return hbox;
        }
    };

    recievedMessages.setOnSucceeded(event -> {
        chatList.getChildren().add(recievedMessages.getValue());
    });

    if (chat.getParticipant().contains(currentChat.getParticipant())) {
        Thread t = new Thread(recievedMessages);
        t.start();
        try {
            t.join();
        } catch (InterruptedException ex) {
            Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}