Hi

How can i change my application default java icon with my own?
The problem is that my frame dont have a name =(

.....

 public Main() {
        super("PDB Viewer");

    GLCapabilities caps = new GLCapabilities();
    caps.setDoubleBuffered(false);

    canvas.addGLEventListener(new SecondGLEventListener());
    canvas.addKeyListener(new SecondGLEventListener());

    getContentPane().add(canvas, BorderLayout.CENTER);
    canvas.requestFocus();


        initComponents();
        pack();
        setBounds( 150, 20, 800, 750 );
        
    }

.....

Something above...

Thanks :D

what do you mean? your jar file to have another icon? your frame to have another icon in the bar on top of it???

what do you mean? your jar file to have another icon? your frame to have another icon in the bar on top of it???

oh, yeah yeah, i want my frame to have another icon, instead of default java icon

never really tried it myself before, but you might want to take a look at this:
example

Hi

How can i change my application default java icon with my own?
The problem is that my frame dont have a name =(

.....

 public Main() {
        super("PDB Viewer");

    GLCapabilities caps = new GLCapabilities();
    caps.setDoubleBuffered(false);

    canvas.addGLEventListener(new SecondGLEventListener());
    canvas.addKeyListener(new SecondGLEventListener());

    getContentPane().add(canvas, BorderLayout.CENTER);
    canvas.requestFocus();


        initComponents();
        pack();
        setBounds( 150, 20, 800, 750 );
        
    }

.....

Something above...

Thanks :D

Try this:

window.setIconImage(Toolkit.getDefaultToolkit().getImage("image.gif"));

Try this:

window.setIconImage(Toolkit.getDefaultToolkit().getImage("image.gif"));

he would've found this in the example I provided earlier..
in order to read your post clear, you might also want to specify the class of which "window" is an instance of.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.