This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • 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: 22482
43
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!