• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Newbie just trying to change icon image in a Jframe

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/54696-newbie-just-trying-change-icon-image-jframe.html
 
reply
    Bookmark Topic Watch Topic
  • New Topic