Reputation: 172
we are migrating our app from Swing to JavaFX. We have thin client and server. The server tells client which component are in each screen, their default x, y, width, height, data... So they are created on the run. No predefined .fxml. Each screen is compound of several separate frames and inside these frames it behaves the same as outside. Some components (frames and inner parts) are allowed to grow (in vertical, horizontal or both direction) if user resize the screen. It can be any component (table - mainly, separator, textfield..). See example:
Can any layout from JavaFX handle this out of box? I have spend days trying to find any solution but was unable to perfect combination. In Swing we had our custom layoutmanager to handle this. So we have to make our own again in JFX? Thank you
EDIT (more detailed explanation requested by @c0der):
We have scene. In scene there is main content (say MainPanel
) with inner dynamic content based on what user selected to run. The MainPanel
use as max space as possible, so when user resize windows it automatically grows. In MainPanel
we can have 1 or more Panel
. In Panel
we have 1 or more Components (TableView, TextField, Separator..
). Every Panel
or inner Component
has x, y, width, heigh + boolean if it can be horizontaly/vertically scalled. If no Panel
or Component
have hor./ver. scale than it is absolute layout - they do not resize even if user change windows size. If any Panel
or Component
have hor./ver. scale it can grow inside own parent as max as possible (parent width and height) and other components are being pushed away but not outside of parent (like flow pane pushes away other components).
Resizable table
(x=1, y=1, width=120, height=120, verticalScale=true, horizontalScale=true)Separator
- vertical (x=130, y=1, width=1, height=300, verticalScale=true, horizontalScale=false)Separator
- horizontal (x=1, y=150, width=150, height=1, verticalScale=false, horizontalScale=true)Static table
- right (x=150, y=10, width=130, height=180, verticalScale=false, horizontalScale=false)Static table
- bottom (x=1, y=155, width=140, height=160, verticalScale=false, horizontalScale=false)Upvotes: 1
Views: 658
Reputation: 172
I solved this problem using custom layout manager. For those who are interested in I solved it thanks to this: AutoScalePane in JavaFX with layoutChildren() Using that post I created my custom layout manager which can solve everything accoring to my requirements.
Upvotes: 1