need help with jlabel event [closed]
i have a JLABEL that i stack an image in him... now i want to create event when i'm clicking only on spacial part on the image... for example if i have a JLABEL that i stick on him a picture of a man i want that event will appear only when i click on the head how can i do that?
What you are describing is an image map. There's not necessarily an easy way to do it with the icon of a JLabel, but you can write some code to do it yourself. This example applet is a place to start. Important things to note are that you will be implementing a MouseListener and MouseMotionListener on your image to know where the user is clicking as well as that you will be using the Java Image API and Java 2D API to accomplish this.
精彩评论