Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make JavaFX Applications non-blurry on Retina Display

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

like image 578
Appleshell Avatar asked Apr 17 '13 14:04

Appleshell


1 Answers

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)

like image 96
zhujik Avatar answered Nov 08 '22 11:11

zhujik