• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Elevated button on mouse over

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
When you create a JMenu and move a mouse over it, you can see an elevated JMenu.
You can also see that in Back/Stop/Forward buttons in IE.
Thats the wasy is works for JMenu.
But, I also need to generate such an elevated JButton for my desktop application.
Regards,
Shankar
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Set a default border for the desired button,
add a mouse listener to it.
use the mouse entered and mouse exited property toggle the border property of the button.
Try this code

regards
Ravindran Shanmugam
 
Shankar Shanmugam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanks for your detailed reply with a neat code.
I didn't a try with border. But, I have a problem here.
When you have a list of JButton in a sequence and try to do a mouse over.
All, the botton's location wud get affected....It willlok like all the JButton's are dancing.
There are two methods setRolloverEnabled() setRolloverIcon().
setRolloverEnabled(true) should give our expected effect. But it doesn't work and API also says that it might not work for some platform (UI L&F).
I tested it with windows.
But, setRolloverIcon() of some Icon is work fine. The icon gets changed.
After all, we don't need to capture mouse events for these two methods.
Thanks in Advance.

Regards,
Shankar
 
reply
    Bookmark Topic Watch Topic
  • New Topic