wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes painting problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "painting problems" Watch "painting problems" New topic
Author

painting problems

Tian Zhang
Greenhorn

Joined: Mar 23, 2005
Posts: 24
hi there!

just a quick question, i have two classes as follows:



and the later on else where in a different class i have



unfortunatly the instance of display does not show the two rectangles... could you tell me where i'm going wrong?

thanks,
Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
I am not too knowlegable in GUI stuff, but don't you want setVisible(true); ?

It is painting it, but is the frame is not visible. Hope that helps.


"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
rob armstrong
Ranch Hand

Joined: Jul 25, 2005
Posts: 77
extends JFrame?
roba
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
As Rusty mentioned you need to make the Frame visible using setVisible(true) not false. Your code won't work though, it's going to paint the rectangles once. As soon as the frame repaints the rectangles will be gone. You need to move your rectangle painting code to paint() method of the frame or to a widget which you add to the frame.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: painting problems