Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jagged Drawing in Applet after refresh

 
chimby thompson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a little applet that allows someone to "sign" an e-document with the mouse, but the applet flakes out after a couple of page refresh's. Specifically, it is impossible to draw a straight line. It jumps all over the place and the result is a jagged mess of scribbles.

To reset the applet you have to close the browser and reopen (as far as I know).

Any thoughts?

thanks,
-dt

:::I have a small screenshot, but nowhere to post it. I can email it if anyone wants to see it.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you are initializing things in the constructor or init() method that you ought to be doing in the start() method.
 
chimby thompson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm listening... I haven't used java in about 6 years, could you expand a bit?

-thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When an applet is created, obviously the constructor is called. Then it is stuck into the web page, and init() is called. Then start() is called. When you browse away from a page, stop() is called. When you browse back, start() is called again.

So I'm imagining that there's something that should be initialized whenever start() is called, but instead you're initializing that thing in init() or in the constructor, so it's only done once. Alternatively, there could be something that you are doing in start() that should instead be done only once, in init() -- like adding new components.
 
chimby thompson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you might be on to something. Almost everything in this applet is done from init()...check it out:



I will see if I can move stuff into the start() method to see if that works. Thanks for the hint.

-dt
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mmmm, well, I don't think moving all that into start() necessarily makes sense, but it might be that you need to add some code in start() to reinitialize something or other. I'm (obviously) not familiar with the third-party library you're using or the protocol in use, but maybe some of them setTabletState(X) or clearTablet() methods need to be called from start() and/or stop(). Check out the documentation to see when and where these things are supposed to be called.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic