Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

images with swing

 
Tim Collins
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to insert an image into a very basic swing application. I did some research and attempted to create an ImageIcon object, using the constructor that implements a filename, then tried to add it to a JPanel. The ImageIcon is created without issue, but when I try to add it to the JPanel, I get an "unresolved symbol" error. My theory is that ImageIcon is not the right object to try to insert into the panel. Any ideas?
Thanks
Tim
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can put ImageIcons directly onto JLabels and JButtons, but not JPanels... if you wanted to do this you would have to implement this behavior yourself...

-Nate
 
Tim Collins
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, that worked. I just initialized a JLabel with an imageicon and it worked like a charm....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic