• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rectangle class

 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i,am new to applets . Have not really coded much in applets . Trying to use the rectangle class in the shape interace . How do i draw this rectangle ?
thanks
regards
raghav mathur
[ April 30, 2002: Message edited by: raghav mathur ]
[ April 30, 2002: Message edited by: raghav mathur ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't it be great, if given a Rectangle r, one could just do something like Graphics::drawRect(r) ?
But no, we can't do this. We have to do it the hard way:
Graphics::drawRect(r.x, r.y, r.width, r.height)
One thing to note: You will discover that Graphics::drawRect(int, int, int, int) and Graphics::fillRect(int, int, int, int) don't use the exact same area to display the rectangle. One of them is 1 pixel larger vertically and horizontally.
Good Luck.
[ May 01, 2002: Message edited by: Dirk Schreckmann ]
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic