Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using Polygon/SVG for Buttons?  RSS feed

 
joe mo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'd like to make some shapes I created in Adobe Illustrator buttons in a java applet. I'm using the Polygon.contains() method to determine whether or not the user is clicking within the shapes. Some of the shapes are pretty complex and so it's time consuming to move the point coordinates from the illustration to a Polygon. Is there an easy way to use an imported SVG shape with something like Polygon's contains method or translate the SVG data to a Polygon?
Thanks.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you'll have better luck with this question in our Swing/AWT forum. I'll move this post there for you.
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of accurate algorithm to calculate the mouse inside or not, my suggestion is approximate calculate against a rectangle or eclipse.

User interface does not require mathematical accuracy, which only slows things down.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!