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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With