日期:2014-05-20  浏览次数:20716 次

可以在JFrame框架或着容器里添加图片好?告之下方法谢谢
import   java.awt.*;
import   javax.swing.*;
public   class   ZDsoft   extends   JFrame   {
        JTextField   textName;
        JPasswordField   textPassword;
        JButton   QueDing,QuXiao;

      public   ZDsoft(){
                      super( "用户登陆界面 ");

                      JLabel   labelName2=new   JLabel( "--------------用户登陆中------------------   ");
                      labelName2.setForeground(Color.BLUE);
                      Container   c=getContentPane();
                      JPanel   panel=new   JPanel();
                      panel.setBackground(Color.green);
                        panel.add(labelName2);

                      JLabel   labelName=new   JLabel( "用户名: ");
                      textName=new   JTextField(15);
                      panel.add(labelName);
                      panel.add(textName);
                      JLabel   labelPassword=new   JLabel( "         密码: ");
                      textPassword=new   JPasswordField(15);
                      panel.add(labelPassword);
                      panel.add(textPassword);

                    QueDing=new   JButton( "确定 ");
                    QueDing.setBackground(Color.yellow);
                    QuXiao=new   JButton( "取消 ");
                    QuXiao.setBackground(Color.yellow);
                    panel.add(QueDing);
                    panel.add(QuXiao);

                    JLabel   wf=new   JLabel( "版权所有   重庆*******学院 ");
                    wf.setForeground(Color.red);
                      panel.add(wf);
                      c.add(panel);
        }
          public   static   void   main(String[]   args){
                  ZDsoft   jframe=new   ZDsoft();
                  jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);