Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Applet not refreshing /repainting once covered  RSS feed

 
Stuart Hoffman
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having trouble with my Applet.
When I open up a new window or even pop up a dialog to get input from a user the Applet does not refresh so the screen looks all screwed up.
I sure could use help on this.
Oh yeah, the Applet has a JTable in it as well if that makes a difference.
Thanks
Stuart
 
Stuart Hoffman
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case anyone looks at this I found a work around.
The JApplet was not refreshing, possibly due to my JTable which on
doing come summation interupted the paint process.
I added a mouseMotionListener to the Container for the panels in my
JApplet and that worked.
to add the listener I added it to the JApplet
public void init()
{
addMouseMotionListener(this);
...

to avoid making my JApplet abstract I added the following:
public void mouseMoved(MouseEvent event)
{
//System.out.println("Mouse Moved");
container.paintComponents(getGraphics());
}
public void mouseDragged(MouseEvent event)
{
super.repaint(1);
}
the line container.paintComponents.. fires whenever the user moves
their mouse over the JApplet and forces an immediate repaint.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!