0

How to reinitialize full java applet on the click of a button (JButton) from with in a applet?

I want the applet to behave like as it behaves first time. I have acquired scanner in my applet, but I don't know the function to release that. Whereas destroying and restarting applet do so automatically. Is there any way I can see what function this Java applet is using to release that scanner resource? So that same way I can call that method.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Ashish Kataria
  • 520
  • 3
  • 11
  • 31

1 Answers1

0

Normally this sequence of calls should do the trick:

stop();
destroy();
init();
start();
Hakan Serce
  • 11,198
  • 3
  • 29
  • 48
  • I have acuired scanner in my applet, but i don't know the function to release that...where as destroying and restarting applet do so automatically.. is there any way i can see what function this java applet is using to release that scanner resource..? so that same way i can call that method.. – Ashish Kataria May 24 '12 at 07:56
  • Can you post how you acquired a scanner, then we can see to how to release it. May be there is just a close() method which does the trick? – Hakan Serce May 24 '12 at 08:41
  • I am using mmscomputing twain library jar to acquire scanner(scanner.acquire()), below is the code: http://rsbweb.nih.gov/ij/plugins/download/Scan_.java As you see there is jButton1.setText("Scan") button, it's calling getscan() function scanner.acquire() method.. so for once it acquired scanner..now second time clicking this button it's not doing the same thing as it should do for every time starting fresh applet... – Ashish Kataria May 24 '12 at 10:41