CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 1999
    Posts
    7

    Changing the Application Icon



    How does one go about changing the Icon that appears in the upper left hand corner of the application once it is running? I feel it must have to do with setting up an image with an "java.awt.Image" class then using Frame.setImage() ,

    but am not sure where one does this and if it will mix with Swing???


    thanks in advance..


    Steve Mcconnell

    (not the one who wrote Code Compelete)

  2. #2
    Join Date
    Feb 1999
    Posts
    5

    Re: Changing the Application Icon



    hai,

    use Frame.setIconImage(Image image) to set the application icon image.this image also appears when the application is iconized.but the iconizing the application is not supported by all platforms

    Bye

    luv,

    R.Karunanithi

  3. #3
    Join Date
    Feb 1999
    Posts
    5

    Re: Changing the Application Icon



    hai,

    use Frame.setIconImage( Image image)to set the application image.

    this image is also displayed in the task bar when the application is iconized.

    but all platforms doesn,t support the concept of iconizing the window

    Bye

    R.karunanithi

  4. #4
    Join Date
    Apr 1999
    Posts
    7

    Re: Changing the Application Icon



    I had stated in the original post that I needed to use the


    Frame.getIconImage(Image image) method.... however this method requires that

    I create the Image.


    In referring to the Image class in the AWT docs, it says that this class cannot be directly instantiated, but must be instantiated through a call to


    Component.createImage(ImageProducer imageProducer) (Component is a subclass of

    Frame)..... Then, I tried to go to the .awt.image package and understand the ImageProducer and then it referred me to the ImageConsumer object.....


    Wait!!!!!


    I want to create an image that I can place in my frame to replace the "Application" Icon (not an applet) in the upper left hand corner..... Why is this so hard?


    Is there something I'm missing?


    Please help....


    Stephen L. Mcconnell

  5. #5
    Join Date
    Apr 1999
    Posts
    7

    Re: Changing the Application Icon



    Ok... I've done some more digging. In the Sun Tutorial Documentation, it explains how to instantiate an Image from within an app.... One uses the

    "Toolkit" class. In the initialization of my Application Frame, I inserted the

    following code. I stepped through in debug mode and it executed both of these commands correctly. (The setIconImage() is a void syncronized Method so I had to place it in a method that throws an exception).


    Image icon = this.getToolkit().getImage("whatever.jpeg");

    this.setIconImage(icon);


    icon was instatiated to a "WImage" (I am guessing the toolkit -- which is supposed to implement a Toolkit for the particular platform I'm working on -- grabbed the Windows platform). So, it does find the image and instantiate it.


    However, when I run this, the little coffee cup brewing in the upper left hand corner of my application does not change.


    This would seem like a simple thing, since so many other apps change this...

    What is going on?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured