Hi, I have a JTogglebutton and would like to add an ImageIcon to it.
Simple.
JToggleButton mybutton = new JToggleButton(new ImageIcon("bigger.jpg"));
now I want to add a SMALLER SIZED ImageIcon and set it as the selected Icon.
mybutton.setSelectedIcon(new ImageIcon("smaller.jpg"));
My problem is that since the bigger Icon is the default, when the smaller Icon gets displayed it gets drawn on the top left corner of the button instead of the middle, which is what I want.
SOmewhere the button keeps the starting coordinates of the default icon and uses the same starting coordinates to draw the smaller selectedIcon.
I guess I could
exchange the icons myself by setting the selectedIcon as default, but I want to make use of the functionality that the button already has built in.
The answer should be something similar to the mybutton.setVerticalAlighment(SwingConstants.CENTER);
but this does not work.