hi all. I want to ch ange my jframe's icon(cup of coffee).
i chkd the forum but that's what i m doing...
here's my code:

public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                AppStarter dialog = new AppStarter(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
               [B] dialog.setIconImage(new ImageIcon("untitled.gif").getImage());[/B]
                dialog.setTitle("Welcome user.");
        System.out.println("Exit code here");

I m using netbeans , jdk 6.
untitled.gif is in the same package where the AppStarter class is.
It doesnt change the image...

Could we see the "AppStarter" code. At least the constructor, and the setIconImage method (if you have overridden it).

Hi.This is my constructor..
initcomponents() is auto generated by netbeans.

public AppStarter(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        Oracle_Connector dbc = new  Oracle_Connector();
        S = dbc.make_ORACLE_conn();


So, I assume "AppStarter" extends JDialog? And, I assume you are wanting to cahnge the Image on the title bar, and or task bar?

Also, in this case, it is JDialog's Icon, not JFrame's Icon, as you won't have a JFrame here.

Also, try using the setIconImages method and pass it a List containing the same image several times. I.E.

Image i = new ImageIcon("untitled.gif").getImage();
    dialog.setIconImages(Arrays.asList(new Image[] { i, i, i, i, i, i }));

Just a WAG, as I haven't tried changing the Icons, myself, in a very long time.

This article has been dead for over six months. Start a new discussion instead.