Ste*_*eve 6 java javafx intellij-idea fxml scenebuilder
这是我的场景构建器的样子:
这是图形用户界面:
独立的场景构建器:
我只是从 Java SDK 演示中运行以下源代码:
package sample;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
Button btn = new Button();
btn.setText("Say 'Hello World'!");
StackPane root_ctn = new StackPane();
root_ctn.getChildren().add(btn);
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
System.out.println("Hello World!");
}
});
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root_ctn, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Run Code Online (Sandbox Code Playgroud)
文本看起来不错的唯一地方是在控制台中。
我还没有找到解决方案,但我发现了一个有趣的模式:在你的 Gluon Scene Builder 屏幕截图上,写着Pgy Rtqlgev,它应该在哪里New Project,以及Qrgp Rtqlgev它应该在哪里Open Project。请注意,每个字母都被字母表中的下一个字母替换!
这同样适用于Say 'Hello World'!,它被“翻译”为Lc{ 'Jgrrq Yqtrf'!。请注意,该字母y被替换为,它在 ASCII 表中{位于后两个位置。y有趣的是,人物'和!保持不变。
每个字母占用的空间仍然是正确字母的空间,如下图所示,绿色背景上有正确的文本:

更新:您的系统上是否可能缺少字体“Segoe UI”或有缺陷?例如,您可以在 Word 中使用该字体吗?
更新:我发现用户面临同样问题的另外两个问题。在这两种情况下,问题似乎都与 Segoe UI 字体有关:
| 归档时间: |
|
| 查看次数: |
1320 次 |
| 最近记录: |