使用了未经检查或不安全的操作。

吧!!!

class Or1 extends JFrame implements ActionListener
{
 JButton yes;
 JButton no;
 Vector vect;
 Input in=new Input("123");
 JLabel jl=new JLabel("是否真的插入这条记录");
 int tf1i;String tf2s;Date date;String tf4s;String tf5s;int tf6i;
 public Or1(String s)
 {
  super(s);
  this.addWindowListener(new WindowAdapter()
  {
   public void windowClosing(WindowEvent e)
   {
    dispose();System.exit(0);
   }
  });
  setLayout(null);
  yes=new JButton("确定");
  no=new JButton("取消"); 
  jl=new JLabel("是否真的插入这条记录??"); 
  this.add(jl);
  this.add(yes);
  this.add(no);
  yes.addActionListener(this);
  no.addActionListener(this);
  jl.setBounds(10,10,250,30);
  yes.setBounds(30,50,60,25);
  no.setBounds(110,50,60,25);
  this.setSize(250,130);
  this.setVisible(false);
  
 }
 public void actionPerformed(ActionEvent e)
 {
  if(e.getSource()==yes)
  {
   try
   {
    
    vect=new Vector(10);
   date=new Date(Integer.parseInt(in.tf3.getText().substring(0,3)),
   Integer.parseInt(in.tf3.getText().substring(4,5)),Integer.parseInt(in.tf3.getText().substring(6,7)));
   tf1i=new Integer(in.tf1.getText());
   tf1i=new Integer(Integer.parseInt(in.tf1.getText()));
   tf2s=new String(in.tf2.getText());
   tf4s=new String(in.tf4.getText());
   tf5s=new String(in.tf5.getText());
   tf6i=new Integer(in.tf6.getText());
   tf6i=new Integer(Integer.parseInt(in.tf6.getText()));
   vect.addElement(tf1i);
   vect.addElement(tf2s);
   vect.addElement(date);
   vect.addElement(tf4s);
   vect.addElement(tf5s);
   vect.addElement(tf6i);
   FileOutputStream fos=new FileOutputStream("data.txt");
   ObjectOutputStream oos=new ObjectOutputStream(fos);
   oos.writeObject(vect);
   oos.flush();
   oos.close();
   
   
   }
   catch(IOException p)
   {
    System.out.println(p);
   }
   catch(NumberFormatException o)
   {
    System.out.println(o);
   }
   catch(StringIndexOutOfBoundsException m)
   {
    System.out.println(m);
   }
   
  }
  if(e.getSource()==no)
  {
   this.setVisible(false);
   
  }
 }
 
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值