Using area of image as button (active area)

Hello
I have image (jpg) that is displayed in applet and I'd like to change portion of it into let's say button. I would see image as I did before but when I move mouse over this button area something would happen (listener).
Can I do it?. If yes, can this button have any shape I want?.
Cheers

yes and yes.
the easy way is this:
put the image in one component, and put the button over top of it. there are a couple ways to do this:
subclass JPanel or JComponent (different people have different preferences here) and override the paint component method to paint the image.
THEN, Override either abstract button or JButton (again, different camps think differently here), and override the paint method (not the paint component method) to do absolutely NOTHING.
add your new button to the panel/component and voila. You have an invisible button overtop of your image (note, the visible property of the button will need to be true for it to respond, but you can choose not to paint the button, even if visible is true).
if you want to use any shape, you must also override the contains method of the button. I find the easiest way to do this is to create a java.awt.Shape or java.awt.Area object, and use the default implemnetation of contains of those objects.
Another solution, rather than painting the image in a JPanel or JComopnent, use the image as the icon of a JLabel, and put both the label and button in the same container, using either a null layout, and set the bounds yourself, or using a layout manager like stack layout which places all components in the same position, with a Z-ordering.
- Adam

Similar Messages

  • Button active area

    So I've made my "button group" in photoshop. But I don't want the images in that group to govern the boundaries of the clickable button. Is there a way to map only a part of that group to be clickable?
    Thanks!

    ptelian wrote:
    Can my button highlight be not inluded in the button group?
    It could be, but then it would no longer be a button highlight - just a plain graphical layer, always visible. In DVD menus, highlights are attributes of buttons only, so your button subpicture layer must be within a button layer set/group.
    It is possible to give the illusion of what you are requesting by using multiple linked menus from buttons that are set to Auto-Activate. But anything more than a few buttons will be a lot of work to set up, and will not work as expected in a software DVD player if you mouse over the button - the user will have to click the button to go to the next menu to see the "highlight".
    p.s. : Button rectangles cannot overlap in a menu. If your design is such that this is what you want, you will have to do the workaround I mention above, or abandon your design. Personally, I prefer working within the limitations of the format and would therefore choose the latter. You'll find that most Hollywood DVDs also work within the limitations of the format.
    Message was edited by: jbowden

  • I have hidden unwanted books from the purchased area of the iBooks store, but they're are still appearing on the front page of iOS as cloud downloads, is there a way to remove these from iBooks without using the hide iCloud books button?

    I have hidden unwanted books from the purchased area of the iBooks store, but they're are still appearing on the front page of iOS as cloud downloads, is there a way to remove these from iBooks without using the hide iCloud books button?
    Let me explain a little more. I had downloaded a lot of free books in the past as a trial when iBooks was first released and since then I have decided I no longer want them, because of this I hid them from the purchased section of the iBooks store. The 5 books left are ones I decided to keep as seen in the following picture.
    This is how it appears in iBooks on my mac. There are 4 books downloaded and 1 book that I have decided not to download at this time. I would still like to keep this book available in the cloud incase I want to download it again in the future. You’ll notice that hide iCloud books is not selected, if I wanted to hide the book that I have chosen to keep in the cloud, but have not downloaded yet I could.
    This is exactly how I think this feature should work. If you have hidden a book from your purchases it should not show up in the mac Ibooks app. (I am aware you can never actually delete a purchase, just hide them and that hidden purchases can be restored to your account from within the account management section of the iBooks store).
    The iOS app is working differently for me. Here is a picture of the purchased tab on the iBooks store in iOS Ibooks. Again notice that pictures of Lilly is still yet to be downloaded. This is how I expected it to look.
    If we visit the front page of iOS iBooks the view is very different from what I expected. Here we can see the 4 books I wanted to keep on my device and have downloaded. We can also see the 1 book I wanted to keep, but did not want to store locally on the device and left in iCloud (Pictures of Lilly). However we can also see all the books I had hidden from the purchased section of my iTunes account and which I believe should no-longer be visible, Dracula, frankenstein etc…
    I am aware of the hide iCloud books button within the iOS app, but I did not need to use this to hide the books I had removed from the my purchased section of the iBooks store on the mac, why are they still appearing in iOS?
    I’m still not sure if this is a software glitch or not. This article suggests to me that books can be hidden, but I had already completed these steps.
    https://support.apple.com/en-us/HT201322
    A browse of google also suggests people may have been able to hide past purchases from the front page of iBooks on iOS in the past.
    In case there was an issue with syncing I tried logging in and out of my iTunes account via settings in iOS. Force closing the app, disabling automatic downloads and removing my device from iTunes in the cloud. Syncing with iTunes on the mac did not correct the issue either.
    Interestingly I have the same issue on my iPhone 6 running iOS 8.3 as I do on my iPad mini suggesting that this might be an issue either with my account or with iOS iBooks software in general.
    If there is a way to remove the already hidden iBooks in your account from the front page of iBooks on iOS without using the hide iCloud downloads button? Please help community!

    My apologies for the lack of photos, here is my post again with photos.
    I have hidden unwanted books from the purchased area of the iBooks store, but they're are still appearing on the front page of iOS as cloud downloads, is there a way to remove these from iBooks without using the hide iCloud books button?
    Let me explain a little more. I had downloaded a lot of free books in the past as a trial when iBooks was first released and since then I have decided I no longer want them, because of this I hid them from the purchased section of the iBooks store. The 5 books left are ones I decided to keep as seen in the following picture.
    This is how it appears in iBooks on my mac. There are 4 books downloaded and 1 book that I have decided not to download at this time. I would still like to keep this book available in the cloud incase I want to download it again in the future. You’ll notice that hide iCloud books is not selected, if I wanted to hide the book that I have chosen to keep in the cloud, but have not downloaded yet I could.
    This is exactly how I think this feature should work. If you have hidden a book from your purchases it should not show up in the mac Ibooks app. (I am aware you can never actually delete a purchase, just hide them and that hidden purchases can be restored to your account from within the account management section of the iBooks store).
    The iOS app is working differently for me. Here is a picture of the purchased tab on the iBooks store in iOS Ibooks. Again notice that pictures of Lilly is still yet to be downloaded. This is how I expected it to look.
    If we visit the front page of iOS iBooks the view is very different from what I expected. Here we can see the 4 books I wanted to keep on my device and have downloaded. We can also see the 1 book I wanted to keep, but did not want to store locally on the device and left in iCloud (Pictures of Lilly). However we can also see all the books I had hidden from the purchased section of my iTunes account and which I believe should no-longer be visible, Dracula, frankenstein etc…
    I am aware of the hide iCloud books button within the iOS app, but I did not need to use this to hide the books I had removed from the my purchased section of the iBooks store on the mac, why are they still appearing in iOS?
    I’m still not sure if this is a software glitch or not. This article suggests to me that books can be hidden, but I had already completed these steps.
    https://support.apple.com/en-us/HT201322
    A browse of google also suggests people may have been able to hide past purchases from the front page of iBooks on iOS in the past.
    In case there was an issue with syncing I tried logging in and out of my iTunes account via settings in iOS. Force closing the app, disabling automatic downloads and removing my device from iTunes in the cloud. Syncing with iTunes on the mac did not correct the issue either.
    Interestingly I have the same issue on my iPhone 6 running iOS 8.3 as I do on my iPad mini suggesting that this might be an issue either with my account or with iOS iBooks software in general.
    If there is a way to remove the already hidden iBooks in your account from the front page of iBooks on iOS without using the hide iCloud downloads button? Please help community!
    iPhone 6, iOS 8.3, Also an issue on my iPad mini iOS 8

  • Where is the advance preferences in the brand new iMovie? it used to be in that button area. i need to do picture in picture!

    where is the advance preferences in the brand new iMovie? it used to be in that button area. i need to do picture in picture!

    This should help you.
    https://discussions.apple.com/message/23468325#23468325

  • Button active state using compressed art

    I have a PSD button placed in Muse, and noticed that after upgrading Muse to 6.0, that the "active" state of a button seems to be using severly compressed artwork. The other states all seem to be using non-compressed images. This may have been an issue in earlier builds, and I just may not have noticed it.
    Thanks for any help.

    Sorry, it's not live at the moment. But I can send you a copy of the file if that's any help?

  • Use DW for mouse over button images but won't validate

    Hi All,
    I've done this three times and give up.  Here's the link http://pooledesignstudio.com/wendysawesomeart/
    I used the Rollover Image icon on the common tool bar and created my nav bar.
    When I try to validate I get 24 errors and they are in the code that DW generates to make the rollover switchout happen. I have no idea how to fix it.
    Please help.
    Thank you,
    KathPoole

    The simplest fix is to change the DOCTYPE.
    You're using a XHTML Transitional DOCTYPE.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    If you replace it with a HTML5 DOCTYPE
    <!DOCTYPE HTML>
    you'll eliminate most of those "errors".
    http://bit.ly/fEEVZk

  • How can I isolate iPad apps so only the ones I want people to use are visible to them?

    Hello. How can I isolate iPad apps so only the ones I want people to use are visible to them?

    At the moment it's not possible, but you could try providing feedback to Apple here http://www.apple.com/feedback/ipad.html (this has come up a few times so you won't be the first person to request it).
    An alternative if you only want your customers to have access to only one app, is to look for cases that prevent access to the home button so that they can't get access to the home screen and therefore other apps. e.g. http://www.staypad.com/photos.html is a mounted case for use on walls/tables etc (there are probably others available, that is just the first one that my search found).

  • Using an advanced action to display an image (or button) on each slide.

    I have an advanced action that evaluates certain criteria. The advance action is called from several different slides within the presentation. Is there some way that I can get it to display a set image if the criteria is met? It seems like I would have to write a new, slightly different advanced action on each slide to "show" the image on each slide.
    Is there some way to share an image (or button) so that the advanced action can make it appear, no matter what slide you are on?
    Let me know if I need to provide further clarification. Thanks!

    Technically your advanced actions are only allowed to show or hide images from the slide where they are actually executed.  So an advanced action executed on slide 3 for example, will not be able to show or hide an image on slide 5.
    However, what you can do is place the image on one of the earlier slides in the project and then set it to be timed for Rest of Project.  This allows you to SHOW or HIDE the image from any slide later in the project where your Advanced Action is executed.

  • I want to hook up a mac mini and us my tv as a monitor. how can I use airplay from my phone on the mac mini like i can with an apple tv (without having to buy an apple tv!). the airplay capabilities i want to use are mirroring and streaming from my iphone

    i want to hook up a mac mini and us my tv as a monitor. how can I use airplay from my phone on the mac mini like i can with an apple tv (without having to buy an apple tv!). the airplay capabilities i want to use are mirroring and streaming from my iphone!

    Download AirPlayer for Mac - Transforms your Mac into an AirPlay-compatible display. MacUpdate.com

  • HT5557 I highlight and study e pubs in ibooks. Now with the up date the color coding that I've be using are too dark and no way to adjust opaqueness. (SHOULD ADD THIS.) Is the an app to by to add to ibooks????

    I highlight and study e pubs in ibooks. Now with the up date the color highlighters that I've be using are too dark and no way to adjust opaqueness. (YOU SHOULD ADD THIS.) Is the an app to by to add to ibooks???? Or an app to but to have other highlighter colors and be able to use the in ibooks???

    I highlight and study e pubs in ibooks. Now with the up date the color highlighters that I've be using are too dark and no way to adjust opaqueness. (YOU SHOULD ADD THIS.) Is the an app to by to add to ibooks???? Or an app to but to have other highlighter colors and be able to use the in ibooks???

  • The add ons i want to use are asking me to be able to continue to sign a liscense agreement...i dont know where they are to be able to sign them...one of the is WIRED-MARKER and the other is JUREEKA...thanx for the help

    Question
    the add ons i want to use are asking me to be able to continue to sign a liscense agreement...i dont know where they are to be able to sign them...one of the is WIRED-MARKER and the other is JUREEKA...thanx for the help edit
    Details

    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities

  • Using a downloaded image as the icon style for a Button

    Hello
    I have a problem and after a lot of investigation I have reached to no conclusion.
    When setting the icon to a Button, a Class of an image is needed. This can be done very simply by embeding an image. But what I would like to do is use an image known only at runtime.
    More exactly I can not download an image from an external source, obtain it bitmapData or something else, convert it and assign it as the icon style for a Button.
    So my problem is that for the Flex components that need an image, a Class needs to be assigned, and I can not use an external image to download it, to convert it in some way and assign it.
    Does anybody have any sugestion? Is it possible?
    My purpose is to make some utility that just downloads the images and after the downloading has been completed, to notify the "client" it should take the "created Class" to use it as a style.
    Thank you in advance for your time,
    Claude Bur.

    A quick google search turned up this solution:
    http://blog.benstucki.net/?p=42
    - Jason

  • Spry menus - using images for buttons

    A search of the forums shows two approaches, to use an image
    for a button in a Spry menu.
    One of them uses HTML to put an <img> into the
    <li>. Here is the example I found cited [contributed by
    arandlett - though said there not to work in IE7].
    <ul class="MenuBarVertical" id="MenuBar1">
    <li><img src="images/bullet.png" align="left"
    /><a class="MenuBarItemSubmenu"
    href="index.htm">home</a></li>
    <li><img src="images/bullet.png" align="left"
    /><a href="#">About</a> </li>
    </ul>
    The other advises "find "background-color" and change it to
    "background-image: url(link/to/image)" " [contributed by The only
    RaM].
    Underlying of course, is the question, how does the HTML
    interplay (or not!) with the Spry javascript?
    By this time, there must be pretty wide experience. After
    all, putting interesting buttons in the popups/dropdowns is in many
    ways what this is about.
    We would be quite appreciative to learn what experience
    indicates, now, is best practice. Or, does it depend, on ... ?
    Thanks in advance for your help, David Allen

    Let me add a note to my own post.
    We would still be delighted to hear others' experience, with
    images in Spry menus. One thing does emerge with a little further
    look: The Spry menu is suited to using the _same_ image for each
    button. If the desire is to vary that image (such as to use an
    unusual font, so that the text changes on each image), then
    Fireworks clearly is the tool of choice.
    Again, we would be pleased to hear other experiences, David
    Allen

  • HT3387 When I use pages the languages that I mainly use are English and Hebrew. The spellchecker works for English but not with Hebrew. How can I add another language to the spellcheck?

    When I use pages the languages that I mainly use are English and Hebrew. The spellchecker works for English but not with Hebrew. How can I add another language to the spellcheck?

    http://m10lmac.blogspot.com/2011/06/extra-spell-checking-dictionaries-for.html

  • Process MAD.EXE (PID=1932). All Domain Controller Servers in use are not responding:

    Process MAD.EXE (PID=1932). Topology discovery failed, error 0x80040a02 (DSC_E_NO_SUITABLE_CDC).
    Look up the Lightweight Directory Access Protocol (LDAP) error code specified in the event description. To do this, use Microsoft Knowledge Base article 218185, "Microsoft LDAP Error Codes." Use the information in that article to learn more about
    the cause and resolution to this error. Use the Ping or PathPing command-line tools to test network connectivity to local domain controllers.
    Process MAD.EXE (PID=1932). All Domain Controller Servers in use are not responding: 
    DC02.targetiletisim.local 
    DC01.targetiletisim.local 
    Process MSEXCHANGEADTOPOLOGYSERVICE.EXE (PID=1148). Topology discovery failed, error 0x80040a02 (DSC_E_NO_SUITABLE_CDC). Look up the Lightweight Directory Access Protocol (LDAP) error code specified in the event description. To do this, use Microsoft Knowledge
    Base article 218185, "Microsoft LDAP Error Codes." Use the information in that article to learn more about the cause and resolution to this error. Use the Ping or PathPing command-line tools to test network connectivity to local domain controllers.
    pls help me :(

    Hi,
    Please use dcdiag and nltest to test the connectivity.
    BTW, have you disabled ipv6 on Exchange Server.
    Thanks,
    Simon Wu
    TechNet Community Support

Maybe you are looking for