• Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying an JPG on JPanel  RSS feed

 
Peter Sorotokin
Ranch Hand
Posts: 36
1
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
What class and method is used for displaying JPG images on a JPanel ?
Thanks
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JLabel would be the commonest class. You could either use one of its constructors which takes an Icon as a parameter, or call its setIcon(Icon) method.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, if you want to have an image as your panel background check out this wiki https://www.coderanch.com/how-to/java/BackgroundImageOnJPanel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!