Hi, 1. set LayoutManager to null and forget about it; 2. just draw your shape in the paint() method. 3. override method contains(Point p) and contains(int x, int y) to return shape.contains(p) and shape.contains(x, y); 4. isOpaque() must return false;
Regards Andrei On Tue, 16 Jul 2002 14:52:59 +0000, k _ <[EMAIL PROTECTED]> wrote: >Hello. > >I am trying to implement an application for the drawing and managing of >Geometric Shapes. >I have started by trying to draw all the Shapes on a JPanel. >I have made a class rectanglePanel which extends JPanel which will represent >an individual rectangle.I have overidden the paintComponent method and i >draw a rectangle on the graphics2D context ,which has the size of the >Jpanel. >Well there are many problems with the final drawing rectangle....especially >with its size.It seems that the Layout managers modify the size of the >Jpanel after i am making the draw on the graphics context. > >So the question is : Is this the most elegant and appropriate way on >drawing shapes ,which then will be moved with the mouse,on a JPanel ??? >If you havent understand what i am trying to do take a look at the DRAW4 >demo application from JavaWebStart. > >Thanks. > > >_________________________________________________________________ >MSN Photos is the easiest way to share and print your photos: >http://photos.msn.com/support/worldwide.aspx > > ========================================================================== >To unsubscribe, send email to [EMAIL PROTECTED] and include in the body >of the message "signoff JAVA2D-INTEREST". For general help, send email to >[EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
