here I have created an image which looks like a 3d button and I want to use it as a button in java swing for my application.
I tried the following code:
ImageIcon water = new ImageIcon("button.jpeg");
exceptionButton = new JButton(water);
I got it as image but it had featured like border of the button so i used the following code:
exceptionButton.setBorder(BorderFactory.createEmptyBorder());
exceptionButton.setContentAreaFilled(false);
exceptionButton.setFocusPainted(false);
exceptionButton.setOpaque(false);
But it didnt help. I want the actual image to act as a button. The image has rounded corners but right now the image is coming in the button and loosing its actual effect of rounded corners. Also I want it focussed when a user brings mouse over it. Since I have put image for button with above code, I am not getting the effect of button press when user clicks on it.
How should I change my code?