java applet not responding to repaint request in webkit browsers -
i have tiny java applet i'm writing solve specific problem in our company intranet in browser neutral way. used accomplished activex we'd let people move away ie. code unsafe public consumption, it's useful under controlled circumstances. want user able click link in , open application installed on local machine based on data returned ajax call. signed java applet , certificate has been accepted on local machine.
currently works in ie , opera, fails in chrome , safari. appears repaint() method doesn't cause repaint, struggling with. here's applet code:
import java.applet.applet; import java.awt.graphics; import java.util.*; public class odehapplauncher extends applet { private arraylist<string> torun = null; public void paint(graphics g) { system.out.println("-----painting"); try { if (torun != null) { new processbuilder(torun).start(); torun = null; } } catch (exception e) { system.out.println("-----exception e = " + e); e.printstacktrace(); } } public void runapp(string appname, string args) { system.out.println("-----running app: " + appname); torun = new arraylist<string>(2); torun.add(appname); torun.add(args); system.out.println("-----triggering repaint..."); repaint(); } }
here last few lines of java console each of 4 tested browsers when runapp method called:
ie 9 (beta) - works:
basic: applet started
basic: told clients applet started
-----painting
-----running app: notepad.exe
-----triggering repaint...
-----painting
safari 5.0.2 (7533.18.5) - fails
liveconnect: javascript: default security policy =
-----running app: notepad.exe
-----triggering repaint...
opera 10.62 - works
basic: applet started
basic: told clients applet started
-----painting
-----painting
-----painting
-----running app: notepad.exe
-----triggering repaint...
-----painting
chrome 6.0.472.63 - fails
basic: applet started
basic: told clients applet started
-----running app: notepad.exe
-----triggering repaint...
please let me know if can think of reason why isn't behaving consistently (or better way in general). should point out i've tried launching process directly runapp call, fails universally.
maybe link gives few hints. instance:
note: if multiple calls repaint() occur on component before initial repaint request processed, multiple requests may collapsed single call update(). algorithm determining when multiple requests should collapsed implementation-dependent. if multiple requests collapsed, resulting update rectangle equal union of rectangles contained in collapsed requests.
you might want check if applet visible, if there has been paint recently, , if update(graphics) called...
Comments
Post a Comment