• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jagged Drawing in Applet after refresh

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic