怎么把按钮,标签之类放在图片背景上面?
我这样写,标签被挡住了,按钮要点几下才看的见,怎么做才能一运行就看见标签和按钮在图片背景上面?
////<applet code=app.class width=800 height=600></applet>
import java.awt.*;
//import java.applet.*;
import javax.swing.*;
/*
* Created on 2003-1-5
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
/**
* @author Anbol
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class app extends JApplet {
private javax.swing.JPanel jContentPane = null; // @jve:visual-info decl-index=0 visual-constraint="24,22"
private javax.swing.JLabel jLabel = null;
private javax.swing.JButton jButton = null;
private javax.swing.JButton jButton1 = null;
private javax.swing.JButton jButton2 = null;
private javax.swing.JLabel jLabel1 = null;
private Image image = null;
/**
* This is the default constructor
*/
public app() {
super();
//init();
}
/**
* This method initializes this
*
* @return void
*/
public void init() {
image=getImage(getCodeBase(),"3.jpg");
this.setContentPane(getJContentPane());
this.setSize(366, 270);
}
public void paint(Graphics g)
{
g.drawImage(image,0,0,this);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/下面初始化控件,试过没错,不贴了