本文整理汇总了Java中javafx.scene.control.Hyperlink.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java Hyperlink.setFont方法的具体用法?Java Hyperlink.setFont怎么用?Java Hyperlink.setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Hyperlink
的用法示例。
在下文中一共展示了Hyperlink.setFont方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTitleComponent
import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
/**
* Creates a GUI component for the title.
*
* @param anime
* {@link Anime} to show.
* @return A {@link Hyperlink} that has the title as text and the info link
* as target.
*/
protected Hyperlink getTitleComponent(final MinimalEntry anime) {
final Hyperlink title = new Hyperlink(anime.getTitle());
title.setFont(Font.font(24.0));
title.setOnMouseClicked(mouseEvent -> {
if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
try {
final Desktop desktop = java.awt.Desktop.getDesktop();
desktop.browse(new URI(anime.getInfoLink().getUrl()));
} catch (final Exception e) {
log.error("An error occurred trying to open the infolink in the default browser: ", e);
showExceptionDialog(e);
}
}
});
return title;
}
示例2: generateLabelAndLinkPane
import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
private FlowPane generateLabelAndLinkPane(String text, String url, double fontSize)
{
Font font = new Font(fontSize);
Label label = new Label(text);
label.setFont(font);
Hyperlink link = new Hyperlink(url);
link.setFont(font);
link.setOnAction(event -> Main.openInBrowser(url));
return new FlowPane(label, link);
}
示例3: addEventEntry
import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
private void addEventEntry(final Event event) {
final CheckListEntry componentListEntry = new CheckListEntry();
componentListEntry.setPictureComponent(createIcon(event.getType()));
final Font titleFont = Font.font(null, FontWeight.BOLD, 11);
if (event.getAnime() != null && event.getAnime().getInfoLink().isValid()) {
final Hyperlink title = HyperlinkBuilder.buildFrom(event.getTitle(), event.getAnime().getInfoLink().getUrl());
title.setFont(titleFont);
componentListEntry.setTitleComponent(title);
} else {
final Label lblTitle = new Label(event.getTitle());
lblTitle.setFont(titleFont);
componentListEntry.setTitleComponent(lblTitle);
}
final Label lblMessage = new Label(event.getMessage());
lblMessage.setFont((Font.font(11.5)));
lblMessage.setWrapText(true);
componentListEntry.setMessageComponent(lblMessage);
if (event instanceof CrcEvent) {
addCrcEventButton((CrcEvent) event, componentListEntry);
}
if (event instanceof ReversibleCommandEvent) {
addReversibleCommandEventButton((ReversibleCommandEvent) event, componentListEntry);
}
addComponentListEntryToGridPane(componentListEntry);
}
示例4: initHeaderAndLink
import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
void initHeaderAndLink() {
headerText = new Text();
headerText.setFont(Font.font("sansserif", FontWeight.LIGHT, 14));
headerText.setFill(Color.YELLOWGREEN);
link_to_wikt = new Hyperlink();
link_to_wikt.setFont(Font.font("sansserif", FontWeight.LIGHT, 12));
link_to_wikt.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
//System.out.println("This link is clicked");
try {
URI u = new URI(link_to_wikt.getText());
java.awt.Desktop.getDesktop().browse(u);
//def desktopClass = Class.forName("java.awt.Desktop");
//def desktop = desktopClass.getMethod("getDesktop").invoke(null);
//def browseMethod = desktopClass.getMethod("browse", [URI.class] as java.lang.Class[]);
//browseMethod.invoke(desktop, new URI(link_to_wikt.text));
} catch (final Exception exc) {
System.out.println("Error: the following link could not be open:" + link_to_wikt.getText());
}
}
});
}
示例5: AboutDialog
import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
public AboutDialog(final HostServices hostServices) {
super();
this.hostServices = hostServices;
final DialogPane dialogPane = getDialogPane();
final StackPane stackPane = new StackPane();
stackPane.setMaxWidth(Double.MAX_VALUE);
stackPane.setAlignment(Pos.CENTER_LEFT);
setTitle("About");
dialogPane.getButtonTypes().addAll(ButtonType.OK);
final TextFlow textFlow = new TextFlow();
String family = "Arial";
double size = 12;
final Text text0 = new Text("FixPad - by Ben Warner\n");
text0.setFont(Font.font(family, FontWeight.BOLD, FontPosture.REGULAR, 14));
final Text text1 = new Text("\nA small app to convert snippets of fix into a more readable format. It is covered by the GNU GENERAL PUBLIC LICENSE (free to use commercially and non-commercially). Find it on github at:\n");
text1.setFont(Font.font(family, size));
final Hyperlink text2 = new Hyperlink("https://github.com/fix4j/fix4j-fixpad");
text2.setFont(Font.font(family, FontWeight.BOLD, size));
text2.setOnAction(t -> { this.hostServices.showDocument(text2.getText()); });
final Text text3 = new Text("\n\nFixPad uses the fix4j-assert API to build the readable strings. fix4j-assert is a Java based framework for testing FIX applications. Find it at:\n");
text1.setFont(Font.font(family, size));
final Hyperlink text4 = new Hyperlink("https://github.com/fix4j/fix4j-assert");
text4.setFont(Font.font(family, FontWeight.BOLD, size));
text4.setOnAction(t -> {
this.hostServices.showDocument(text4.getText());
});
final Text text5 = new Text("\n\nCheck out github for some more of our software efforts:\n");
text1.setFont(Font.font(family, size));
final Text lineBreak1 = new Text("\n");
final Hyperlink text6 = new Hyperlink("https://github.com/tools4j/decimal4j");
text6.setFont(Font.font(family, FontWeight.BOLD, size));
text6.setOnAction(t -> {
this.hostServices.showDocument(text6.getText());
});
final Text lineBreak2 = new Text("\n");
final Hyperlink text7 = new Hyperlink("https://github.com/tools4j/unix4j");
text7.setFont(Font.font(family, FontWeight.BOLD, size));
text7.setOnAction(t -> {
this.hostServices.showDocument(text7.getText());
});
final Hyperlink text8 = new Hyperlink("https://github.com/tools4j/meanvar");
text8.setFont(Font.font(family, FontWeight.BOLD, size));
text8.setOnAction(t -> {
this.hostServices.showDocument(text8.getText());
});
textFlow.getChildren().addAll(text0, text1, text2, text3, text4, text5, text6, lineBreak1, text7, lineBreak2, text8);
textFlow.setPrefWidth(400);
stackPane.getChildren().clear();
stackPane.getChildren().add(textFlow);
getDialogPane().setContent(stackPane);
}
示例6: getTitleComponent
import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
/**
* Creates a GUI component for the title.
*
* @param anime
* {@link Anime} to show.
* @return A {@link Hyperlink} that has the title as text and the info link
* as target.
*/
protected Hyperlink getTitleComponent(final MinimalEntry anime) {
final Hyperlink title = HyperlinkBuilder.buildFrom(anime.getTitle(), anime.getInfoLink().getUrl());
title.setFont(Font.font(24.0));
return title;
}