Results 1 to 2 of 2
  1. #1
    Ch4os is offline Member
    Join Date
    Nov 2008
    Posts
    7
    Rep Power
    0

    Post [SOLVED] JFrame Image Icon

    Hi I tried to change the icon in the titlebar but I couldn't find that option for a JFrame.

    I also use internal frames and in those frames I can change the image icon.

    I even tried a code in the JFrame but it didn't work
    Java Code:
    ImageIcon ImageIcon = new ImageIcon("../images/grademystudent_16x16.png");
    Image Image = ImageIcon.getImage();
    this.setIconImage(Image);
    Does anybody know how I can change the icon in the JFrame titlebar?

  2. #2
    Ch4os is offline Member
    Join Date
    Nov 2008
    Posts
    7
    Rep Power
    0

    Default

    I finally found my error in this code..
    It should have been

    Java Code:
    // Sets IconImage
        ImageIcon ImageIcon = new ImageIcon(getClass().getResource("/images/grademystudent_16x16.png"));
        Image Image = ImageIcon.getImage();
        this.setIconImage(Image);

Similar Threads

  1. Add an image to JFrame
    By Eranga in forum AWT / Swing
    Replies: 4
    Last Post: 02-01-2010, 03:09 PM
  2. can display image in JFrame?
    By xCLARAx in forum AWT / Swing
    Replies: 14
    Last Post: 04-03-2009, 07:02 PM
  3. Problem in setting icon for JFrame!
    By pranav13 in forum AWT / Swing
    Replies: 8
    Last Post: 11-04-2008, 05:24 AM
  4. Image size in a JFrame
    By nickbeacroft in forum AWT / Swing
    Replies: 2
    Last Post: 06-26-2008, 04:08 PM
  5. how to remove an image icon
    By cecily in forum Advanced Java
    Replies: 1
    Last Post: 08-05-2007, 04:25 AM

Posting Permissions

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