Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Irregular shaped JComponents  RSS feed

 
todd runstein
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to start a new project that includes "puzzle pieces". Each piece "interlocks" to another peice, as a real world puzzle would.

I need to highlight each piece when the mouse travels over it (using a MouseMotionListener). This is easy to do with square or rectangular shapes, but I've not tried this with odd shape pieces. I could certainly have the centers act as the "hotspot", but this isn't really what the customer wants. The piece should highlight when any portion of it is under the cursor.

This project (or at least this one part of it) would be easy to do in Flash. Any suggestions on how to do it Java?
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find information on this in the 2D Graphics trail, especially the pages Stroking and Filling Graphics Primitives,
Constructing Complex Shapes from Geometry Primitives and the page that follows.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!