File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Newbie just trying to change icon image in a Jframe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Newbie just trying to change icon image in a Jframe" Watch "Newbie just trying to change icon image in a Jframe" New topic
Author

Newbie just trying to change icon image in a Jframe

Dick Hammer
Greenhorn

Joined: Jan 28, 2012
Posts: 18
I used Netbeans drag and drop design interface and it spit out this code: (I know some basic Java, but hardly any Swing or Jframe stuff, although I did read a few chapters from Dietel & Deitel book (actually, many chapters). Seems it should be pretty easy but I am not sure exactly how to go about it. The code it generated has setIcon() as part of a private function...I've looked up repaint? and others but the example they gave were not clear to me.



I figure I can make a function that does setIcon()? Not exactly sure to do it though. How do I add programming to change the image Viper-Green.jpg (to another image in same directory called Viper-Orange.jpg)?

****
I solved my own "problem". Ha, spent a few hours googling changing an image on Jframe, all I had to do was fiddle with the code.



seems to work. hmm it seemed it had not worked earlier.

***Now my question is though: I figure this is not buffered? So every time I load a new image is the old image being discarded or staying in memory?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4530
    
    5

Please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/54696-newbie-just-trying-change-icon-image-jframe.html


luck, db
There are no new questions, but there may be new answers.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Newbie just trying to change icon image in a Jframe