⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog2.txt

📁 可以修改指定的域名信息 .单空间多域名绑定管理程序
💻 TXT
字号:
import java.awt.*;
import java.awt.event.*;

public class Dialog2 extends WindowAdapter implements ActionListener  {
    Frame f;         
    Button b1;      
    Button b2;      
    // Button db1;     
    Dialog d;
    TextField txt1,txt2;
    Label l3,l4,l5,l6;
    Font f1,f2;
public static void main(String args[]) {
        Dialog2 di = new Dialog2();
		di.go();
     }
        
public void go()
  { 
	   f=new Frame("dialog");
	   f.setLayout(new FlowLayout());
	   f.setBackground(Color.yellow );
	   //f.addWindowListener(this);
	   b1 =new Button("登录");
       b2=new Button("重置");
	   l3=new Label();
	   l4=new Label();
	   l5=new Label();
	   l6=new Label();
	   f1=new Font("TimesRoman",Font.PLAIN,20);
	   f2=new Font("TimesRoman",Font.BOLD,18);
       //db1=new Button("确定");
       
	   d = new Dialog(f,"登录结果",false);
	   d.setLayout(new FlowLayout());
       
	   d.add(l6);
	   d.add(l4);
	   d.add(l3);
	   //d.add(db1);
	   /*db1.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
               d.dispose();}
                  }  );*/
	   d.setSize(300,130);
	   d.setBackground(Color.pink);
	   d.addWindowListener(this);
	
	  Label l5=new Label("                                 ");
	  f.add(l5);
	  Label l1=new Label("用户名:"); 
	  l1.setFont(f2);
	  f.add(l1);

	  txt1=new TextField(5);
	  f.add(txt1);

	  Label l2=new Label("密码:");
	  l2.setFont(f2);
	  f.add(l2);

	  txt2=new TextField(6);
	  txt2.setEchoChar('*');
	  f.add(txt2);
	
  	  f.add(b1);
	  f.add(b2);
	  b1.addActionListener(this);
	  b2.addActionListener(this);
   
      f.setSize(180,190);
      f.show();

}
public void windowClosing(WindowEvent e){
      System.exit(0);
         }
public void actionPerformed(ActionEvent e)
     {  
	   if (e.getActionCommand()=="重置")
	     { txt1.setText("");
		   txt2.setText(""); } 
	  else
	    {  String s1=txt1.getText();
	       String s2=txt2.getText();
		 if (e.getActionCommand()=="登录"&&s1.equals("admin") && s2.equals("123456"))
	        { l4.setText("                         ");
			  l3.setText("Welcome!  Log in success!");
			  l3.setFont(f1);
	          d.show();}
	     else
	        { l6.setText("                         ");
			  l3.setText("Wrong !  Please log in again!");
			  l3.setFont(f1);
		      d.show();}
	    }
	  
     }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -