如何将图像添加到JFrame容器?

时间:2013-02-07 12:26:07

标签: java swing

我有这个代码,容器显示特定的背景颜色 而不是显示我想要将图像添加到背景的颜色,我应该怎么做?

public class mark {

public static void main(String[] args) {
    // TODO Auto-generated method stub

    wmmain m=new mark().new wmmain();
    m.setSize(800,500);
    m.setVisible(true); 

}
class wmmain extends JFrame /* MAIN WINDOW */
{
    Container container;

    public wmmain()
    {
        super("Digital Image WaterMarking");

        addWindowListener(new WindowAdapter()
        {
            public void windowClosing(WindowEvent e)
            {
                System.out.print("Exit");
                System.exit(0);
            }
        });



        container=this.getContentPane();
        container.setLayout(new BorderLayout());
        container.setBackground(new Color(72, 118, 255));

    }
    }
}

0 个答案:

没有答案