hi there! i extends Canvas and i draw image in it like this :
th problem is when i try to put the class instance on a JFrame and user add() , the Canvas doesnt appear , this is how i test it :
thanks in advance Shay
[This message has been edited by samifox (edited September 03, 2001).]
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
posted
0
Please change your name to be compliant with JavaRanch's naming policy. Your ID should be 2 separate names with more than 1 letter each. We really want this to be a professional forum and would prefer that you use your REAL name. Thanks, Cindy I am moving this thread to the AWT/Swing forum.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Geoffrey Falk
Ranch Hand
Joined: Aug 17, 2001
Posts: 167
posted
0
You need to do two things (I think): - Use a layout managerin your Frame; e.g. GridLayout(1,1) - implement getPreferredSize() in your Canvas so that the layout manager knows how big it should be. Note this is based on AWT. I don't know if Swing works exactly the same way.
Sun Certified Programmer for the Java 2 Platform
Paul Stevens
Ranch Hand
Joined: May 17, 2001
Posts: 2823
posted
0
Remove the call to super in the paint method and the string gets drawn. I didn't see the image though.