We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › bug 'fix' for changing size()
Page Index Toggle Pages: 1
bug 'fix' for changing size() (Read 515 times)
bug 'fix' for changing size()
Feb 11th, 2006, 11:48pm
 
running the function size() after having started the applet only changes the PGraphics, so adding frame.setSize(width,height); fixes so the window updates to the correct size

-seltar

code example:
Code:

float w = 128;
float h = 96;
float z = 5;

void setup()
{
resize();
}

void resize()
{
size((int)(w*z),(int)(h*z));
frame.setSize(width,height); // this makes all the difference
}

void draw()
{
background(0);
}

void keyPressed()
{
if(key == '-'){ z=max(z-1,1); resize(); }
if(key == '+'){ z=min(z+1,15); resize(); }
}
Re: bug 'fix' for changing size()
Reply #1 - Apr 14th, 2006, 4:07am
 
changing size via size() isn't really supported. however if you're using a java layout manager you can properly resize components the other way around (i.e. if the applet is in a layout as a component in another java app).
Page Index Toggle Pages: 1