当前位置: 首页>>代码示例>>Java>>正文


Java Tooltip.setFont方法代码示例

本文整理汇总了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);
}
 
开发者ID:scify,项目名称:jedai-ui,代码行数:17,代码来源:HelpTooltip.java

示例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);
}
 
开发者ID:AntonioGabrielAndrade,项目名称:LIRE-Lab,代码行数:17,代码来源:ToolTipProvider.java

示例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();
}
 
开发者ID:PtitNoony,项目名称:FxTreeMap,代码行数:19,代码来源:FxMapItem.java

示例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);
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:26,代码来源:World.java

示例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();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:43,代码来源:TooltipSample.java

示例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);
}
 
开发者ID:jmueller95,项目名称:CORNETTO,代码行数:10,代码来源:MyVertexView.java

示例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);

}
 
开发者ID:jmueller95,项目名称:CORNETTO,代码行数:31,代码来源:MyEdgeView.java

示例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);
}
 
开发者ID:HanSolo,项目名称:worldheatmap,代码行数:29,代码来源:World.java


注:本文中的javafx.scene.control.Tooltip.setFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。