resizing of window
Kevin Rushforth
kevin.rushforth at oracle.com
Wed Jun 27 07:26:13 PDT 2012
But there are set methods that you can use on the Window.
-- Kevin
Jose Martinez wrote:
> The height and width properties on Stage and Window are read only.
>
> thanks
> jose
>
>
> ________________________________
> From: Pavel Safrata <pavel.safrata at oracle.com>
> To: Jose Martinez <jmartine_1026 at yahoo.com>
> Cc: "openjfx-dev at openjdk.java.net" <openjfx-dev at openjdk.java.net>
> Sent: Wednesday, June 27, 2012 9:28 AM
> Subject: Re: resizing of window
>
>
> Setting those properties should work.
> Pavel
>
>
> On 27.6.2012 13:48, Jose Martinez wrote:
>
> Pavel,
>
>> That worked great! Thanks a lot.
>>
>>
>> Is there are a way to change the window size from within the app?
>>
>> thanks
>> jose
>>
>>
>> ________________________________
>> From: Pavel Safrata <pavel.safrata at oracle.com>
>> To: openjfx-dev at openjdk.java.net
>> Sent: Wednesday, June 27, 2012 5:08 AM
>> Subject: Re: resizing of window
>>
>> Hello,
>> Window has width and height properties, you can register
>>
> listeners to them.
>
>> With regards,
>> Pavel
>>
>> On 27.6.2012 3:15, Jose Martinez wrote:
>>
>>> hello,
>>>
>>> I would like to support resizing of my app. I imagine
>>>
> there are two ways this could be done.
>
>>> 1) Free flow resizing. Users just change the window
>>>
> to their desired size. The app's root Parent will scale
> accordingly to fill in the new window size. To support this
> I would need to be notified that the window size has changed
> and have access to the new window dimensions. From looking
> at the Stage and Window classes I do not see any way to
> register a call back on window resize. Is there a way to
> accomplish this?
>
>>> 2) From within the app user selects the window size
>>>
> they want. This is less ideal but acceptable. I did some
> tests and was happy with the performance of the scaled root
> Parent, but did see flickering and objects disappear (I am
> not too concerned about this yet because I was doing live
> scaling changes, versus through an options section from the
> title screen). The problem that I did have was that I was
> not able to change the window size. I tried using
> Stage.setHeight/setWidth and Stage.sizeToScene, but the
> window remained unchanged. I would first create a new Scene
> that matched the new dimensions, update my Stage with the
> new Scene, then change the dimensions of Stage. Is there a
> way to change the window size from within the app?
>
>>>
>>> private static void resize() {
>>> if (scaleFactor > 0) {
>>> Scale scale =
>>>
> ScaleBuilder.create().pivotX(0).pivotY(0).x(1 + .1 *
> scaleFactor).y(1 + .1 * scaleFactor).build();
>
>>> root.getTransforms().setAll(scale);
>>> } else {
>>> root.getTransforms().clear();
>>> }
>>> scene = new Scene(root, WIDTH * (1 +
>>>
> scaleFactor * 100), HEIGHT * (1 + scaleFactor * 64));
>
>>> stage.setScene(scene);
>>> stage.sizeToScene();
>>> //state.setHeight(scene.getHeight());
>>> //state.setWidth(scene.getWidth());
>>> stage.show();
>>> }
>>>
>>>
>>> thanks
>>> jose
>>>
>>
>>
>>
>>
More information about the openjfx-dev
mailing list