This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Smiley Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Smiley" Watch "Smiley" New topic
Author

Smiley

sparsh khandelwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 70
Hiii Everybody....
How can i add smiley in my frame?
thanks in advance!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Smileys like that are just pictures. So you'd have to have it stored somewhere as for example a GIF image, then load it and display it like you would display any other picture. Probably using a javax.swing.ImageIcon would be the easiest way to do this.

For details and examples on how to use ImageIcon, see How to Use Icons.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
sparsh khandelwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 70
Jesper de Jong wrote: using a javax.swing.ImageIcon would be the easiest way to do this.

Any other way to do the same?
and are smiley not available in java??
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

No, smileys are not available as a standard thing in Java. Did you expect that they would be?

Why do you want another method? It's really easy with an ImageIcon.
sparsh khandelwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 70
Jesper de Jong wrote:No, smileys are not available as a standard thing in Java. Did you expect that they would be?

Why do you want another method? It's really easy with an ImageIcon.

thanks i will do that with image icon.
is it possible to add image in box created by showinputdialog???
if yes then how??
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Yes there is. Here is an explanation how.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Smiley
 
Similar Threads
only for moderators and sherifs !!!
hi all - cleared SJCP with 86 %
Object reference graphs containing cycles can be serialized??
[political] Clear me on WMD arithmetics
Problem using html frames with struts and tiles