Jump to content
  • Advertisement
Sign in to follow this  
GekkoCube

[java] Do Applets support vector graphics and/or hotspots?

This topic is 4359 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

1) applets can scale images, but only at whole integer values. so i was wondering if applets support vector graphics? 2) do applets support hotspots like the way Flash supports hotspots for buttons and objects and stuff?

Share this post


Link to post
Share on other sites
Advertisement
Java allows you to draw shapes which scale nicely. More specifically, the Graphics class allows this.
As for hotspots, the best you could do is draw shapes, listen for a click event, and see if that event occurred within that shape. I suppose you could also do it with containers or custom buttons too, but that's a bit more work.

Share this post


Link to post
Share on other sites
Hi,

Quote:
1) applets can scale images, but only at whole integer values. so i was wondering if applets support vector graphics?

Yes java applets support vector graphics
Quote:
2) do applets support hotspots like the way Flash supports hotspots for buttons and objects and stuff?

Yes java applet support "hotspots"

Since Java is a programming language it supports many ways to implement both vector graphics and hotspots. The Java API which is a collection of already writen code contains a solution that allows you to use Vector graphics in your application or applet.

I hope this answers your questions?

Share this post


Link to post
Share on other sites
vector graphics: the use of geometric lines and i think even curves these days. doesnt use pixels to draw in the conventional sense of the word, but rather renders using shapes thus giving scaled images to be perfect representations of their original scale. in contrast a regular image, like a jpeg, will look pixelated when scaled out. ie. think asteroids the game.

hotspots: buttons (and objects) in Flash that throws an event when your mouse touches it (hoevers over it) at which point the button may change colors or animate. windows can do this and so can java. but i believe it is specifically called hotspots in Flash.

Share this post


Link to post
Share on other sites
I'm guessing what you're wanting is some kind of handy construct that acts like the hotspots in Flash. I know of no objects capable of this, but it shouldn't be too difficult to emulate.

Share this post


Link to post
Share on other sites
Whackjack

I looked deeper into the java API and i am not seeing a way to scale an image nicely to say 120%. the drawImage method that is available has int width and height parameters which are whole numbers, not floats.

Also, for vector graphics, are you suggesting using the 3d capabilities, by using polygons or shapes to draw?

Finally, for hotspots, i am specifically looking for mouse hover (or mouse entering) a small area (like a circle or a square). i thought about button components but i cant control the way the button looks (in other words, i've no choice but to have it look like a button). or am i wrong about this?

Share this post


Link to post
Share on other sites
Hi,

Quote:
Whackjack

I looked deeper into the java API and i am not seeing a way to scale an image nicely to say 120%. the drawImage method that is available has int width and height parameters which are whole numbers, not floats.

Also, for vector graphics, are you suggesting using the 3d capabilities, by using polygons or shapes to draw?

Finally, for hotspots, i am specifically looking for mouse hover (or mouse entering) a small area (like a circle or a square). i thought about button components but i cant control the way the button looks (in other words, i've no choice but to have it look like a button). or am i wrong about this?

You can control the way components look in java swing offers a wide range of configurable visual styles.

Look at javax.swing

JButton allows you to set a rollover image which will automatically trap mouseover events as well as a selected image, and a pressed image, as well as the regular idle image.

Also you might want to look at the shape interface
Look at "All Known Implementing Classes" list and to render any to a the screen look at Graphics2D.draw( Shape s )

There are shape primitives that do use double values so there is a lot more precision.

Hope, that helps!

Share this post


Link to post
Share on other sites
Also look at the java.awt.Graphics2D class. In all Java visual components in hte paint/paintComponent methods, the Graphics object is always a Graphics2D object. You can just cast it to use the more advanced features of Graphics2D. As well this will allow you to use AffineTransforms, among other things.

The following links should help.

http://java.sun.com/docs/books/tutorial/2d/index.html
http://java.sun.com/javase/6/docs/technotes/guides/2d/spec/j2d-bookTOC.html

Share this post


Link to post
Share on other sites
thanks.

i am aware of the button having a mouseOver event. but i didnt like the way buttons look in my drawing "canvas". but the Shape objefct intrigues me. ill look into it. can it be drawn as an image (ie. jpg) and can it detect mouseover events as well?

anyhow, i think i have made a decision to switch API's from Java Applets to Flash ActionScripts.

flash always seem to look better and react smoother. i wont be starting on the implementation of this project until a while. still gotta draw up the blue-prints and research the best API's to do this.

thanks all.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!