resizing glcanvas doesn't work properly

Hi,

I’m using glcanvas to implement a 2D graph with x- and y-axis and scales on the axis. The glcanvas is added to a JPanel which is added to a JFrame window.
I can increase and decrease the window in the horizontal direction and also increse it in the vertical direction such that the glcanvas is resized properly. However when I try to decrease the window in the vertical direction, the glcanvas is not resizing at all. I have no idea why this is happening. Does anybody have an idea?

BTW, my GLEventListener.reshape() method is empty.

/Amir

Use GLJPanel instead of GLCanvas when working with JFrame.

Thanks, it helped. :slight_smile:

If you insist on using GLCanvas w/ JFrame, make sure you do not use JFrame.setDefaultLookAndFeelDecorated(true) before the creation of JFrame.

hi,

I’ve got the same probleme with a GLCanvas in a JPanel which is on a complex set of others JSplitPane and JPanels.
I could only increase the size of the GLCanvas.

I think it is because when I increas it’s size, the GLCanvas set its minimum size to its new size.

I fixed the problem by adding the following line in my reshape function :

/* (non-Javadoc)
* @see net.java.games.jogl.GLEventListener#reshape(net.java.games.jogl.GLDrawable, int, int, int, int)
*/
public void reshape(GLDrawable glDrawable, int x, int y, int width, int height) {

    // .....
    
    this.setMinimumSize(new Dimension(10,10));
   
    // .....
    
}