Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting the background

 
Osama Hasan
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,
I wanted to ask if it is possible to set an image as a background.
Tell me if there is.
Thanks in advance.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Osama,
this is not the right forum for that kind of question. I'm moving this thread to Java in General (Beginner), please continue that discussion there.
Regarding your question, where do you want to put an image, I mean on the background of what component? A Frame, a Panel, ...?
 
Greg Brouelette
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go do www.codeexamples.org and click on the "code examples" link. Then click on the "Java" link. Then look at the list of code examples and you'll see a listing called "Tiles an image across the background of a panel". That will give you a code example (with lots of comments) showing how to do what you need to do.
Hope it helps.
 
Namnai Kidorkar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Digging up the thread because I've the same question. How to add an image as a back ground of a JPanel and a JFrame?

the www.codeexamples.org is not working, so i'd to ask the question again. the site probably need registration to see the codes but new registration is not working. please help.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use this inside JPanel:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic