Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I change the icon of an apllication

0 views
Skip to first unread message

cricque

unread,
Jan 19, 1999, 3:00:00 AM1/19/99
to
Instead of using the coffecup Java icon in the topleft corner i would like
to use another icon

is it possible

How od you do this

frame.setIcon(icon); ???????????


Using jdk1.2 on winnt
(sometimes using jdk1.1.7 and swing 1.03 on win98)


Mr. Tines

unread,
Jan 19, 1999, 3:00:00 AM1/19/99
to
###

On Tue, 19 Jan 1999 19:27:09 +0100, in <782j4j$ui0$1...@news0.skynet.be>
"cricque" <cr...@dma.be> wrote.....

> Instead of using the coffecup Java icon in the topleft corner i would
like
> to use another icon
>
> is it possible
>
> How od you do this
>
> frame.setIcon(icon); ???????????

Almost. Look for something very like that in the
java.awt.Frame documentation.

-- PGPfingerprint: BC01 5527 B493 7C9B 3C54 D1B7 248C 08BC --
_______ {pegwit v8 public key =581cbf05be9899262ab4bb6a08470}
/_ __(_)__ ___ ___ {69c10bcfbca894a5bf8d208d001b829d4d0}
/ / / / _ \/ -_|_-< www.geocities.com/SiliconValley/1394
/_/ /_/_//_/\__/___/@windsong.demon.co.uk PGP key on page

### end pegwit v8 signed text
119c4bb3572fe4fe6041eb435440aa23ab53e438cd2c70575dd030a7fd21
6713da02dd5d3331da0adeb9b0592daa724747bd46ef888693423c0995f0


Marty Krahe

unread,
Jan 20, 1999, 3:00:00 AM1/20/99
to
Try the following:

import java.awt.MediaTracker; // For setIconImage() and MediaTracker

// Set the icon that gets displayed when window is iconized
// (must be a .gif .jpg or .jpeg file (I believe))
Image image = Toolkit.getDefaultToolkit().getImage ("Jester.gif");
this.setIconImage (image);
MediaTracker tracker = new MediaTracker (this);
tracker.addImage (image, 0); // 2nd parm is an ID and must be unique
for each image added
try {tracker.waitForAll();}
catch (InterruptedException e) {}

--
Marty Krahe -- Raleigh, NC
(My opinions are not necessarily the same as my employer's)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cricque wrote in message <782j4j$ui0$1...@news0.skynet.be>...


>Instead of using the coffecup Java icon in the topleft corner i would like
>to use another icon
>
>is it possible
>
>How od you do this
>
>frame.setIcon(icon); ???????????
>
>

Chris Wolf

unread,
Feb 2, 1999, 3:00:00 AM2/2/99
to Marty Krahe

I have a similar scenario, except in my situation, I need to change
the icon for an applet. Since and applet is derived from Panel,
I first search for the underlying Frame and call it's setIconImage()
method. I tried Marty's idea of using a MediaTracker,
But it STILL doesn't work. Anyone have some ideas??

I already verified that the image is in the right place and is readable
by loading and displaying it with another test applet.

public void init()
{
setLayout(new BorderLayout());

Object obj = getParent();

while (! (obj instanceof Frame))
obj = ((Component) obj).getParent();
baseFrame = (Frame)obj;

try{
emisIcon = Toolkit.getDefaultToolkit().getImage( new
URL(getDocumentBase(), "images/snapi.gif"));
}catch(Exception e){ e.printStackTrace(); }
//emisIcon = getImage(getDocumentBase(), "images/snapi.gif");
// This didn't work either...
EmisGbl.emisIcon = emisIcon;

baseFrame.setIconImage(emisIcon);
mt = new MediaTracker(baseFrame);
mt.addImage(emisIcon, 100);
try{ mt.waitForAll();}catch(InterruptedException e){}


--

Chris Wolf, Consultant VIADOR Inc. http://www.viador.com/
+========================================================================+


0 new messages