Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

How to Make JavaFX-Scene fit MSWindows Size?

 
Ranch Hand
Posts: 179
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I have a scene graph which I call "FX-Window", initially to a preferred size that fits my laptop. "Min Size" is set to computed and max size set to "Max Value"

When I move the FX-Window to the HDMI and I click on MSWindow's maximize icon, I get the undesirable result that the right hand size is blank. In other words, the FX-Window did not resize to fit the new MSWindow size.

Please see attached .jpeg

How do I make the JavaFX-Window to fit the maximized MSWindow's size?



WindowSize.jpg
[Thumbnail for WindowSize.jpg]
FX-Window does not resize to fit MS-Window
 
Sheriff
Posts: 6374
172
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

AhFai Chan wrote:Ok, I have a scene graph which I call "FX-Window", initially to a preferred size that fits my laptop. "Min Size" is set to computed and max size set to "Max Value"


This sound like you're doing this in Scene Builder, is that correct?

When I move the FX-Window to the HDMI and I click on MSWindow's maximize icon, I get the undesirable result that the right hand size is blank. In other words, the FX-Window did not resize to fit the new MSWindow size.

Please see attached .jpeg

How do I make the JavaFX-Window to fit the maximized MSWindow's size?


Scene Builder builds the layout, but the setMaximized() is part of the Stage.  But maybe the question is , how to create an FXML that will start less than maximized and then maximized to the full screen?  I will look into that.
 
AhFai Chan
Ranch Hand
Posts: 179
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I am using Scene Builder.  
The rootNode starts with the preferred sizes that I input into scene builder.
I've tried using ChangeListener() stageSizeListener = (observable, old, new),  but that doesn't listen to changes by MS Windows.

The problem is, I can change the style and font using Scene Builder or change the FXML code in the script ( using the CSS coding style though ), but I cannot insert a conditional if-then-else in there, which belongs in the controller.



What am I missing here? Perhaps an interface to MS Windows?

Would appreciate it if you would look into it. Thanks.

If we insert this line in to main controller, the stage will display in maximized form:

But the suibordinated .FXMLs that we fx-include into the main FXML do not resize with MS Windows maximize icon.

Seems Scene Builder is a bit "buggy" and does not offer a granular control the way JavaFX does, but latter is a lot of typing and is not visual.
 
Saloon Keeper
Posts: 6419
60
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AhFai, no more edits will be permitted on your above post. Please add updates with a new post below.
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!