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:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);//from w w w  .j  a  v  a2s  .  com
    stage.setHeight(500);
    Scene scene = new Scene(new Group());
    VBox root = new VBox();
    Hyperlink link = new Hyperlink("www.java2s.com");

    root.getChildren().addAll(link);
    scene.setRoot(root);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);/*  www.  ja  v  a 2  s.  c  om*/
    stage.setHeight(500);
    Scene scene = new Scene(new Group());
    VBox root = new VBox();

    Hyperlink hpl = new Hyperlink("java2s.com");

    hpl.setFont(Font.font("Arial", 14));

    root.getChildren().addAll(hpl);

    scene.setRoot(root);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);/*from w  w  w  . jav a  2 s  . c  om*/
    stage.setHeight(500);
    Scene scene = new Scene(new Group());
    VBox root = new VBox();

    Hyperlink hpl = new Hyperlink("java2s.com");

    Image image1 = new Image(new File("a.jpg").toURI().toString(), 0, 100, false, false);
    hpl.setFont(Font.font("Arial", 14));
    hpl.setGraphic(new ImageView(image1));
    root.getChildren().addAll(hpl);

    scene.setRoot(root);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);//from www .j  a  v a2s  . c  o  m
    stage.setHeight(500);
    Scene scene = new Scene(new Group());
    VBox root = new VBox();
    final WebView browser = new WebView();
    final WebEngine webEngine = browser.getEngine();
    Hyperlink hpl = new Hyperlink("java2s.com");
    hpl.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            webEngine.load("http://java2s.com");
        }
    });

    root.getChildren().addAll(hpl, browser);
    scene.setRoot(root);

    stage.setScene(scene);
    stage.show();
}

From source file:de.micromata.mgc.javafx.launcher.gui.AboutDialogController.java

@Override
public void initializeWithModel() {
    MgcApplicationInfo ai = model.getApplicationInfo();

    AnchorPane.setTopAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setRightAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setLeftAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setTopAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setRightAnchor(licensePanel, 2.0);
    AnchorPane.setLeftAnchor(licensePanel, 2.0);
    AnchorPane.setRightAnchor(licenceTextArea, 5.0);
    AnchorPane.setLeftAnchor(licenceTextArea, 2.0);
    //    AnchorPane.setTopAnchor(licensePanel, 100.0);
    //    AnchorPane.setBottomAnchor(configurationTabs, 5.0);
    AnchorPane.setRightAnchor(buttonPanel, 2.0);
    AnchorPane.setLeftAnchor(buttonPanel, 2.0);
    AnchorPane.setBottomAnchor(buttonPanel, 2.0);

    okButton.setOnAction(event -> getStage().close());

    String name = ai.getName() + " " + ai.getVersion();
    Text text1 = new Text(name);
    text1.setFont(Font.font("Verdana", FontWeight.BOLD, 20));
    Text text2 = new Text("\n\n" + ai.getCopyright() + "\n");
    TextFlow apptext = new TextFlow(text1, text2);
    appInfo.getChildren().add(apptext);//from   w  ww . j  a  v a  2 s. co  m

    if (ai.getLogoLargePath() != null) {
        logo.setImage(new Image(this.getClass().getResource(ai.getLogoLargePath()).toString()));
    }

    String sdetailText = ai.getDetailInfo();
    if (StringUtils.isNotBlank(ai.getLicense()) == true) {
        sdetailText += "\n\nLicense: " + ai.getLicense();
    }
    TextFlow detailText = new TextFlow();
    detailText.getChildren().add(new Text(sdetailText));

    if (StringUtils.isNotBlank(ai.getHomeUrl()) == true) {
        detailText.getChildren().add(new Text("\n\nHomepage: "));
        Hyperlink hlink = new Hyperlink(ai.getHomeUrl());
        hlink.setOnAction(event -> SystemService.get().openUrlInBrowser(ai.getHomeUrl()));
        detailText.getChildren().add(hlink);
    }
    appDetails.getChildren().add(detailText);
    initLicenseText();
}

From source file:Main.java

private void createClipList(GridPane grid) {
    final VBox vbox = new VBox(30);
    vbox.setAlignment(Pos.TOP_CENTER);/*from ww w .ja  va 2  s .  co m*/

    final Label clipLabel = new Label("Code Monkey To-Do List:");
    clipLabel.setId("clipLabel");

    final Button getUpButton = new Button("Get Up, Get Coffee");
    getUpButton.setPrefWidth(300);
    getUpButton.setOnAction(createPlayHandler(coffeeClip));

    final Button goToJobButton = new Button("Go to Job");
    goToJobButton.setPrefWidth(300);
    goToJobButton.setOnAction(createPlayHandler(jobClip));

    final Button meetingButton = new Button("Have Boring Meeting");
    meetingButton.setPrefWidth(300);
    meetingButton.setOnAction(createPlayHandler(meetingClip));

    final Hyperlink link = new Hyperlink("About Code Monkey...");
    link.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            WebView wv = new WebView();
            wv.getEngine().load("http://www.jonathancoulton.com/2006/04/14/" + "thing-a-week-29-code-monkey/");

            Scene scene = new Scene(wv, 720, 480);

            Stage stage = new Stage();
            stage.setTitle("Code Monkey");
            stage.setScene(scene);
            stage.show();
        }
    });

    vbox.getChildren().addAll(clipLabel, getUpButton, goToJobButton, meetingButton, link);

    GridPane.setHalignment(vbox, HPos.CENTER);
    GridPane.setHgrow(vbox, Priority.ALWAYS);
    GridPane.setVgrow(vbox, Priority.ALWAYS);
    grid.add(vbox, 0, 0, GridPane.REMAINING, 1);
}

From source file:Main.java

private VBox addVBox() {

    VBox vbox = new VBox();
    vbox.setPadding(new Insets(10)); // Set all sides to 10
    vbox.setSpacing(8); // Gap between nodes

    Text title = new Text("Data");
    title.setFont(Font.font("Arial", FontWeight.BOLD, 14));
    vbox.getChildren().add(title);/*from   w w  w  . ja  v  a 2s . co  m*/

    Hyperlink options[] = new Hyperlink[] { new Hyperlink("Sales"), new Hyperlink("Marketing"),
            new Hyperlink("Distribution"), new Hyperlink("Costs") };

    for (int i = 0; i < 4; i++) {
        // Add offset to left side to indent from title
        VBox.setMargin(options[i], new Insets(0, 0, 0, 8));
        vbox.getChildren().add(options[i]);
    }

    return vbox;
}

From source file:mesclasses.view.RapportEleveController.java

private Hyperlink buildLink(Seance seance, String suffixe) {
    String text = seance.getDateAsDate().format(Constants.LONG_DATE_FORMATTER);
    if (suffixe != null) {
        text += " " + suffixe;
    }//from   ww w  . j  a v a 2  s. c o m
    text += ", cours de " + NodeUtil.getStartTime(seance.getCours());

    Hyperlink link = new Hyperlink(text);
    link.setOnAction(e -> {
        EventBusHandler.post(new SelectSeanceEvent(seance));
        EventBusHandler.post(new OpenMenuEvent(Constants.JOURNEE_VIEW));
    });
    return link;
}

From source file:mesclasses.view.RapportEleveController.java

private void drawGrid(File file) {
    Hyperlink link = new Hyperlink(file.getName());
    link.setOnAction((event) -> openFile(file));
    int rowIndex = fileGrid.addOnNewLineIfNecessary(link, 1, HPos.LEFT);

    ComboBox<String> typeBox = new ComboBox<>();
    typeBox.getItems().addAll(Constants.FILE_TYPES);
    typeBox.getSelectionModel().select(selectedFileType.get());
    typeBox.valueProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue.equals(oldValue)) {
            try {
                EleveFileUtil.moveFileForEleve(eleve, file, newValue);
                selectFileType(newValue);
                refreshGrid();/*from   w  w  w  . j  av  a2  s .  c  o  m*/
            } catch (IOException e) {
                ModalUtil.alert("Impossible de dplacer le fichier", e.getMessage());
            }
        }
    });
    fileGrid.add(typeBox, 2, rowIndex, null);

    Button deleteBtn = Btns.deleteBtn();
    deleteBtn.setOnAction(event -> {
        if (ModalUtil.confirm("Suppression du fichier", "Etes vous sr ?")) {
            if (file.delete()) {
                fileGrid.deleteRow(SmartGrid.row(deleteBtn));
            } else {
                ModalUtil.alert("Suppression impossible",
                        "Impossible de supprimer le fichier " + file.getName());
            }
        }
    });
    fileGrid.add(deleteBtn, 3, rowIndex, null);
}

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

private boolean validateSign() {

    if (logger.isDebugEnabled()) {
        logger.debug("[VALIDATE]");
    }//from  w w  w . j a  v a 2 s. com

    boolean isValid = true;

    //
    // Validate the Source JAR field
    //

    if (StringUtils.isBlank(activeProfile.getSourceFileFileName())) {

        if (!tfSourceFile.getStyleClass().contains("tf-validation-error")) {
            tfSourceFile.getStyleClass().add("tf-validation-error");
        }
        isValid = false;

    } else {

        if (!new File(activeProfile.getSourceFileFileName()).exists()) {

            if (!tfSourceFile.getStyleClass().contains("tf-validation-error")) {
                tfSourceFile.getStyleClass().add("tf-validation-error");
            }

            Alert alert = new Alert(Alert.AlertType.ERROR,
                    "Specified Source " + activeProfile.getArgsType() + " does not exist");

            alert.showAndWait();

            isValid = false;
        }
    }

    //
    // Validate the TargetJAR field
    //

    if (StringUtils.isBlank(activeProfile.getTargetFileFileName())) {
        if (!tfTargetFile.getStyleClass().contains("tf-validation-error")) {
            tfTargetFile.getStyleClass().add("tf-validation-error");
        }
        isValid = false;
    }

    if (activeProfile.getArgsType() == SigningArgumentsType.FOLDER) {

        if (StringUtils.equalsIgnoreCase(activeProfile.getSourceFileFileName(),
                activeProfile.getTargetFileFileName())) {

            if (!tfTargetFile.getStyleClass().contains("tf-validation-error")) {
                tfTargetFile.getStyleClass().add("tf-validation-error");
            }

            Alert alert = new Alert(Alert.AlertType.ERROR,
                    "Source folder and target folder cannot be the same");
            alert.showAndWait();

            isValid = false;
        }
    }

    //
    // #13 Validate the Jarsigner Config form
    //

    String jarsignerConfigField = "";
    String jarsignerConfigMessage = "";
    if (isValid && StringUtils.isBlank(activeProfile.getJarsignerConfigKeystore())) {
        jarsignerConfigField = "Keystore";
        jarsignerConfigMessage = "A keystore must be specified";
    } else if (isValid && StringUtils.isBlank(activeProfile.getJarsignerConfigStorepass())) {
        jarsignerConfigField = "Storepass";
        jarsignerConfigMessage = "A password for the keystore must be specified";
    } else if (isValid && StringUtils.isBlank(activeProfile.getJarsignerConfigAlias())) {
        jarsignerConfigField = "Alias";
        jarsignerConfigMessage = "An alias for the key must be specified";
    } else if (isValid && StringUtils.isBlank(activeProfile.getJarsignerConfigKeypass())) {
        jarsignerConfigField = "Keypass";
        jarsignerConfigMessage = "A password for the key must be specified";
    }

    if (StringUtils.isNotEmpty(jarsignerConfigMessage)) {

        if (logger.isDebugEnabled()) {
            logger.debug("[VALIDATE] jarsigner config not valid {}", jarsignerConfigMessage);
        }

        Alert alert = new Alert(Alert.AlertType.ERROR, "Set " + jarsignerConfigField + " in Configure");
        alert.setHeaderText(jarsignerConfigMessage);

        FlowPane fp = new FlowPane();
        Label lbl = new Label("Set " + jarsignerConfigField + " in ");
        Hyperlink link = new Hyperlink("Configure");
        fp.getChildren().addAll(lbl, link);

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

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

        isValid = false;
    }

    //
    // #38 check keystore prior to running
    //
    KeytoolCommand keytoolCommand = keytoolCommandProvider.get();

    Task<Boolean> keytoolTask = new Task<Boolean>() {
        @Override
        protected Boolean call() throws Exception {

            final List<String> aliases = keytoolCommand.findAliases(
                    activeConfiguration.getKeytoolCommand().toString(),
                    activeProfile.getJarsignerConfigKeystore(), activeProfile.getJarsignerConfigStorepass());
            if (logger.isDebugEnabled()) {
                logger.debug("[KEYTOOL] # aliases=" + CollectionUtils.size(aliases));
            }

            return true;
        }
    };
    new Thread(keytoolTask).start();

    try {
        if (!keytoolTask.get()) {
            if (logger.isDebugEnabled()) {
                logger.debug("[KEYTOOL] keystore or configuration not valid");
            }
            isValid = false;
        }
    } catch (InterruptedException | ExecutionException e) {

        isValid = false;
        logger.error("error accessing keystore", e);
        Alert alert = new Alert(Alert.AlertType.ERROR, e.getMessage() // contains formatted string
        );
        alert.showAndWait();
    }

    return isValid;
}