Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #492
| From | "dushkin" <dushkin@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Setting an icon on a JBut |
| Message-ID | <1167064164.106268.63990@73g2000cwn.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| Date | 2011-04-27 15:27 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
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!
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Next in thread | Find similar
Setting an icon on a JBut "dushkin" <dushkin@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting an icon on a "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting an icon on a "dushkin" <dushkin@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
csiph-web