aspose file tools*
The moose likes Beginning Java and the fly likes how do I reset the JFrame? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how do I reset the JFrame?" Watch "how do I reset the JFrame?" New topic
Author

how do I reset the JFrame?

Veronica Baumann
Greenhorn

Joined: Aug 29, 2002
Posts: 3
I need to draw a series of lines and then clear the screen and begin drawing again. Can anyone have a look at my code an offer any suggestions?
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ August 29, 2002: Message edited by: Dirk Schreckmann ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Veronica B,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
----------------------
Please note that you can preserve formatting of code by surrounding it with the [code] and [/code] UBB Tags. Nicely formatted code is often much easier to read and understand. Also, note that you have the ability to edit your own posts. Just click on the icon that looks like a piece of paper.
Good Luck.
[ August 29, 2002: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Veronica Baumann
Greenhorn

Joined: Aug 29, 2002
Posts: 3
log on name corrected - sorry about that
:roll:
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I'm not exactly sure what your question is. The program would seem to draw the lines just fine, but it doesn't clear the screen. So, are you asking how to change it to clear the screen?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Perhaps you want to invoke clearRect( int , int , int , int ) . This is your paint method with one line added to clear the screen when your counter reaches 100.If that is what you were trying to figure out, then you don't need me to tell you what methods are available to a Graphics object. Every Java programmer should become very familiar with The J2SE API Documentation. It's full of great information about what classes do what.
Veronica Baumann
Greenhorn

Joined: Aug 29, 2002
Posts: 3
Thank you for the assistance. The clearRect was the answer I was looking for.
Thanks again
[ August 29, 2002: Message edited by: Veronica Baumann ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Well, the example that I suggested does clear the screen when the counter reaches 100.
If you'd like to control the display differently, then remember that you can pass around the Graphics object reference to different methods. You could also use an offscreen image buffer to control the display, but that may be overkill for this simple application.
Update: Sure, go and change your reply and make me look the fool.
[ August 30, 2002: Message edited by: Dirk Schreckmann ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do I reset the JFrame?
 
Similar Threads
repaint() problem
problems using paint(Graphics g)
how to repaint but still keep the graphic that painted previously?
JComponents won't show until I move mouse over them
How to make rectangle drawn to be vissible when a new rectangle is drawn