• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

how to display an image for window icon in Swings

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to add an image for the Window Icon in Swings. I am trying to use
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image image1 = toolkit.getImage("favicon.ico");
frame.setIconImage(image1);
but this is not working. can anyone help me.? :roll:
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ImageIcon titleBarIcon =
new ImageIcon("myTitleBarImage.jpg");
Image i = titleBarIcon.getImage();
this.setIconImage(i);
 
Hiren Pathak
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanks. Do I must have to use .jpg or can I use .ico files too..? because somehow I tried that code with .ico file and its not working.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The basic JDK can't load .ico files... they are only used on the windows platform. Convert your .ico file to a GIF, JPEG, or PNG...
 
I didn't say it. I'm just telling you what this tiny ad said.
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic