java - show applet from JUnit test -
how show applet junit test(like eclipse run applet).
example code:
public class applettest { @test public void test() throws interruptedexception { justonecircle applet=new justonecircle(); applet.init(); applet.start(); applet.setvisible(true); timeunit.hours.sleep(2); } }
no results.
the applet needs container drawn. example jframe
.
even not think reason why want that. find example below.
@test public void showjustonecircle() throws interruptedexception { jframe frame = new jframe("justonecircle"); justonecircle onecircle = new justonecircle(); frame.add(onecircle); frame.setsize(200, 200); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setlocationrelativeto(null); frame.setvisible(true); onecircle.init(); onecircle.start(); // applet closed after 5 seconds timeunit.seconds.sleep(5); }
Comments
Post a Comment