Setting Font Size for Tooltip is not applicable.
Compile and run this sample:
package tooltiptest;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Font;
import javafx.stage.Stage;
/**
*
* @author Ladislav Török local
*/
public class TooltipTest extends Application {
@Override
public void start(Stage primaryStage) {
String javaVersion = System.getProperty("java.version");
String javafxRuntimeVersion = System.getProperty("javafx.runtime.version");
System.out.println("Java version: " + javaVersion);
System.out.println("JavaFX runtime version: " + javafxRuntimeVersion);
Tooltip btnTooltip = new Tooltip();
btnTooltip.setFont(new Font(70));
btnTooltip.setText("Hello, World!");
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setTooltip(btnTooltip);
btn.setOnAction((ActionEvent event) -> {
System.out.println("Hello, World!");
});
StackPane root = new StackPane();
root.getChildren().add(btn);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
See screenshots:
javafx 8u40b22-ea - bad: http://i60.tinypic.com/30k52yw.png
javafx 8u0b132 - good: http://i57.tinypic.com/2qdxyde.png (tooltip is trimmed, but it is ok, because screenshot is for application window)
Note: when I using JavaFX 8.0 b132 - all is ok., other JavaFX platforms I don't have installed.
Compile and run this sample:
package tooltiptest;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Font;
import javafx.stage.Stage;
/**
*
* @author Ladislav Török local
*/
public class TooltipTest extends Application {
@Override
public void start(Stage primaryStage) {
String javaVersion = System.getProperty("java.version");
String javafxRuntimeVersion = System.getProperty("javafx.runtime.version");
System.out.println("Java version: " + javaVersion);
System.out.println("JavaFX runtime version: " + javafxRuntimeVersion);
Tooltip btnTooltip = new Tooltip();
btnTooltip.setFont(new Font(70));
btnTooltip.setText("Hello, World!");
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setTooltip(btnTooltip);
btn.setOnAction((ActionEvent event) -> {
System.out.println("Hello, World!");
});
StackPane root = new StackPane();
root.getChildren().add(btn);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
See screenshots:
javafx 8u40b22-ea - bad: http://i60.tinypic.com/30k52yw.png
javafx 8u0b132 - good: http://i57.tinypic.com/2qdxyde.png (tooltip is trimmed, but it is ok, because screenshot is for application window)
Note: when I using JavaFX 8.0 b132 - all is ok., other JavaFX platforms I don't have installed.
- relates to
-
JDK-8093937 Sizing fonts with CSS em can result in wrong size font being displayed
-
- Resolved
-