#Quick question about JavaFX responsiveness

1 messages · Page 1 of 1 (latest)

muted drift
#

How can I make the red area fill out everything right of the ScrollPane?

civic basaltBOT
#

<@&987246487241105418> please have a look, thanks.

muted drift
#

The underlying Node is an HBox, and this is the layout of the red area

muted drift
pearl shard
#

The whole thing is in a hbox right?

muted drift
#

yes

pearl shard
#

Then make that element to have priority to fill that place

muted drift
#

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

muted drift
#

Is it possible without this?
In scenebuilder?

pearl shard
muted drift
#

I did and I have not found a solution. I searched for:

scene builder element priority fill

pearl shard
muted drift
#

Thats enabled already

#

It does not work. As I said before

pearl shard
#

well thats how you would do it 🤷‍♂️

#

maybe share the fxml

muted drift
#

Im not home currently. I will when I am back home

muted drift
civic basaltBOT
muted drift
#

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

pearl shard
muted drift
#

what?

#

what fxml do you want?
This is the full fxml of the right side

pearl shard
#

its the one of the left side

muted drift
#

everything right of the scrollPane

pearl shard
#

you maybe send the wrong thing?

muted drift
#

Oh I am sorry

#

my bad

pearl shard
#

all good

muted drift
#

thats the root pane

#

Which one do you want?

pearl shard
#

so you have each element (in the root hbox) split into its own fxml file right?

muted drift
#

yes

#

as you told me to

pearl shard
#

I did?

#

cant remember that I did that

#

but its fine

muted drift
#

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?

pearl shard
#

I thought you asked if you should have a specific controller for each specific fxml

#

but whatever

pearl shard
#

no

muted drift
#

okay

#

whatever

#

which fxml do you want to have?

pearl shard
#

anyways show the one you want to have hgrow priority

#

and then show how you add it to the hbox

muted drift
civic basaltBOT
muted drift
pearl shard
#

the hgrow is placed wrong

pearl shard
#

it needs to be one the child directly under the hbox

muted drift
#

or is it VBox.hgrow?

pearl shard
#

well you want the children of the Hbox to take up the rest of the space

#

so its hgrow

muted drift
#

yeah

pearl shard
#

also vbox.hgrow doesnt exist

muted drift
#

yeah its obviously hgrtow

#

okay

#

so why doesnt it work?

pearl shard
#

its hard for me to have an overview and tell you exactly why it doesnt work

muted drift
#

wanna come talk?

pearl shard
#

I know that hgrow priority is the way

muted drift
#

so I can show you properly

pearl shard
#

I cant

#

I need to go soon

#

but maybe later or tomorrow

muted drift
pearl shard
#

the hgrow is set on the direct children

#

you can try around with a simpler example

muted drift
#

I did

#

and Java tells me that HBox.Hgrow is not allowed in a VBox

pearl shard
#

share it

muted drift
#

<?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>

pearl shard
#

as I said

#

you need to set it on the children

muted drift
#

That is the child

#

This is what I add on the root HBox

pearl shard
#

ah ok, well not sure if it can parse it properly if you separate the fxml files

muted drift
#

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

pearl shard
#

yeah thats fine, but you would use a different approach

#

you currently add the separate fxml nodes using code

muted drift
#

yes

pearl shard
#

but you can create custom elements in fxml as well

muted drift
#

didnt know that

pearl shard
#

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

muted drift
#

But then everything is displayed simultaneously

pearl shard
#

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

muted drift
#

yeah
Thats what I have currently

muted drift
#

I got it working
I dont know how
Got another question though

muted drift
#

it doesnt show up though

#

populateDetails() is called when the fxml is loaded

#

got it working

thick spade