The Artima Developer Community
Sponsored Link

Java Answers Forum
Some more applet help

1 reply on 1 page. Most recent reply: Jul 4, 2002 7:23 PM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Hiran

Posts: 41
Nickname: jclu
Registered: Mar, 2002

Some more applet help Posted: Jul 3, 2002 6:20 PM
Reply to this message Reply
Advertisement
How do I clear what I've drawn? In particular, a string that's been drawn using the drawString method in Graphics2D?

I had to create a discrete-event simulation application for some situation that was given to me (for a school project). For bonus marks, I have to design an applet to animate the simulation.

Right now, I plan to have 8 boxes on the screen. Four for the four servers, and four for each server's respective queue. I want to write in the boxes information about each queue or server. For each queue, I'm just going to write the length of the queue, and for each server, whether a person is being serviced or not.

I have everything set up. My only problem is that when I call repaint, and the strings are redrawn, what was there before isn't cleared. For the boxes, it doesn't matter, since they stay in the same position. But how do I clear what was drawn before? Thanks for the help.
Hiran


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Some more applet help Posted: Jul 4, 2002 7:23 PM
Reply to this message Reply
Construct a Rectangle around the string, and use a fill command to to wipe it out.

or
setColor(Color.black);
fillRect(x,y,width,height);

Flat View: This topic has 1 reply on 1 page
Topic: String padding Previous Topic   Next Topic Topic: download file from webobjects and report...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use