-
Bug
-
Resolution: Not an Issue
-
P4
-
8
-
JDK used : jdk-8-ea-b102-linux-arm-vfp-hflt-07_aug_2013
Raspberry pi image: Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l GNU/Linux
Hi all,
I have set up my raspberry pi to use 1280*720 resolution overscan disabled and my console is 1280*720 as set in /boot/config.txt. When i start my application with scene size 1280*720 my scene/stage is scaled by 0.6 (as if 1920*1080 to 1280*720). I can still see my command prompt.
When i run my applcation on 1920*1080 and set the scene size to 1920*1080 everything is fine (except font sizes).
Below my code shortend:
Main class:
@Override
public void start(Stage primaryStage) {
///redirectOutputToLog();
rootStage = primaryStage;
DisplayConfig.setStageProps(rootStage);
rootStage.addEventHandler(WindowEvent.WINDOW_SHOWN, new EventHandler<WindowEvent>(){
@Override
public void handle(WindowEvent window){
if(preloaderShown==false){
mainStage = new MainScene();
mainStage.setRoot(rootStage);
rootStage.setScene(mainStage.scene());
}
}
});
}
MainScene class:
public final class MainScene {
Pane root = new Pane();
Scene appScene = new Scene(root, DisplayConfig.getScreenWidth(), DisplayConfig.getScreenHeight());
public MainScene(){
LOG.debug("Set scene width: {}, height: {}", DisplayConfig.getScreenWidth(), DisplayConfig.getScreenHeight());
}
public final Scene scene(){
return appScene;
}
}
DisplayConfig class:
public final class DisplayConfig {
static ObservableList<Screen> screens = Screen.getScreens();
static final Rectangle2D primaryScreenBounds = Screen.getPrimary().getBounds();
static double curScreenWidth = primaryScreenBounds.getWidth();
static double curScreenHeight = primaryScreenBounds.getHeight();
public static void setStageProps(Stage primaryStage){
//// Here we will be checking if there is a second screen, and if there is force the app to go there
primaryStage.initStyle(StageStyle.UNDECORATED);
LOG.debug("Got {} screens", screens.size());
if(screens.size()>1){
for (Screen curScreen : screens) {
LOG.debug("Current screen check is primary: {}", curScreen.equals(Screen.getPrimary()));
if(!curScreen.equals(Screen.getPrimary())) {
LOG.debug("Going secondary screen");
Rectangle2D newScreenBounds = curScreen.getBounds();
screenPosX = newScreenBounds.getMinX();
screenPosY = newScreenBounds.getMinY();
curScreenWidth = newScreenBounds.getWidth();
curScreenHeight = newScreenBounds.getHeight();
ratioX = (1/defaultWidth) * curScreenWidth;
ratioY = (1/defaultHeight) * curScreenHeight;
primaryStage.setWidth(curScreenWidth);
primaryStage.setHeight(curScreenHeight);
primaryStage.setX(screenPosX);
primaryStage.setY(screenPosY);
primaryStage.toFront();
break;
}
}
} else {
LOG.debug("Staying primary");
ratioX = (1/defaultWidth) * curScreenWidth;
ratioY = (1/defaultHeight) * curScreenHeight;
primaryStage.setFullScreen(true);
}
LOG.debug("Screen properties: posX: {}, posY: {}, width: {}, height: {}, ratioX: {}, ratioY: {}", screenPosX, screenPosY, curScreenWidth,curScreenHeight, ratioX,ratioY);
}
}
My debug logging shows the correct screen sizes:
---
2013-08-14 15:00:39,943 [JavaFX Application Thread] DEBUG pidome.client.config.DisplayConfig - Got 1 screens
2013-08-14 15:00:43,048 [JavaFX Application Thread] DEBUG pidome.client.config.DisplayConfig - Staying primary
2013-08-14 15:00:43,087 [JavaFX Application Thread] DEBUG pidome.client.config.DisplayConfig - Screen properties: posX: 0.0, posY: 0.0, width: 1280.0, height: 720.0, ratioX: 0.6666666666666666, ratioY: 0.6666666666666667
(......)
2013-08-14 15:00:56,527 [JavaFX Application Thread] DEBUG pidome.client.system.scenes.MainScene - Set scene width: 1280.0, height: 720.0
---
The scaling ratios are because my application is primarely designed for 1920*1080, and some panes needs te be resized (which works correct in the view).
- I have already tried to remove the stage.fullscreen(true) and set the stage width and height, the combination of the two
- stage.sizetoscene() and even set my scene and stage dimensions to 1920*1080.
There is no location in my code which scales the scene, but only sets the scene width and height.
Best regards,
John.
I have set up my raspberry pi to use 1280*720 resolution overscan disabled and my console is 1280*720 as set in /boot/config.txt. When i start my application with scene size 1280*720 my scene/stage is scaled by 0.6 (as if 1920*1080 to 1280*720). I can still see my command prompt.
When i run my applcation on 1920*1080 and set the scene size to 1920*1080 everything is fine (except font sizes).
Below my code shortend:
Main class:
@Override
public void start(Stage primaryStage) {
///redirectOutputToLog();
rootStage = primaryStage;
DisplayConfig.setStageProps(rootStage);
rootStage.addEventHandler(WindowEvent.WINDOW_SHOWN, new EventHandler<WindowEvent>(){
@Override
public void handle(WindowEvent window){
if(preloaderShown==false){
mainStage = new MainScene();
mainStage.setRoot(rootStage);
rootStage.setScene(mainStage.scene());
}
}
});
}
MainScene class:
public final class MainScene {
Pane root = new Pane();
Scene appScene = new Scene(root, DisplayConfig.getScreenWidth(), DisplayConfig.getScreenHeight());
public MainScene(){
LOG.debug("Set scene width: {}, height: {}", DisplayConfig.getScreenWidth(), DisplayConfig.getScreenHeight());
}
public final Scene scene(){
return appScene;
}
}
DisplayConfig class:
public final class DisplayConfig {
static ObservableList<Screen> screens = Screen.getScreens();
static final Rectangle2D primaryScreenBounds = Screen.getPrimary().getBounds();
static double curScreenWidth = primaryScreenBounds.getWidth();
static double curScreenHeight = primaryScreenBounds.getHeight();
public static void setStageProps(Stage primaryStage){
//// Here we will be checking if there is a second screen, and if there is force the app to go there
primaryStage.initStyle(StageStyle.UNDECORATED);
LOG.debug("Got {} screens", screens.size());
if(screens.size()>1){
for (Screen curScreen : screens) {
LOG.debug("Current screen check is primary: {}", curScreen.equals(Screen.getPrimary()));
if(!curScreen.equals(Screen.getPrimary())) {
LOG.debug("Going secondary screen");
Rectangle2D newScreenBounds = curScreen.getBounds();
screenPosX = newScreenBounds.getMinX();
screenPosY = newScreenBounds.getMinY();
curScreenWidth = newScreenBounds.getWidth();
curScreenHeight = newScreenBounds.getHeight();
ratioX = (1/defaultWidth) * curScreenWidth;
ratioY = (1/defaultHeight) * curScreenHeight;
primaryStage.setWidth(curScreenWidth);
primaryStage.setHeight(curScreenHeight);
primaryStage.setX(screenPosX);
primaryStage.setY(screenPosY);
primaryStage.toFront();
break;
}
}
} else {
LOG.debug("Staying primary");
ratioX = (1/defaultWidth) * curScreenWidth;
ratioY = (1/defaultHeight) * curScreenHeight;
primaryStage.setFullScreen(true);
}
LOG.debug("Screen properties: posX: {}, posY: {}, width: {}, height: {}, ratioX: {}, ratioY: {}", screenPosX, screenPosY, curScreenWidth,curScreenHeight, ratioX,ratioY);
}
}
My debug logging shows the correct screen sizes:
---
2013-08-14 15:00:39,943 [JavaFX Application Thread] DEBUG pidome.client.config.DisplayConfig - Got 1 screens
2013-08-14 15:00:43,048 [JavaFX Application Thread] DEBUG pidome.client.config.DisplayConfig - Staying primary
2013-08-14 15:00:43,087 [JavaFX Application Thread] DEBUG pidome.client.config.DisplayConfig - Screen properties: posX: 0.0, posY: 0.0, width: 1280.0, height: 720.0, ratioX: 0.6666666666666666, ratioY: 0.6666666666666667
(......)
2013-08-14 15:00:56,527 [JavaFX Application Thread] DEBUG pidome.client.system.scenes.MainScene - Set scene width: 1280.0, height: 720.0
---
The scaling ratios are because my application is primarely designed for 1920*1080, and some panes needs te be resized (which works correct in the view).
- I have already tried to remove the stage.fullscreen(true) and set the stage width and height, the combination of the two
- stage.sizetoscene() and even set my scene and stage dimensions to 1920*1080.
There is no location in my code which scales the scene, but only sets the scene width and height.
Best regards,
John.
- relates to
-
JDK-8117941 Windows appear in wrong location on Pi
-
- Closed
-