开发者

need help with jlabel event [closed]

开发者 https://www.devze.com 2023-02-27 15:47 出处:网络
开发者_开发百科 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
开发者_开发百科 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消