• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Java coffee cup in GUI

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm interested in two things

1)What code do I use to change the Java coffe cup icon in the title bar of a JFrame.

2) I have a gif which is 42x20 in size and 256 colors. What tool can I use to create an image to use in the title bar. And does the tool make it into a gif, jpeg, ico that will be easy to make out in the small space its given...Also what the code to add this.
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi var,

To set frame icon use "setIconImage(Image img)" method. Image class is from java.awt and ImageIcon is from javax.swing package.

eg.,
setIconImage(new ImageIcon("c:/images/img5.png").getImage());

comming to the type and size of image. as far as i tried except bitmap file (.bmp) we can set any type of image and that image will be resized to default height and width of frame titlebar icon.

Hope This Helps

All The Best
[ March 24, 2005: Message edited by: sasi kala ]
 
Dar Var
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya the code works okay but the image looks really bad in the title bar. Is there a way of creating an image so it looks as goog as the Java coffe cup
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make the icon square. If you don't like the way Java will shrink it to the size of the icon (might blur unusually), use an editor and shrink it yourself to fit.
 
Dar Var
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What size is the icon in the GUI
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Common size on a windows system is 16x16. However, I'd suggest a 32x32 in case it's slightly larger.. I'd rather have it shrink automatically rather than expand.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
setIconImage() is working only for GUI otherthen frame.Can anyone give me the solution?

Anwar
SCJP2,MCP
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic