glCanvas.setSize(), and drawable.setSize() dont' work...

hello all. i’m trying to get it so that my GL’s canvas to be exactly my requested size. currently, if i call glCanvas.setSize( new Dimension( 1024, 768 ) ), then put it in a Frame, it will shrink down to the minimum size available. if i go back to the basics, and do frame.setSize( new Dimension( 1024, 768 ) ), then everything SEEMS correct. but, in the init() call in the GL, if i ask drawable.getWidth(), or .getHeight(), i get 1024 x 768 - 22 because of the Frame’s title bar.

how can get the glCanvas to set to a specific size, then put it in the frame? for example, if i want to set my glcanvas to 1024 x 768, then put it into a frame. then the frame should be 1024 x 768 +22… edit: obviously, i could just ADD 22 to the requested dimension, but that’s not going to platform independent i don’t think…

sorry if this is such a noob question, and i have tried out a lot of experiments in my code first.

thx.


    Frame frame = new Frame("Gear Demo");
    GLCanvas canvas = new GLCanvas();
    canvas.addGLEventListener(new Gears());
    canvas.setSize(300, 300);
    frame.add(canvas);
    frame.pack();
    frame.show();

hello. thanks ken.

as i said, i tried this already, and the frame collapses to it’s bare minimum size. however, i was doing that with MY opengl renderer and it’s canvas. of course, if you say it should work as you list ( which i tried already ), then it does. which is great, because that means that it must be caused by something else. at least i don’t have to pound my head on that anymore. wish me luck hunting for this bug. i’ll try to make a super simple test case to see if i can make it happen – then maybe i can see what’s causing this. thanks.

Are you sure you called pack()? Before I added that the frame was zero-sized in the above example.

d’oh. and i know better too. thanks ken.