Win a copy of The Java Performance Companion this week in the Performance forum!
    Bookmark Topic Watch Topic
  • New Topic

background image in JPanel or JFrame

 
Rishabh Rathi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Report post to moderator
I want to insert a background image ( .jpg , .gif , .png ) to my JPanel( or JFrame) form to make it look attractive.
PLease suggest the code for it.
 
Paul Clapham
Sheriff
Posts: 21149
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
Perhaps you might find this surprising, but since Java was invented over a decade ago, you are not the first person to ask this question. In fact you aren't even close to being first. If you use the google keywords "jpanel background image" you will find numerous examples. (Not to mention numerous other posts from people who didn't search before posting!)
 
Rob Spoor
Sheriff
Pie
Posts: 20552
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
We even have an FAQ entry for it.
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Also, you where given the same answer when you posted the same question over an hour ago!

http://www.coderanch.com/t/532226/GUI/java/add-background-image-JPANEL

Ignoring peoples answers and wasting our time is NOT a good way to get help in the future.
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Report post to moderator
Rob Camick wrote:Also, you where given the same answer when you posted the same question over an hour ago!.

Two days and an hour.
 
Rob Spoor
Sheriff
Pie
Posts: 20552
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
But it still wasted my time because the link I posted was already posted. I'm annoyed now so this thread is closed.

(Well, not because I'm annoyed but because one should UseOneThreadPerQuestion )
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic