Cannot set minimum size for NewtCanvasAWT

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot set minimum size for NewtCanvasAWT

runiter
I noticed that no matter what value I put for minimum size of NewtCanvasAWT, it keeps reverting back to current size. After debugging I notices this is the reason why:

https://github.com/sgothel/jogl/blob/master/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java#L408

    private final void updateLayoutSize() {
        final Window w = newtChild;
        if( null != w ) {
            // use NEWT child's size for min/pref size!
            final java.awt.Dimension minSize = new java.awt.Dimension(w.getWidth(), w.getHeight());
            setMinimumSize(minSize);
            setPreferredSize(minSize);
        }
    }

Why is it necessary for NewtCanvasAWT to keep updating its own size? Is this a bug?
If not then what is the proper way of setting the minimum size of NewtCanvasAWT?
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Cannot set minimum size for NewtCanvasAWT

gouessej
Administrator
Actually, there is no notion of minimum size in NEWT as far as I know, maybe Sven can confirm.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Cannot set minimum size for NewtCanvasAWT

Xerxes Rånby
In reply to this post by runiter
If you set the size of your attached GLWindow then the NewtCanvasAWT will use the same size as its minimum size.
http://jogamp.org/deployment/v2.3.1/javadoc/jogl/javadoc/com/jogamp/newt/opengl/GLWindow.html#setSize%28int,%20int%29

Den 2015-06-17 17:41, runiter [via jogamp] skrev:
I noticed that no matter what value I put for minimum size of NewtCanvasAWT, I keeps reverting back to current size. After debugging I notices this is the reason why:

https://github.com/sgothel/jogl/blob/master/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java#L408

    private final void updateLayoutSize() {
        final Window w = newtChild;
        if( null != w ) {
            // use NEWT child's size for min/pref size!
            final java.awt.Dimension minSize = new java.awt.Dimension(w.getWidth(), w.getHeight());
            setMinimumSize(minSize);
            setPreferredSize(minSize);
        }
    }

Why is it necessary for NewtCanvasAWT to keep updating its own size? Is this a bug?
If not then what is the proper way of setting the minimum size of NewtCanvasAWT?


If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/Cannot-set-minimum-size-for-NewtCanvasAWT-tp4034732.html
To start a new topic under jogl, email [hidden email]
To unsubscribe from jogamp, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Cannot set minimum size for NewtCanvasAWT

runiter
In reply to this post by gouessej
gouessej wrote
Actually, there is no notion of minimum size in NEWT as far as I know, maybe Sven can confirm.
As a workaround I can force the minimum size by keep resetting it in the resize event function. And it works so I know NEWT is capable of it. But the workaround is ugly so someone just needs to delete the calls to setMinimumSize() in that updateLayoutSize() method and I think it will work nicely.

Xerxes Rånby wrote
If you set the size of your attached GLWindow then the NewtCanvasAWT
will use the same size as its minimum size.
I tried the following but it didn't work. Looks like GLWindow size keeps getting recalculated.

canvas.getNEWTChild().setSize(100, 100);
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D