如何在Retina Display上使JavaFX应用程序不模糊 [英] How to make JavaFX Applications non-blurry on Retina Display

查看:189
本文介绍了如何在Retina Display上使JavaFX应用程序不模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MacBook Pro Retina屏幕上的JavaFX应用程序显得模糊。有没有办法显示应用程序锐利?在博客文章/评论中提到目前的情况是这样的:)


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:

Java Version: 1.7.0_21

解决方案

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)

这篇关于如何在Retina Display上使JavaFX应用程序不模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆