class Dialog6 extends Dialog
{ Dialog6(Frame f,String s)
{super(f,s); setBounds(400,300,200,100); setVisible(false); setModal(false);
Label label=new Label("发送失败!!! 重发!",Label.CENTER);
add(label);
}
}
class Dialog7 extends Dialog
{ Dialog7(Frame f,String s)
{super(f,s); setBounds(400,300,200,100); setVisible(false); setModal(false);
Label label=new Label("发送成功!!",Label.CENTER);
add(label);
}
}
class Window4 extends Frame implements ActionListener
{ MenuBar menubar;
Menu menu1,menu2;
MenuItem item1,item2,item3,item4;
TextArea text;
Window5 window5;
Window4()
{ super("邮箱窗口"); setBounds(100,200,300,300); setLayout(new GridLayout(1,1));
setBackground(Color.white); setVisible(false);
menubar=new MenuBar();
menu1=new Menu("文件夹"); menu2=new Menu("退出");
item1=new MenuItem("收件箱"); item2=new MenuItem("发邮件");
item3=new MenuItem("垃圾箱"); item4=new MenuItem("退出邮箱");
text=new TextArea(); window5=new Window5();
menu1.add(item1); menu1.addSeparator(); menu1.add(item2); menu1.addSeparator();
menu1.add(item3); menu2.add(item4); menubar.add(menu1); menubar.add(menu2);
setMenuBar(menubar); add(text);
item1.addActionListener(this); item2.addActionListener(this);
item3.addActionListener(this); item4.addActionListener(this);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){setVisible(false);System.exit(0);}
});
pack();
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==item1){text.setText("没有收到任何邮件!");}
else if(e.getSource()==item2){window5.setVisible(true);}
else if(e.getSource()==item3){text.setText("没有垃圾邮件!");}
else if(e.getSource()==item4){this.setVisible(false);}
}
}
class Window3 extends Frame implements ActionListener
{ Label label1,label2;
Button button1,button2,button3;
Checkbox box;
TextField text1,text2;
Window2 window2; Window1 window1; Window4 window4;
Dialog5 dialog5; Dialog8 dialog8;
Window3()
{ super("免费邮箱"); setBounds(50,100,200,150); setLayout(new GridLayout(2,4));
setVisible(false); setBackground(Color.pink);
window2=new Window2(); window1=new Window1(); window4=new Window4();
label1=new Label("用户名",Label.CENTER); label1.setForeground(Color.blue);
label2=new Label("密码:",Label.CENTER); label2.setForeground(Color.blue);
button1=new Button("登陆"); button2=new Button("申请");
button3=new Button("修改密码"); box=new Checkbox("安全检查");
text1=new TextField(15); text2=new TextField(15); text2.setEchoChar('*');
dialog5=new Dialog5(this,"提示窗口"); dialog8=new Dialog8(this,"提示窗口");
add(label1); add(text1); add(box); add(button1);
add(label2); add(text2); add(button2); add(button3);
button1.addActionListener(this); button2.addActionListener(this);
button3.addActionListener(this);
dialog5.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){dialog5.setVisible(false);}
});
dialog8.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){dialog8.setVisible(false);}
});
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){setVisible(false);System.exit(0);}
});
pack();
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==button1)
{if((text1.getText().equals("xmchensi"))&&(text2.getText().equals("198202")))
{window4.setVisible(true);}
else {dialog8.setVisible(true);}
}
else if(e.getSource()==button2){window2.setVisible(true);}
else if(e.getSource()==button3)
{if((text1.getText().equals("xmchensi"))&&(text2.getText().equals("198202")))
{window1.setVisible(true);}
else {dialog5.setVisible(true);}
}
}
}
class Dialog5 extends Dialog
{ Dialog5(Frame f,String s)
{super(f,s); setBounds(400,300,200,100); setVisible(false); setModal(false);
setLayout(new GridLayout(2,1));
Label label1=new Label("用户名或密码错误",Label.CENTER);
Label label2=new Label("未填用户名或是密码",Label.CENTER);
add(label1); add(label2);
}
}
class Dialog8 extends Dialog
{ Dialog8(Frame f,String s)
{super(f,s); setBounds(400,300,200,100); setVisible(false); setModal(false);
Label label=new Label("登陆失败!!!",Label.CENTER);
add(label);
}
}
public class chensi02 extends Applet implements ActionListener
{ Button button1,button2; Window3 window3;
public void init()
{ window3=new Window3();
button1=new Button("打开窗口"); button2=new Button("关闭窗口");
button1.setBackground(Color.red); button2.setBackground(Color.red);
button1.setForeground(Color.blue); button2.setForeground(Color.blue);
add(button1); add(button2);
button1.addActionListener(this); button2.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{if(e.getSource()==button1){window3.setVisible(true);}
else if(e.getSource()==button2){window3.setVisible(false);}
}
}
{ Dialog6(Frame f,String s)
{super(f,s); setBounds(400,300,200,100); setVisible(false); setModal(false);
Label label=new Label("发送失败!!! 重发!",Label.CENTER);
add(label);
}
}
class Dialog7 extends Dialog
{ Dialog7(Frame f,String s)
{super(f,s); setBounds(400,300,200,100); setVisible(false); setModal(false);
Label label=new Label("发送成功!!",Label.CENTER);
add(label);
}
}
class Window4 extends Frame implements ActionListener
{ MenuBar menubar;
Menu menu1,menu2;
MenuItem item1,item2,item3,item4;
TextArea text;
Window5 window5;
Window4()
{ super("邮箱窗口"); setBounds(100,200,300,300); setLayout(new GridLayout(1,1));
setBackground(Color.white); setVisible(false);
menubar=new MenuBar();
menu1=new Menu("文件夹"); menu2=new Menu("退出");
item1=new MenuItem("收件箱"); item2=new MenuItem("发邮件");
item3=new MenuItem("垃圾箱"); item4=new MenuItem("退出邮箱");
text=new TextArea(); window5=new Window5();
menu1.add(item1); menu1.addSeparator(); menu1.add(item2); menu1.addSeparator();
menu1.add(item3); menu2.add(item4); menubar.add(menu1); menubar.add(menu2);
setMenuBar(menubar); add(text);
item1.addActionListener(this); item2.addActionListener(this);
item3.addActionListener(this); item4.addActionListener(this);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){setVisible(false);System.exit(0);}
});
pack();
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==item1){text.setText("没有收到任何邮件!");}
else if(e.getSource()==item2){window5.setVisible(true);}
else if(e.getSource()==item3){text.setText("没有垃圾邮件!");}
else if(e.getSource()==item4){this.setVisible(false);}
}
}
class Window3 extends Frame implements ActionListener
{ Label label1,label2;
Button button1,button2,button3;
Checkbox box;
TextField text1,text2;
Window2 window2; Window1 window1; Window4 window4;
Dialog5 dialog5; Dialog8 dialog8;
Window3()
{ super("免费邮箱"); setBounds(50,100,200,150); setLayout(new GridLayout(2,4));
setVisible(false); setBackground(Color.pink);
window2=new Window2(); window1=new Window1(); window4=new Window4();
label1=new Label("用户名",Label.CENTER); label1.setForeground(Color.blue);
label2=new Label("密码:",Label.CENTER); label2.setForeground(Color.blue);
button1=new Button("登陆"); button2=new Button("申请");
button3=new Button("修改密码"); box=new Checkbox("安全检查");
text1=new TextField(15); text2=new TextField(15); text2.setEchoChar('*');
dialog5=new Dialog5(this,"提示窗口"); dialog8=new Dialog8(this,"提示窗口");
add(label1); add(text1); add(box); add(button1);
add(label2); add(text2); add(button2); add(button3);
button1.addActionListener(this); button2.addActionListener(this);
button3.addActionListener(this);
dialog5.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){dialog5.setVisible(false);}
});
dialog8.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){dialog8.setVisible(false);}
});
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){setVisible(false);System.exit(0);}
});
pack();
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==button1)
{if((text1.getText().equals("xmchensi"))&&(text2.getText().equals("198202")))
{window4.setVisible(true);}
else {dialog8.setVisible(true);}
}
else if(e.getSource()==button2){window2.setVisible(true);}
else if(e.getSource()==button3)
{if((text1.getText().equals("xmchensi"))&&(text2.getText().equals("198202")))
{window1.setVisible(true);}
else {dialog5.setVisible(true);}
}
}
}
class Dialog5 extends Dialog
{ Dialog5(Frame f,String s)
{super(f,s); setBounds(400,300,200,100); setVisible(false); setModal(false);
setLayout(new GridLayout(2,1));
Label label1=new Label("用户名或密码错误",Label.CENTER);
Label label2=new Label("未填用户名或是密码",Label.CENTER);
add(label1); add(label2);
}
}
class Dialog8 extends Dialog
{ Dialog8(Frame f,String s)
{super(f,s); setBounds(400,300,200,100); setVisible(false); setModal(false);
Label label=new Label("登陆失败!!!",Label.CENTER);
add(label);
}
}
public class chensi02 extends Applet implements ActionListener
{ Button button1,button2; Window3 window3;
public void init()
{ window3=new Window3();
button1=new Button("打开窗口"); button2=new Button("关闭窗口");
button1.setBackground(Color.red); button2.setBackground(Color.red);
button1.setForeground(Color.blue); button2.setForeground(Color.blue);
add(button1); add(button2);
button1.addActionListener(this); button2.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{if(e.getSource()==button1){window3.setVisible(true);}
else if(e.getSource()==button2){window3.setVisible(false);}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货