• Post Reply Bookmark Topic Watch Topic
  • New Topic

showing icon in JDialog and JFrame

 
Ashik Uzzaman
Ranch Hand
Posts: 2373
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Pals,
My current project has been developed using JDK1.3 and I have used icon in JInternalFrame and now in problem to use icon in JDiaolg and JFrame. I found that there is no setIconImage or such method in JDialog and JFrame. There is an abstract Image class (java.awt.Image) but that's not of any use for setting Icons.
How do you people do that without the help of an IDE --- I use Forte For Java, Community Edition?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using a ImageIcon simply call getImage() on it to return it's image reference. If the Icon you are using is generated from some other source than an Image, you'll have to create a BufferedImage, paint the icon to it, and then set the BufferedImage as the image icon on the JFrame or JDialog.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!