import java.applet.Applet; //导入需要的类
import java.awt.Panel;
import java.awt.Label;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.Checkbox;
import java.awt.Button;
import java.awt.Choice;
import java.awt.Frame;
import java.awt.List;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;
import java.awt.event.WindowListener;
import java.awt.event.WindowEvent;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.CardLayout;
import java.awt.CheckboxGroup;
import java.awt.Color;
import java.awt.Font;
import java.net.InetAddress;
import java.net.Socket;
import java.io.DataOutputStream;
import java.io.DataInputStream;
import java.util.ArrayList;
import javax.swing.JPanel;
import javax.swing.JOptionPane;
import javax.swing.BorderFactory;
public class Jisuan extends Applet implements ActionListener //applet类
{
private Zhengzhisixiangsuzhi zhengzhisixiangsuzhi=new Zhengzhisixiangsuzhi();
private Yewuxueximokuai yewuxuexi=null;
private Zhinengsuzhi zhinengsuzhi=new Zhinengsuzhi();
private Tiyusuzhi tiyusuzhi=new Tiyusuzhi();
private Defenqingkuang defenqingkuang=new Defenqingkuang();
private Panel butp=new Panel();
private Panel neirongp=new Panel();
private Button butzhengzhi =new Button("政治思想素质");
private Button butyewu=new Button("业务学习得分");
private Button butzhineng=new Button("智能素质得分");
private Button buttiyu=new Button("体育素质得分");
private Button butscore=new Button("综合测评得分");
private Chengjishangchuan chengjishangchuanchuangkou=null;
private Mimaxiugai mimaxiugai=null;
private float zongchengji=0;
private CardLayout cardlayout=new CardLayout(); //采用卡片布局
private InetAddress ip;
public void init()
{
this.setLayout(new BorderLayout());
try
{
ip=InetAddress.getByName(getCodeBase().getHost());
this.yewuxuexi=new Yewuxueximokuai(ip);
}
catch(Exception exception)
{
System.out.println(exception);
}
this.butzhengzhi.addActionListener(this);
this.butyewu.addActionListener(this);
this.butzhineng.addActionListener(this);
this.buttiyu.addActionListener(this);
this.butscore.addActionListener(this);
this.defenqingkuang.butshangchuan.addActionListener(this);
this.defenqingkuang.butmimaxiugai.addActionListener(this);
butp.setLayout(new GridLayout(3,5,10,1));
butp.add(new Label("------------------------------------------------"));
butp.add(new Label("------------------------------------------------"));
butp.add(new Label("------------------------------------------------"));
butp.add(new Label("------------------------------------------------"));
butp.add(new Label("------------------------------------------------"));
butp.add(this.butzhengzhi);
butp.add(this.butyewu);
butp.add(this.butzhineng);
butp.add(this.buttiyu);
butp.add(this.butscore);
butp.add(new Label("------------------------------------------------"));
butp.add(new Label("------------------------------------------------"));
butp.add(new Label("------------------------------------------------"));
butp.add(new Label("------------------------------------------------"));
butp.add(new Label("------------------------------------------------"));
this.add(butp,"North");
neirongp.setLayout(this.cardlayout);
neirongp.add("zhengzhisixiang",this.zhengzhisixiangsuzhi);
neirongp.add("yewuxuexi",this.yewuxuexi);
neirongp.add("zhinengsuzhi",this.zhinengsuzhi);
neirongp.add("tiyusuzhi",this.tiyusuzhi);
neirongp.add("defenqingkuang",this.defenqingkuang);
this.add(this.neirongp);
this.showStatus("你当前所在的页面是政治思想素质的计算!");
}
public void actionPerformed(ActionEvent e) //实现ActionListener接口
{
if(((Button)e.getSource()).equals(this.butzhengzhi))//点击政治思想素质按钮
{
cardlayout.show(this.neirongp,"zhengzhisixiang");
this.showStatus("你当前所在的页面是政治思想素质的计算!");
}
if(((Button)e.getSource()).equals(this.butyewu)) //点击业务学习得分按钮
{
cardlayout.show(this.neirongp,"yewuxuexi");
this.showStatus("你当前所在的页面是业务学习成绩的计算!");
}
if(((Button)e.getSource()).equals(this.butzhineng)) //点击智能素质按钮
{
cardlayout.show(this.neirongp,"zhinengsuzhi");
this.showStatus("你当前所在页面是智能素质得分的计算!");
}
if(((Button)e.getSource()).equals(this.buttiyu)) //点击体育素质得分按钮
{
cardlayout.show(this.neirongp,"tiyusuzhi");
this.showStatus("你当前所在的页面是体育素质得分的计算!");
}
if(((Button)e.getSource()).equals(this.butscore)) //点击综合测评得分按钮
{
cardlayout.show(this.neirongp,"defenqingkuang");
//将综合测评得分情况在文本框中显示出来
this.defenqingkuang.xianshi.setText("");
this.defenqingkuang.xianshi.append("\n" + "政治思想素质实际得分:" + this.zhengzhisixiangsuzhi.getshijidefen()+ "\n");
this.defenqingkuang.xianshi.append("\n" + "政治思想素质总分:" + this.zhengzhisixiangsuzhi.getzongdefen()+"\n");
this.defenqingkuang.xianshi.append("\n" + "业务学习实际得分:" + this.yewuxuexi.getshijidefen()+"\n");
this.defenqingkuang.xianshi.append("\n" + "业务学习总得分:" + this.yewuxuexi.getzongdefen()+"\n");
this.defenqingkuang.xianshi.append("\n" + "智能素质实际得分:" + this.zhinengsuzhi.getshijidefen()+"\n");
this.defenqingkuang.xianshi.append("\n" + "智能素质总得分:" + this.zhinengsuzhi.getzongdefen()+"\n");
this.defenqingkuang.xianshi.append("\n" + "体育素质实际得分:" + this.tiyusuzhi.getshijidefen()+"\n");
this.defenqingkuang.xianshi.append("\n" + "体育素质总得分:" + this.tiyusuzhi.getzongdefen()+"\n");
this.zongchengji=this.zhengzhisixiangsuzhi.getzongdefen()+this.yewuxuexi.getzongdefen()+this.zhinengsuzhi.getzongdefen()+this.tiyusuzhi.getzongdefen();
this.zongchengji=this.zongchengji+(float)0.005;
this.zongchengji=(float)(int)(this.zongchengji*100);
this.zongchengji=this.zongchengji/100;
this.defenqingkuang.xianshi.append("\n"+"你的综合测评总得分为:"+ this.zongchengji);
this.defenqingkuang.xianshi.append("\n\n你的得分情况说明如下:\n\n" );
this.defenqingkuang.xianshi.append(this.zhengzhisixiangsuzhi.getbeizhu()+this.zhinengsuzhi.getbeizhu()+this.tiyusuzhi.getbeizhu());
}
if(((Button)e.getSource()).equals(this.defenqingkuang.butshangchuan)) //点击成绩上传按钮
{
String sqlinsert=this.zhengzhisixiangsuzhi.getzongdefen()+","+this.yewuxuexi.getzongdefen()+","
+this.zhinengsuzhi.getzongdefen()+","+this.tiyusuzhi.getzongdefen()+ "," +this.zongchengji+ ",'"
+this.zhengzhisixiangsuzhi.getbeizhu()+
this.zhinengsuzhi.getbeizhu()+this.tiyusuzhi.getbeizhu()+ "'";
if(this.chengjishangchuanchuangkou==null)
{
this.chengjishangchuanchuangkou=new Chengjishangchuan(this.ip);
this.chengjishangchuanchuangkou.setLocation(this.getWidth()/2,this.getHeight()/2);
this.chengjishangchuanchuangkou.setVisible(true);
}
else
{
this.chengjishangchuanchuangkou.setVisible(true);
}
this.chengjishangchuanchuangkou.setzongheceping(sqlinsert);
this.chengjishangchuanchuangkou.setyewuxuexi(this.yewuxuexi.getbeizhu());
}
if(((Button)e.getSource()).equals(this.defenqingkuang.butmimaxiugai)) //点击密码修改按钮
{
if(this.mimaxiugai==null)
{
this.mimaxiugai=new Mimaxiugai(this.ip);
this.mimaxiugai.setLocation(this.getWidth()/2,this.getHeight()/2);
this.mimaxiugai.setVisi
- 1
- 2
前往页