Problem with ImageIcon

Hi,

I have added an image in the JButton which is added to a frame with null layout. The JButton is placed using setBounds.

[ btn_save = new JButton(new ImageIcon("img/save.png"));]

My problem is that I cannot see the JButton when the frame loads. However, if I click on the position where the (invisible) JButton exists, it becomes visible.

Thanks in advance.

Anuj

[402 byte] By [anuj321a] at [2007-10-2 12:39:41]
# 1
check the order of when the frame's visibility is set to true, and the adding of the buttonif you have thissetVisible(true);add(button)it should be the other way around
Michael_Dunna at 2007-7-13 9:43:02 > top of Java-index,Desktop,Core GUI APIs...
# 2
The button is added before making the frame visible.I forgot to mention that the JButton wthout image works fine.Thanks for the reply.Anuj
anuj321a at 2007-7-13 9:43:02 > top of Java-index,Desktop,Core GUI APIs...
# 3
I am very sorry .... the JButton cannot be viewed with or without image.The JButton is added to a Frame. The other Buttons can be seen. So I guess the actual problem is that a Jbutton is not visible until clicked whereas a Button is.Sorry again.Anuj
anuj321a at 2007-7-13 9:43:02 > top of Java-index,Desktop,Core GUI APIs...
# 4
> I am very sorry .... the JButton cannot be viewed with or without image.Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/button.html]How to Use Buttons[/url] which has a working example.
camickra at 2007-7-13 9:43:02 > top of Java-index,Desktop,Core GUI APIs...