Setting an icon on a JButton
- From: "dushkin" <dushkin@xxxxxxxxxx>
- Date: 25 Dec 2006 08:29:24 -0800
Hello there,
Please review the following code segment....
/*************************************************************/
public class IMIEasternButtonPanel extends JPanel {
private BoxLayout bl = new BoxLayout(this, BoxLayout.LINE_AXIS);
private JButton m_btnUp, m_btnDown;
public IMIEasternButtonPanel(){
setLayout(bl);
setPreferredSize(new Dimension(500,50));
addChilds();
}
public void addChilds(){
boolean b = FilesUtils.isFileExists("up.gif"); //b = true !!!
Icon upIcon = null;
upIcon = new ImageIcon("up.gif");
m_btnUp = new JButton();
m_btnUp.setIcon(upIcon);
m_btnUp.setSize(50, 50);
add(m_btnUp);
/*******************************************************/
Why can't I see the icon on the up button??? Moreover, the button does
not seems to get the correct size as I had set. It is more like a
oblong than a 50X50 square...
Many thanks!
.
- Follow-Ups:
- Re: Setting an icon on a JButton
- From: hiwa
- Re: Setting an icon on a JButton
- Prev by Date: Re: Lineweight dependent on drawing scale - how to keep line weight at 1
- Next by Date: Re: Setting an icon on a JButton
- Previous by thread: Lineweight dependent on drawing scale - how to keep line weight at 1
- Next by thread: Re: Setting an icon on a JButton
- Index(es):