本文整理汇总了Java中javafx.scene.control.Tooltip.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java Tooltip.setFont方法的具体用法?Java Tooltip.setFont怎么用?Java Tooltip.setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Tooltip
的用法示例。
在下文中一共展示了Tooltip.setFont方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HelpTooltip
import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
public HelpTooltip(String tooltipText) {
// Set text as question mark and general style
this.setText("?");
this.setPrefSize(35, 35);
this.setMinSize(35, 35);
this.setFont(Font.font("System", FontWeight.BOLD, 20));
this.setAlignment(Pos.CENTER);
this.setStyle("-fx-background-color: #9098ff; -fx-background-radius: 30px");
// Create and add tooltip (need to set its font because otherwise it's inherited from the Label)
Tooltip descriptionTooltip = new Tooltip(tooltipText);
descriptionTooltip.setPrefWidth(250);
descriptionTooltip.setWrapText(true);
descriptionTooltip.setFont(new Font("System", 12));
this.setTooltip(descriptionTooltip);
}
示例2: setToolTip
import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
public void setToolTip(ImageView imageView, Image image) {
String msg = "";
msg += "image: " + image.getImageName() + "\n";
if(image.getPosition() != -1)
msg += "position: " + image.getPosition() + "\n";
if(image.getScore() != -1)
msg += "score: " + image.getScore() + "\n";
Tooltip tooltip = new Tooltip(msg);
tooltip.setFont(new Font("Arial", 16));
tooltip.setStyle("-fx-background-color: aquamarine; -fx-text-fill: black");
Tooltip.install(imageView, tooltip);
}
示例3: FxMapItem
import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
public FxMapItem(FxMapModel model, MapData data) {
mapModel = model;
itemData = data;
rect = new Rect();
rectangle = new Rectangle();
label = new Label(itemData.getName());
tooltip = new Tooltip(itemData.getName());
tooltip.setFont(new Font(DEFAULT_TOOLTIP_FONT_SIZE));
mainNode = new Group(rectangle, label);
Tooltip.install(label, tooltip);
applyStyle(model.getStyle());
if (data.hasChildrenData()) {
rectangle.setEffect(new Glow());
}
propertyChangeSupport = new PropertyChangeSupport(FxMapItem.this);
propertyChangeSupport.addPropertyChangeListener(model);
initInteractivity();
}
示例4: addLocation
import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
public void addLocation(final Location LOCATION) {
double x = (LOCATION.getLongitude() + 180) * (PREFERRED_WIDTH / 360) + MAP_OFFSET_X;
double y = (PREFERRED_HEIGHT / 2) - (PREFERRED_WIDTH * (Math.log(Math.tan((Math.PI / 4) + (Math.toRadians(LOCATION.getLatitude()) / 2)))) / (2 * Math.PI)) + MAP_OFFSET_Y;
Circle locationIcon = new Circle(x, y, size * 0.01);
locationIcon.setFill(null == LOCATION.getColor() ? getLocationColor() : LOCATION.getColor());
StringBuilder tooltipBuilder = new StringBuilder();
if (!LOCATION.getName().isEmpty()) tooltipBuilder.append(LOCATION.getName());
if (!LOCATION.getInfo().isEmpty()) tooltipBuilder.append("\n").append(LOCATION.getInfo());
String tooltipText = tooltipBuilder.toString();
if (!tooltipText.isEmpty()) {
Tooltip tooltip = new Tooltip(tooltipText);
tooltip.setFont(Font.font(10));
Tooltip.install(locationIcon, tooltip);
}
if (null != LOCATION.getMouseEnterHandler()) locationIcon.setOnMouseEntered(new WeakEventHandler<>(LOCATION.getMouseEnterHandler()));
if (null != LOCATION.getMousePressHandler()) locationIcon.setOnMousePressed(new WeakEventHandler<>(LOCATION.getMousePressHandler()));
if (null != LOCATION.getMouseReleaseHandler()) locationIcon.setOnMouseReleased(new WeakEventHandler<>(LOCATION.getMouseReleaseHandler()));
if (null != LOCATION.getMouseExitHandler()) locationIcon.setOnMouseExited(new WeakEventHandler<>(LOCATION.getMouseExitHandler()));
locations.put(LOCATION, locationIcon);
}
示例5: start
import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
Scene scene = new Scene(new Group());
stage.setTitle("Tooltip Sample");
stage.setWidth(330);
stage.setHeight(150);
total.setFont(new Font("Arial", 20));
for (int i = 0; i < rooms.length; i++) {
final CheckBox cb = cbs[i] = new CheckBox(rooms[i]);
final Integer rate = rates[i];
final Tooltip tooltip = new Tooltip("$" + rates[i].toString());
tooltip.setFont(new Font("Arial", 16));
cb.setTooltip(tooltip);
cb.selectedProperty().addListener(
(ObservableValue<? extends Boolean> ov, Boolean old_val,
Boolean new_val) -> {
if (cb.isSelected()) {
sum = sum + rate;
} else {
sum = sum - rate;
}
total.setText("Total: $" + sum.toString());
}
);
}
VBox vbox = new VBox();
vbox.getChildren().addAll(cbs);
vbox.setSpacing(5);
HBox root = new HBox();
root.getChildren().add(vbox);
root.getChildren().add(total);
root.setSpacing(40);
root.setPadding(new Insets(20, 10, 10, 20));
((Group) scene.getRoot()).getChildren().add(root);
stage.setScene(scene);
stage.show();
}
示例6: addToolTip
import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
/**
* Adds ToolTip from ToolTop library on Mouse Hover
*/
private void addToolTip() {
tooltip = new Tooltip(myVertex.getTaxonNode().getName() + "\nID: " + myVertex.getTaxonNode().getTaxonId()
+ "\nRelative Frequency: " + String.format("%.3f", AnalysisData.getMaximumRelativeFrequencies().get(myVertex.getTaxonNode())));
tooltip.setFont(Font.font(14));
Tooltip.install(this,tooltip);
}
示例7: MyEdgeView
import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
/**
* Constructor for EdgeView, takes reference to MyEdge object in the main Graph
* @param myEdge
*/
public MyEdgeView(MyEdge myEdge) {
this.myEdge = myEdge;
//lineThickness = myEdge.getWeight();
edgeShape = new Line();
edgeShape.startXProperty().bind((myEdge.getSource()).xCoordinatesProperty());
edgeShape.startYProperty().bind((myEdge.getSource()).yCoordinatesProperty());
edgeShape.endXProperty().bind((myEdge.getTarget()).xCoordinatesProperty());
edgeShape.endYProperty().bind((myEdge.getTarget()).yCoordinatesProperty());
//Bind to hidden property of myEdge object
visibleProperty().bind(myEdge.isHiddenProperty().not());
colourProperty = new SimpleObjectProperty<>(Palette.RdBu);
colourAttribute = new SimpleStringProperty("correlation");
colourAttribute.addListener((e, o, n) -> refreshColour());
colourProperty.addListener((e, o, n) -> refreshColour());
refreshColour();
getChildren().add(edgeShape);
Tooltip tooltip = new Tooltip(myEdge.getSource().getTaxonName() + " --- " + myEdge.getTarget().getTaxonName()
+ "\nCorrelation: " + String.format("%.3f", myEdge.getCorrelation())
+ "\np-Value: " + String.format("%.3f", myEdge.getPValue()));
tooltip.setFont(Font.font(14));
Tooltip.install(this, tooltip);
}
示例8: addLocation
import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
public void addLocation(final Location LOCATION) {
double x = (LOCATION.getLongitude() + 180) * (PREFERRED_WIDTH / 360) + MAP_OFFSET_X;
double y = (PREFERRED_HEIGHT / 2) - (PREFERRED_WIDTH * (Math.log(Math.tan((Math.PI / 4) + (Math.toRadians(LOCATION.getLatitude()) / 2)))) / (2 * Math.PI)) + MAP_OFFSET_Y;
FontIcon locationIcon = new FontIcon(null == LOCATION.getIconCode() ? locationIconCode : LOCATION.getIconCode());
locationIcon.setIconSize(LOCATION.getIconSize());
locationIcon.setTextOrigin(VPos.CENTER);
locationIcon.setIconColor(null == LOCATION.getColor() ? getLocationColor() : LOCATION.getColor());
locationIcon.setX(x - LOCATION.getIconSize() * 0.5);
locationIcon.setY(y);
StringBuilder tooltipBuilder = new StringBuilder();
if (!LOCATION.getName().isEmpty()) tooltipBuilder.append(LOCATION.getName());
if (!LOCATION.getInfo().isEmpty()) tooltipBuilder.append("\n").append(LOCATION.getInfo());
String tooltipText = tooltipBuilder.toString();
if (!tooltipText.isEmpty()) {
Tooltip tooltip = new Tooltip(tooltipText);
tooltip.setFont(Font.font(10));
Tooltip.install(locationIcon, tooltip);
}
if (null != LOCATION.getMouseEnterHandler()) locationIcon.setOnMouseEntered(new WeakEventHandler<>(LOCATION.getMouseEnterHandler()));
if (null != LOCATION.getMousePressHandler()) locationIcon.setOnMousePressed(new WeakEventHandler<>(LOCATION.getMousePressHandler()));
if (null != LOCATION.getMouseReleaseHandler()) locationIcon.setOnMouseReleased(new WeakEventHandler<>(LOCATION.getMouseReleaseHandler()));
if (null != LOCATION.getMouseExitHandler()) locationIcon.setOnMouseExited(new WeakEventHandler<>(LOCATION.getMouseExitHandler()));
locations.put(LOCATION, locationIcon);
}