JavaFX and Scene Builder clip scene edges despite specifying USE_COMPUTED_SIZEWhat are JavaFX, FXML and Scene Builder?javafx and scene builderWhat is the secret to set a custom TextArea background?Is it possible to import a JAR containing a custom JavaFX control into Scene Builder?Where has the JavaFX scene builder gone?Scene Builder window (and JavaFX app) not displaying properlyJavafx background image using scene builderJavaFX resizable layout(scene builder)Not showing css styles in scene builder in javafx
Does spacetime structure in GR break time symmetry?
Could the Ancient Egyptian hieroglyphs have been deciphered without the Rosetta Stone with modern tech?
Short story trilogy about a human whose parents were missionaries to a planet of cat people
Why do airports in the UK have so few runways?
Novel where a serial killer lives (almost) forever by swapping bodies
Was the whistle-blower's (12 Aug 2019) complaint deemed credible?
Effects of quantum computing on parallel universes
Being flown out for an interview, is it ok to ask to stay a while longer to check out the area?
Why is the Speaker elected by secret ballot?
Open problems from antiquity solved with analytic geometry
Why does the Bug drink sugar water in MiB?
Why did dict.get(key) work but not dict[key]?
Fermat's Last Theorem, mod n
Does anyone know who created or where this He-Man and Battlecat image came from?
If the Feign Death spell is cast on a creature, do they register as magical if the Detect Magic spell is cast to inspect them?
Is it unsafe to remove one stud from a load bearing wall?
Why was Wouter Basson never charged with crimes against humanity for Project Coast?
Is it normal to use a clipper instead of a limiter?
Are banter blitz players who draw arrows on the board during the game breaking the FIDE Laws of Chess?
Fantasy story about a knife that can cut holes to other dimensions
Can you make tandoori rotis with chickpea / green pea flour?
How do I obtain the debian-installer for Ubuntu Server 18.04.3 LTS?
50k job is offering 90k worth of shares. Scam?
VBA Debugging - step through main program, but run routines called from it?
JavaFX and Scene Builder clip scene edges despite specifying USE_COMPUTED_SIZE
What are JavaFX, FXML and Scene Builder?javafx and scene builderWhat is the secret to set a custom TextArea background?Is it possible to import a JAR containing a custom JavaFX control into Scene Builder?Where has the JavaFX scene builder gone?Scene Builder window (and JavaFX app) not displaying properlyJavafx background image using scene builderJavaFX resizable layout(scene builder)Not showing css styles in scene builder in javafx
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I'm using Scene Builder (v11.0.0) to create FXML files for scenes in JavaFX (v12) but, despite instructing all containers to USE_COMPUTED_SIZE
for the preferred widths and heights, the rendered scenes (as seen in Scene Builder and also when run as a JavaFX application which loads those FXML files) are being clipped at the right and bottom edges so that bits of nodes are chopped off.
And in Scene Builder it seems that the renderer must know that the scene won't fit the allowed bounds because the editor shows blue boundary markers which are clearly some way beyond the rendered rectangle.
View in Scene Builder
The view in Scene Builder shows that more space is needed at the bottom in order to give the buttons sufficient space (their bottom edge, and the lower edge of the TitledPane
is missing). And more space is needed at the right in order to fit the right edges of the DatePicker
and TitledPane
. The blue boundary markers show clearly where the actual content ends, so it's not clear why the display area is being calculated to be several pixels shorter than this.
View of running Java application
Once the FXML files are used to populate a window in a JavaFX application, the same thing is seen: the calculated size for the window is a number of pixels too few to fit the whole scene correctly.
If the blue boundary markers have correctly been calculated to show that extra display area width and height are needed, how do I tell the FXML to require this additional space when rendering?
Is this a known bug/limitation in Scene Builder, FXML, or JavaFX. Or is there something more I need to do beyond just selecting USE_COMPUTED_SIZE
for the preferred dimensions?
In order to make this explicit, see the example FXML below which displays the problem illustrated.
scene.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox>
<children>
<fx:include source="subscene.fxml" />
</children>
</HBox>
</content>
</TitledPane>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox>
<children>
<fx:include source="subscene.fxml" />
</children>
</HBox>
</content>
</TitledPane>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox alignment="BASELINE_RIGHT">
<children>
<Button mnemonicParsing="false" text="Button" />
<Button mnemonicParsing="false" text="Button" />
</children>
</HBox>
</content>
</TitledPane>
</children>
</VBox>
subscene.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label text="Label" />
<DatePicker />
</children>
</VBox>
java javafx fxml scenebuilder
|
show 5 more comments
I'm using Scene Builder (v11.0.0) to create FXML files for scenes in JavaFX (v12) but, despite instructing all containers to USE_COMPUTED_SIZE
for the preferred widths and heights, the rendered scenes (as seen in Scene Builder and also when run as a JavaFX application which loads those FXML files) are being clipped at the right and bottom edges so that bits of nodes are chopped off.
And in Scene Builder it seems that the renderer must know that the scene won't fit the allowed bounds because the editor shows blue boundary markers which are clearly some way beyond the rendered rectangle.
View in Scene Builder
The view in Scene Builder shows that more space is needed at the bottom in order to give the buttons sufficient space (their bottom edge, and the lower edge of the TitledPane
is missing). And more space is needed at the right in order to fit the right edges of the DatePicker
and TitledPane
. The blue boundary markers show clearly where the actual content ends, so it's not clear why the display area is being calculated to be several pixels shorter than this.
View of running Java application
Once the FXML files are used to populate a window in a JavaFX application, the same thing is seen: the calculated size for the window is a number of pixels too few to fit the whole scene correctly.
If the blue boundary markers have correctly been calculated to show that extra display area width and height are needed, how do I tell the FXML to require this additional space when rendering?
Is this a known bug/limitation in Scene Builder, FXML, or JavaFX. Or is there something more I need to do beyond just selecting USE_COMPUTED_SIZE
for the preferred dimensions?
In order to make this explicit, see the example FXML below which displays the problem illustrated.
scene.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox>
<children>
<fx:include source="subscene.fxml" />
</children>
</HBox>
</content>
</TitledPane>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox>
<children>
<fx:include source="subscene.fxml" />
</children>
</HBox>
</content>
</TitledPane>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox alignment="BASELINE_RIGHT">
<children>
<Button mnemonicParsing="false" text="Button" />
<Button mnemonicParsing="false" text="Button" />
</children>
</HBox>
</content>
</TitledPane>
</children>
</VBox>
subscene.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label text="Label" />
<DatePicker />
</children>
</VBox>
java javafx fxml scenebuilder
Might be related to this issue? If that's not the case, can you post your FXML?
– José Pereda
Mar 28 at 17:28
If you run an application using the FXML file do you still get the same problem? If not, then the issue is likely on Scene Builder's end.
– Slaw
Mar 28 at 18:46
Yes, the same thing is seen when the application is run in Java and the scenes are loaded from the FXML files generated by Scene Builder. I have a suspicion that the problem might be that the scenesfx:include
other FXML files; maybe JavaFX has a bug which means it miscalculates some of the bounds when the scene includes nested sub-scenes. I'll see if I can reproduce this in a simple FXML example which I can share here.
– Bobulous
Mar 28 at 20:05
Okay, @JoséPereda I found a compact MVCE which displays exactly the same problem I'm seeing in my full application, so I've updated my question to include the FXML and new screenshots.
– Bobulous
Mar 28 at 20:44
1
It looks like theDatePicker
control doesn't get its size properly. If you remove it or if you set any width different than -1, or you add another control, everything will work as it should. This seems like a JavaFX bug to me.
– José Pereda
Mar 28 at 21:39
|
show 5 more comments
I'm using Scene Builder (v11.0.0) to create FXML files for scenes in JavaFX (v12) but, despite instructing all containers to USE_COMPUTED_SIZE
for the preferred widths and heights, the rendered scenes (as seen in Scene Builder and also when run as a JavaFX application which loads those FXML files) are being clipped at the right and bottom edges so that bits of nodes are chopped off.
And in Scene Builder it seems that the renderer must know that the scene won't fit the allowed bounds because the editor shows blue boundary markers which are clearly some way beyond the rendered rectangle.
View in Scene Builder
The view in Scene Builder shows that more space is needed at the bottom in order to give the buttons sufficient space (their bottom edge, and the lower edge of the TitledPane
is missing). And more space is needed at the right in order to fit the right edges of the DatePicker
and TitledPane
. The blue boundary markers show clearly where the actual content ends, so it's not clear why the display area is being calculated to be several pixels shorter than this.
View of running Java application
Once the FXML files are used to populate a window in a JavaFX application, the same thing is seen: the calculated size for the window is a number of pixels too few to fit the whole scene correctly.
If the blue boundary markers have correctly been calculated to show that extra display area width and height are needed, how do I tell the FXML to require this additional space when rendering?
Is this a known bug/limitation in Scene Builder, FXML, or JavaFX. Or is there something more I need to do beyond just selecting USE_COMPUTED_SIZE
for the preferred dimensions?
In order to make this explicit, see the example FXML below which displays the problem illustrated.
scene.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox>
<children>
<fx:include source="subscene.fxml" />
</children>
</HBox>
</content>
</TitledPane>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox>
<children>
<fx:include source="subscene.fxml" />
</children>
</HBox>
</content>
</TitledPane>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox alignment="BASELINE_RIGHT">
<children>
<Button mnemonicParsing="false" text="Button" />
<Button mnemonicParsing="false" text="Button" />
</children>
</HBox>
</content>
</TitledPane>
</children>
</VBox>
subscene.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label text="Label" />
<DatePicker />
</children>
</VBox>
java javafx fxml scenebuilder
I'm using Scene Builder (v11.0.0) to create FXML files for scenes in JavaFX (v12) but, despite instructing all containers to USE_COMPUTED_SIZE
for the preferred widths and heights, the rendered scenes (as seen in Scene Builder and also when run as a JavaFX application which loads those FXML files) are being clipped at the right and bottom edges so that bits of nodes are chopped off.
And in Scene Builder it seems that the renderer must know that the scene won't fit the allowed bounds because the editor shows blue boundary markers which are clearly some way beyond the rendered rectangle.
View in Scene Builder
The view in Scene Builder shows that more space is needed at the bottom in order to give the buttons sufficient space (their bottom edge, and the lower edge of the TitledPane
is missing). And more space is needed at the right in order to fit the right edges of the DatePicker
and TitledPane
. The blue boundary markers show clearly where the actual content ends, so it's not clear why the display area is being calculated to be several pixels shorter than this.
View of running Java application
Once the FXML files are used to populate a window in a JavaFX application, the same thing is seen: the calculated size for the window is a number of pixels too few to fit the whole scene correctly.
If the blue boundary markers have correctly been calculated to show that extra display area width and height are needed, how do I tell the FXML to require this additional space when rendering?
Is this a known bug/limitation in Scene Builder, FXML, or JavaFX. Or is there something more I need to do beyond just selecting USE_COMPUTED_SIZE
for the preferred dimensions?
In order to make this explicit, see the example FXML below which displays the problem illustrated.
scene.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox>
<children>
<fx:include source="subscene.fxml" />
</children>
</HBox>
</content>
</TitledPane>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox>
<children>
<fx:include source="subscene.fxml" />
</children>
</HBox>
</content>
</TitledPane>
<TitledPane animated="false" collapsible="false" text="untitled">
<content>
<HBox alignment="BASELINE_RIGHT">
<children>
<Button mnemonicParsing="false" text="Button" />
<Button mnemonicParsing="false" text="Button" />
</children>
</HBox>
</content>
</TitledPane>
</children>
</VBox>
subscene.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label text="Label" />
<DatePicker />
</children>
</VBox>
java javafx fxml scenebuilder
java javafx fxml scenebuilder
edited Mar 28 at 21:27
Slaw
15.7k3 gold badges15 silver badges40 bronze badges
15.7k3 gold badges15 silver badges40 bronze badges
asked Mar 28 at 17:18
BobulousBobulous
10.7k4 gold badges31 silver badges55 bronze badges
10.7k4 gold badges31 silver badges55 bronze badges
Might be related to this issue? If that's not the case, can you post your FXML?
– José Pereda
Mar 28 at 17:28
If you run an application using the FXML file do you still get the same problem? If not, then the issue is likely on Scene Builder's end.
– Slaw
Mar 28 at 18:46
Yes, the same thing is seen when the application is run in Java and the scenes are loaded from the FXML files generated by Scene Builder. I have a suspicion that the problem might be that the scenesfx:include
other FXML files; maybe JavaFX has a bug which means it miscalculates some of the bounds when the scene includes nested sub-scenes. I'll see if I can reproduce this in a simple FXML example which I can share here.
– Bobulous
Mar 28 at 20:05
Okay, @JoséPereda I found a compact MVCE which displays exactly the same problem I'm seeing in my full application, so I've updated my question to include the FXML and new screenshots.
– Bobulous
Mar 28 at 20:44
1
It looks like theDatePicker
control doesn't get its size properly. If you remove it or if you set any width different than -1, or you add another control, everything will work as it should. This seems like a JavaFX bug to me.
– José Pereda
Mar 28 at 21:39
|
show 5 more comments
Might be related to this issue? If that's not the case, can you post your FXML?
– José Pereda
Mar 28 at 17:28
If you run an application using the FXML file do you still get the same problem? If not, then the issue is likely on Scene Builder's end.
– Slaw
Mar 28 at 18:46
Yes, the same thing is seen when the application is run in Java and the scenes are loaded from the FXML files generated by Scene Builder. I have a suspicion that the problem might be that the scenesfx:include
other FXML files; maybe JavaFX has a bug which means it miscalculates some of the bounds when the scene includes nested sub-scenes. I'll see if I can reproduce this in a simple FXML example which I can share here.
– Bobulous
Mar 28 at 20:05
Okay, @JoséPereda I found a compact MVCE which displays exactly the same problem I'm seeing in my full application, so I've updated my question to include the FXML and new screenshots.
– Bobulous
Mar 28 at 20:44
1
It looks like theDatePicker
control doesn't get its size properly. If you remove it or if you set any width different than -1, or you add another control, everything will work as it should. This seems like a JavaFX bug to me.
– José Pereda
Mar 28 at 21:39
Might be related to this issue? If that's not the case, can you post your FXML?
– José Pereda
Mar 28 at 17:28
Might be related to this issue? If that's not the case, can you post your FXML?
– José Pereda
Mar 28 at 17:28
If you run an application using the FXML file do you still get the same problem? If not, then the issue is likely on Scene Builder's end.
– Slaw
Mar 28 at 18:46
If you run an application using the FXML file do you still get the same problem? If not, then the issue is likely on Scene Builder's end.
– Slaw
Mar 28 at 18:46
Yes, the same thing is seen when the application is run in Java and the scenes are loaded from the FXML files generated by Scene Builder. I have a suspicion that the problem might be that the scenes
fx:include
other FXML files; maybe JavaFX has a bug which means it miscalculates some of the bounds when the scene includes nested sub-scenes. I'll see if I can reproduce this in a simple FXML example which I can share here.– Bobulous
Mar 28 at 20:05
Yes, the same thing is seen when the application is run in Java and the scenes are loaded from the FXML files generated by Scene Builder. I have a suspicion that the problem might be that the scenes
fx:include
other FXML files; maybe JavaFX has a bug which means it miscalculates some of the bounds when the scene includes nested sub-scenes. I'll see if I can reproduce this in a simple FXML example which I can share here.– Bobulous
Mar 28 at 20:05
Okay, @JoséPereda I found a compact MVCE which displays exactly the same problem I'm seeing in my full application, so I've updated my question to include the FXML and new screenshots.
– Bobulous
Mar 28 at 20:44
Okay, @JoséPereda I found a compact MVCE which displays exactly the same problem I'm seeing in my full application, so I've updated my question to include the FXML and new screenshots.
– Bobulous
Mar 28 at 20:44
1
1
It looks like the
DatePicker
control doesn't get its size properly. If you remove it or if you set any width different than -1, or you add another control, everything will work as it should. This seems like a JavaFX bug to me.– José Pereda
Mar 28 at 21:39
It looks like the
DatePicker
control doesn't get its size properly. If you remove it or if you set any width different than -1, or you add another control, everything will work as it should. This seems like a JavaFX bug to me.– José Pereda
Mar 28 at 21:39
|
show 5 more comments
1 Answer
1
active
oldest
votes
This does appear to be a bug in JavaFX, specifically DatePicker
, as this simple example can reproduce the problem:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application
@Override
public void start(Stage primaryStage)
VBox root = new VBox(new DatePicker());
// Problem shows up when using USE_COMPUTED_SIZE (the default) as well
root.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
root.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
primaryStage.setScene(new Scene(root));
primaryStage.show();
Resulting in:
Note: It does not seem to matter what parent the DatePicker
is put in. Nor does the problem appear with other controls.
A workaround to this issue appears to be calling Window.sizeToScene()
after calling show()
. I don't understand why that would make a difference, but it does. Unfortunately, this will only help in the real application, not in Scene Builder.
Thank you. Seeing as your MVCE is more compact than mine, I've used this to open an openjdk-jfx issue on GitHub to report this bug.
– Bobulous
Apr 7 at 14:52
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403477%2fjavafx-and-scene-builder-clip-scene-edges-despite-specifying-use-computed-size%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This does appear to be a bug in JavaFX, specifically DatePicker
, as this simple example can reproduce the problem:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application
@Override
public void start(Stage primaryStage)
VBox root = new VBox(new DatePicker());
// Problem shows up when using USE_COMPUTED_SIZE (the default) as well
root.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
root.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
primaryStage.setScene(new Scene(root));
primaryStage.show();
Resulting in:
Note: It does not seem to matter what parent the DatePicker
is put in. Nor does the problem appear with other controls.
A workaround to this issue appears to be calling Window.sizeToScene()
after calling show()
. I don't understand why that would make a difference, but it does. Unfortunately, this will only help in the real application, not in Scene Builder.
Thank you. Seeing as your MVCE is more compact than mine, I've used this to open an openjdk-jfx issue on GitHub to report this bug.
– Bobulous
Apr 7 at 14:52
add a comment
|
This does appear to be a bug in JavaFX, specifically DatePicker
, as this simple example can reproduce the problem:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application
@Override
public void start(Stage primaryStage)
VBox root = new VBox(new DatePicker());
// Problem shows up when using USE_COMPUTED_SIZE (the default) as well
root.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
root.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
primaryStage.setScene(new Scene(root));
primaryStage.show();
Resulting in:
Note: It does not seem to matter what parent the DatePicker
is put in. Nor does the problem appear with other controls.
A workaround to this issue appears to be calling Window.sizeToScene()
after calling show()
. I don't understand why that would make a difference, but it does. Unfortunately, this will only help in the real application, not in Scene Builder.
Thank you. Seeing as your MVCE is more compact than mine, I've used this to open an openjdk-jfx issue on GitHub to report this bug.
– Bobulous
Apr 7 at 14:52
add a comment
|
This does appear to be a bug in JavaFX, specifically DatePicker
, as this simple example can reproduce the problem:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application
@Override
public void start(Stage primaryStage)
VBox root = new VBox(new DatePicker());
// Problem shows up when using USE_COMPUTED_SIZE (the default) as well
root.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
root.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
primaryStage.setScene(new Scene(root));
primaryStage.show();
Resulting in:
Note: It does not seem to matter what parent the DatePicker
is put in. Nor does the problem appear with other controls.
A workaround to this issue appears to be calling Window.sizeToScene()
after calling show()
. I don't understand why that would make a difference, but it does. Unfortunately, this will only help in the real application, not in Scene Builder.
This does appear to be a bug in JavaFX, specifically DatePicker
, as this simple example can reproduce the problem:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application
@Override
public void start(Stage primaryStage)
VBox root = new VBox(new DatePicker());
// Problem shows up when using USE_COMPUTED_SIZE (the default) as well
root.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
root.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
primaryStage.setScene(new Scene(root));
primaryStage.show();
Resulting in:
Note: It does not seem to matter what parent the DatePicker
is put in. Nor does the problem appear with other controls.
A workaround to this issue appears to be calling Window.sizeToScene()
after calling show()
. I don't understand why that would make a difference, but it does. Unfortunately, this will only help in the real application, not in Scene Builder.
edited Mar 30 at 6:03
answered Mar 30 at 5:51
SlawSlaw
15.7k3 gold badges15 silver badges40 bronze badges
15.7k3 gold badges15 silver badges40 bronze badges
Thank you. Seeing as your MVCE is more compact than mine, I've used this to open an openjdk-jfx issue on GitHub to report this bug.
– Bobulous
Apr 7 at 14:52
add a comment
|
Thank you. Seeing as your MVCE is more compact than mine, I've used this to open an openjdk-jfx issue on GitHub to report this bug.
– Bobulous
Apr 7 at 14:52
Thank you. Seeing as your MVCE is more compact than mine, I've used this to open an openjdk-jfx issue on GitHub to report this bug.
– Bobulous
Apr 7 at 14:52
Thank you. Seeing as your MVCE is more compact than mine, I've used this to open an openjdk-jfx issue on GitHub to report this bug.
– Bobulous
Apr 7 at 14:52
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403477%2fjavafx-and-scene-builder-clip-scene-edges-despite-specifying-use-computed-size%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Might be related to this issue? If that's not the case, can you post your FXML?
– José Pereda
Mar 28 at 17:28
If you run an application using the FXML file do you still get the same problem? If not, then the issue is likely on Scene Builder's end.
– Slaw
Mar 28 at 18:46
Yes, the same thing is seen when the application is run in Java and the scenes are loaded from the FXML files generated by Scene Builder. I have a suspicion that the problem might be that the scenes
fx:include
other FXML files; maybe JavaFX has a bug which means it miscalculates some of the bounds when the scene includes nested sub-scenes. I'll see if I can reproduce this in a simple FXML example which I can share here.– Bobulous
Mar 28 at 20:05
Okay, @JoséPereda I found a compact MVCE which displays exactly the same problem I'm seeing in my full application, so I've updated my question to include the FXML and new screenshots.
– Bobulous
Mar 28 at 20:44
1
It looks like the
DatePicker
control doesn't get its size properly. If you remove it or if you set any width different than -1, or you add another control, everything will work as it should. This seems like a JavaFX bug to me.– José Pereda
Mar 28 at 21:39