I have a button with an image in it. When I reduced the width of the button, the image was centered in the button which I do not want to happen. I want it to be left-aligned in the button but have no idea how and searching hasn't yielded any answers so far.
The image is of size 50x67. and the button is 20x67.
Below is the relevant code that I have.
cardPics = new JButton; fileURL = getURL("./Images/000.gif"); iconFile = new ImageIcon(fileURL); cardPics[j][i] = new JButton(iconFile); cardPics[j][i].setPreferredSize(new Dimension(20,67));
Thanks, any help would be appreciated.