Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

free-hand drawing and swing  RSS feed

 
chafule razgul
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible? i would like to use swing instead of awt.Canvas..
I wanted to make an GUI chess game, where the grids and pieces would be drawn onto the Canvas..
Is there a way to do this in Swing?
TIA
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. You can still use canvas if you want, although since it's a heavyweight component, that might cause you problems if you are mixing it with lightweights.
You could create a subclass of JPanel, and override paintComponent() and do you custom drawing in there. Then just add the JPanel to your top-level container and you are ready to rock.
[ April 03, 2002: Message edited by: Rob Ross ]
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to Swing. Because it is a Swing question it should go in the Swing forum - along with the 3 others I've moved there in the last 5 minutes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!