如题。
比方说:我要用一张图片(jLabel)作为软件界面的背景,然后要在上面加上一个 jButton 控件。
最好给个代码额。因为我是个新手。有代码的话,如果看不懂,可以好好研究额。
(网上也有看过 文字描述的。但是 文字是明白了。。就是不懂得实现额。所以 请求 给个代码额。。)

解决方案 »

  1.   

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;public class bb{
    private JFrame frame;
    private JLabel backLabel;
    private JDesktopPane desktopPane;

    public bb(){
    init();
    }
    public static void main(String[] args){
    bb b=new bb();
    }
    private void init(){
    frame=new JFrame("o_o");
    frame.getContentPane().setLayout(new BorderLayout());
    frame.setBounds(100, 100, 800, 600);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    desktopPane = new JDesktopPane();
    frame.getContentPane().add(desktopPane);
    backLabel.setIcon(icon);//加图片
    backLabel=new JLabel();
    desktopPane.add(backLabel, new Integer(Integer.MIN_VALUE));
    desktopPane.add(buttonPanel);
    }
    class buttonPanel extends JInternalFrame{
    private JButton button;
    public buttonPanel() {
    JTabbedPane tabPane = new JTabbedPane();
    button=new JButton("0_0");
    tabPane.add(button);
    }
    }
    }
    JDesktopPane和JInternalFrame是一个组合,把按钮放到JInternalFrame中,再把JInternalFrame放到JDesktopPane中。我知道的就是这种方法!!
      

  2.   

    你自己再查一下api吧,可能时间太短,有点错误
    但这种方法你可以看看啊!!
      

  3.   

    楼上的代码额、、无法解析 buttonPanel 。
    不过 还是很感谢你哦。