How to make JavaFX Applications non-blurry on Reti

2019-06-16 07:25发布

A JavaFX application appears blurry on the MacBook Pro Retina screen. Is there a way to display the application sharp? In a blog post/comment was mentioned that this is the case currently: http://fxexperience.com/2012/11/retina-display-macbook-pro/

This is the example fxml:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.layout.*?>
<?import javafx.scene.control.*?>


<VBox xmlns:fx="http://javafx.com/fxml">
    <MenuBar>
        <Menu text="File">
            <items>
                <MenuItem text="Exit"/>
            </items>
        </Menu>
    </MenuBar>
</VBox>

Example code:

import javafx.application.Application
import javafx.fxml.FXMLLoader
import javafx.scene.Scene
import javafx.scene.layout.VBox
import javafx.scene.paint.Color
import javafx.stage.Stage

object CreateFX extends App {
    override def main(args: Array[String]) = {
      println("CreateFX starting up...")
      Application.launch(classOf[CreateFX], args: _*)
    }
}

class CreateFX extends Application {
    def start(stage: Stage): Unit = {
        println("start "+stage)

        stage.setTitle("CreateFX")

        val root: VBox = FXMLLoader.load(getClass().getResource("MainScreenVBox.fxml"))//new VBox

        val scene = new Scene(root, 800, 600)
        scene.setFill(Color.GREEN)

        stage.setScene(scene)
        stage.show()
    }
}

Outcome: Resulting application

Java Version: 1.7.0_21

1条回答
smile是对你的礼貌
2楼-- · 2019-06-16 07:41

In the same article in the commentary Richard Blair stated that this was fixed in the latest JavaFX version (available in the EAP of Java 8, downloadable here)

查看更多
登录 后发表回答