java - Unpredictable behaviour with Processing -
java - Unpredictable behaviour with Processing -
i've started creating application in processing, , i'm getting unpredictable behaviour when place papplet object jframe using borderlayout.center.
the width of papplet 100 less width , height of jframe. on occasions, when click 'run', programme fills screen , runs smoothly, on other runs, papplet starts top left , leaves gap on 100 on bottom of screen , left hand side, , quite laggy.
i have no thought going on if i'm honest.
this result runs smoothly: this unpredictable one:here code i'm using:
papplet subclasspublic class jcanvas extends papplet { /** * papplet method - performs setup actions */ public void setup(){ size(1400,900,p3d); background(80); } /** * papplet method - drawing occurs here */ public void draw(){ background(80); pushmatrix(); translate(mousex,mousey, -199); fill(220,0,0); box(120,500,90); popmatrix(); } }
viewer class public final class euroviewer { private final static int width = 1500; private final static int height = 1000; private final static boolean resizable = false; public static void main(string[] arguments){ final jframe frame = new jframe("eurographics papplet"); jcanvas sketchcanvas = new jcanvas(); frame.add( sketchcanvas ); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setsize(width, height); frame.setresizable(resizable); frame.setlocationrelativeto(null); sketchcanvas.init(); frame.setvisible(true); }
}
i tried replace jframe awt.frame incase there stability issues between swing , awt (which i'm led believe papplet built off of) in paticular case.
surprisingly plenty though, there never lag frame, has kind of solved issue. but, i've used jframe, gui work containers etc i've done swing, wondering if share knowledge , explain going on, , if possible fix? issue.
thanks.
it’s not recommended combine processing sketches swing. unpredictable behavior has been reported lot of times.
java applet jframe processing
Comments
Post a Comment