Hi, evry1.. i need yur help.. i want to place an image as my background.. how am i supposed to do it..?? i have tried this setBackground("C:\\image\\background.jpg");
i also tired this Icon m1 = new ImageIcon("C:\\New folder (5)\\background.jpg");lb1.setIcon(m1);
But none of this is working.. what shuld i do???
2384443 0 Newbie Poster
Recommended Answers
Jump to PostYou create a subclass of JPanel and override its paintComponent method to draw your image when the panel is repainted. Then add your components to the panel to display then in front of the image.
Sounds complicated, but the code is quite simple.
Jump to PostJPanel is very standard stuff. Just add all your controls to the JPanel, then add the JPanel to your JFrame. Later on you will discover all kinds of reasons why you want to do it like that.
Jump to PostRaj:
How do you intend to keep the other components in front of the image JLabel?
Which layout manager would you use to place components overlapping the image JLabel?
All 11 Replies
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
2384443 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
2384443 0 Newbie Poster
llaspina 19 Light Poster Team Colleague
jalpesh_007 -3 Newbie Poster
raj.mscking 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
raj.mscking 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
raj.mscking 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.