Reputation: 9325
Im starting with JavaFX, but immediately noticed that labels are blurred (Do you see these pink edging around letters?)
I tried changing fonts, size, weight, but same...
It's offending to the eye, looks bulky, is there any way to make it appear without blurring effect?
I'm using OpenFx 13, tried with previous versions of JavaFx.
scene.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.StackPane?>
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.openjfx.FXMLController">
<children>
<Label fx:id="label" text="Label" />
</children>
</StackPane>
FXMLController
package org.openjfx;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
public class FXMLController {
@FXML
private Label label;
public void initialize() {
String javaVersion = System.getProperty("java.version");
String javafxVersion = System.getProperty("javafx.version");
label.setFont(Font.font("Menlo", FontWeight.BOLD, 20));
label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
}
}
MainApp
package org.openjfx;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MainApp extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
stage.setTitle("JavaFX and Gradle");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Upvotes: 1
Views: 955
Reputation: 512
Try using the LCD anti-aliasing on the MainApp :
public class MainApp extends Application {
System.setProperty("prism.lcdtext", "false");
... The rest of your code ...
}
Upvotes: 5