#Quick question about JavaFX responsiveness
1 messages · Page 1 of 1 (latest)
<@&987246487241105418> please have a look, thanks.
Those are the settings of this BorderPane
The whole thing is in a hbox right?
yes
Then make that element to have priority to fill that place
I basically want to make this responsive
The table and everything except the map should be bound to the windows borders and the map should scale depending on the size of the window
and when I try to realize that, it doesnt go bigger than like the base size of the components
And I found that that could maybe be caused by the HBox or BorderPane being too small
So I just added an empty BorderPane
And see
Its not filling out the whole window
how
Is it possible without this?
In scenebuilder?
Yes it is, a quick Google search should tell you
I did and I have not found a solution. I searched for:
scene builder element priority fill
it is just HBox.hgrow="ALWAYS" in the fxml
Im not home currently. I will when I am back home
I uploaded your attachments as Gist.
this is my fxml of the root HBox
It still doesnt work
I just made the right part a bit simpler - without the BorderPane
If you need any more fxml code or anything let me know
well thats not the full fxml
its the one of the left side
everything right of the scrollPane
you maybe send the wrong thing?
all good
so you have each element (in the root hbox) split into its own fxml file right?
You did. I asked you if I was supposed to have one fxml and Controller for everything and you said that I shouldnt do that
anyways
Which fxml do you wanna have?
I thought you asked if you should have a specific controller for each specific fxml
but whatever
yeah
Isnt that the same?
no
anyways show the one you want to have hgrow priority
and then show how you add it to the hbox
I uploaded your attachments as Gist.
the hgrow is placed wrong
it should be on the vbox container
it needs to be one the child directly under the hbox
<VBox fx:id="container" style="-fx-background-color: rgb(23, 27, 45);" HBox.hgrow="ALWAYS" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.denakkusativ.zusiconomy.gui.controllers.ScenarioDetailsController">
or is it VBox.hgrow?
well you want the children of the Hbox to take up the rest of the space
so its hgrow
yeah
also vbox.hgrow doesnt exist
its hard for me to have an overview and tell you exactly why it doesnt work
wanna come talk?
I know that hgrow priority is the way
so I can show you properly
where should it be then?
share it
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<HBox xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" HBox.hgrow="ALWAYS" fx:controller="de.denakkusativ.zusiconomy.gui.controllers.ScenarioDetailsController">
<children>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" style="-fx-border-color: red; -fx-border-width: 5;">
<children>
<Label text="Label" textFill="WHITE" />
</children>
</VBox>
</children>
</HBox>
ah ok, well not sure if it can parse it properly if you separate the fxml files
If I put everything in one fxml, how would I realise different sub pages?
and wouldnt there be incredibly many fields in that controller?
All of the Labels...
I dont want to have a static application with just one screen. I want to have different pages selectable from the menu on the left
yeah thats fine, but you would use a different approach
you currently add the separate fxml nodes using code
yes
didnt know that
so you end up with:
<HBox>
<SomeCustomThing1></SomeCustomThing1>
// ...
</HBox>
so you have one fxml where you combine all of the custom nodes into a single hbox
But then everything is displayed simultaneously
well if you want that
then you are kinda forced to manage some stuff through code
like adding/removing from hbox
and then also setting the hgrow property in code
yeah
Thats what I have currently
I got it working
I dont know how
Got another question though
There is supposed to be a WebView in the space between the buttons on the right and the ScrollPane
It should have the maximum size with a margin of like 20 px
it doesnt show up though
populateDetails() is called when the fxml is loaded
got it working
You can close a thread using: /help-thread close .