gluonhq / scenebuilder

Scene Builder is a visual, drag 'n' drop, layout tool for designing JavaFX application user interfaces.
https://gluonhq.com/products/scene-builder/
Other
748 stars 220 forks source link

Program nearly always starts maximized. #430

Open alantcote opened 2 years ago

alantcote commented 2 years ago

The program nearly always starts up maximized.

Expected Behavior

It should "remember" the window geometry for the next use, or choose one which isn't so greedy for screen real-estate.

Current Behavior

The program nearly always starts up maximized.

Steps to Reproduce

The only thing I've had to do to reproduce the problem is to start up the program.

Your Environment

I nearly always start SceneBuilder from within the Eclipse IDE, on MS Windows 11.

Screenshots

Oliver-Loeffler commented 2 years ago

Hi @alantcote, I am analyzing the issue and learned, that Scene Builder indeed always starts maximized by default. An exception is MacOS, there Scene Builder does not start maximized.

How it works:

The windows is positioned in com.oracle.javafx.scenebuilder.app.DocumentWindowController within the openWindow() method. Here a conditional call to getStage().setMaximized(true) is placed when the platform is not MacOS. There is a corresponding closeWindow() method.

Both places seem to be suitable to implement a point so memorize and load the actual window position. This could be handled by com.oracle.javafx.scenebuilder.app.preferences.PreferencesController which offers the method PreferencesRecordDocument getRecordDocument(final DocumentWindowController dwc). The PreferencesRecordDocument stores all view related settings such as stage height, visibility of elements and so on. So

The solution approach could be:

Questions:

@johanvos, @abhinayagarwal, @AlmasB:

alantcote commented 2 years ago

Your proposal sounds good to me.

abhinayagarwal commented 2 years ago

My personal preference would be to have an option to toggle this feature from the preferences dialog.

Oliver-Loeffler commented 2 years ago

An option preferences dialog seems like a good idea. It provides a choice to the user.

alantcote commented 2 years ago

Potentially useful if you implement the proposal would be my Preferences editor. It's a bit rough; if you know of a better tool for the purpose, please elucidate.

paul-court commented 2 years ago

Would it be simpler (from both code and UX) to just remember the maximised state along with the window geometry instead of having to go and hunt down a preference option?

alantcote commented 2 years ago

Sample code for window geometry memory may be found at https://github.com/alantcote/dupfilefinder2/blob/main/dupfilefinder2/src/main/java/cotelab/dupfilefinder2/WindowPrefs.java