This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I know there is a way to get rid of that Java Icon on the upper left hand corner of your apps, but I can't, for the life of me remember how to do it. Can somebody please let me know how to do that if they know. Thanks.
I tried to setIconImage() in the JFrame to null, but nothing happened? I thought maybe when I minimized it on the taskbar, then there would be no java icon as well, but again, there was no affect. Does anybody have any ideas as to how to get rid of that java icon on the upper lefthand corner of your apps, when using the MetalLookAndFeel?
setIconImage(Image image) image parameter should not be null. If it is null, it will take the default image (java symbol). Try to give your own image. ~Viswa
Joined: Apr 09, 2003
Ok, this may sound stupid but how do you create an Image. The Image constructor doesn't seem to have any type of request for an external data input. The only way I've ever used an image was doing this: Image testImage = new IconImage("[file_name]"); but I'm not sure if that is the way you're suppose to do it. I just don't see what Image is good for? And furthermore, I don't even think IconImage extends Image, so how come this works? Can somebody help me out a little? Scratch that I never used Image before, it was always a straight up ImageIcon. So how do you use Image then? [ May 26, 2003: Message edited by: Wilson Mui ]
Joined: Apr 30, 2003
Create a URL object and getResource of a image file. I think this following code snippet will help you.
Here YourClass - Your Current program name. someimage - file path of some image. e.g "images/smile.jpg"
Joined: Apr 09, 2003
hmm, interesting, so it looks like the only way to get a handle to an Image, is through an ImageIcon. I didn't know that. But is there a way then to create an Image from "scratch" sort of speak. I mean to acutally use a constructor to create an Image object?
Nope... Image doesn't have a (public) constructor. In addition to creating an Image using ImageIcon, there are also several createImage() methods in java.awt.Toolkit and getImage() methods in java.applet.Applet. If you are using JDK 1.4 there is also the new ImageIO API. And if you want to create an Image and not just load one from a file, you can use the BufferedImage class. It comes with a constructor.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.