1 Replies - 16770 Views - Last Post: 01 August 2007 - 06:51 PM Rate Topic: -----

#1 mansi  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 22-November 05

swing - size of image on button

Posted 30 November 2005 - 05:34 AM

hi

i am creating a dialpad .
I have an array of buttons and have added imageicons(1,2,3...) on them.
bu these images are not covering the whole of the button.there are spaces left around the images.
I want the button be of the size of the image.
how can i set the size of a button.
setsize is also not working
actaully i wan to reduce the size of the buttons to that of the image.
else my frame is expanding in width which i dont want.


for(i=1;i<10;i++)
{
ImageIcon buttonIcon = new ImageIcon("img_"+i+".gif")
arButton[i] = new JButton(buttonIcon);
arButton[i].setSize(buttonIcon.getIconWidth),
buttonIcon.getIconHeight());
arButton[i].setToolTipText(i+"");
dialPanel.add(arButton[i]);
arButton[i].setSize(10,10);
}

Is This A Good Question/Topic? 1

#5 blastthisinferno  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 1
  • Joined: 01-August 07

Re: swing - size of image on button

Posted 01 August 2007 - 06:51 PM

I had the same problem. Here's what fixed my problem.

http://bugs.sun.com/...?bug_id=4916655
Was This Post Helpful? 1

Page 1 of 1