Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes JButton size changes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JButton size changes" Watch "JButton size changes" New topic
Author

JButton size changes

rajshkhr pandey
Ranch Hand

Joined: Oct 14, 2009
Posts: 35
Hello to all,

I am developing an application in which I have used JToolBar with JButtons.
I am using the images instead of text as in following code



The image named save_big.jpg is of 20 X 20 and save.jpg is of 16 X 16
The problem arise when the mouse event occurs the button size resizes instead of the image i.e. on mouse entered event the button becomes big and on mouse exited event the button retains normal size as before.
I might be be because of the change in the size of image. I want the mouse hover effect on the button.
Also the image remains in the center of the button but I want the whole button to be covered by image.
Can anyone help me please.
Thank in advance
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10486
    
    9

Check out AbstractButton#setRolloverEnabled and JButton#setRolloverIcon


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
Consider Paul's rocket mass heater.
 
subject: JButton size changes