基础java项目6( notic)

时间:2021-05-14 08:53:51

import java.awt.*;
import java.awt.event.*;
import java.io.*;

import javax.swing.*;

public class notic extends JFrame implements Serializable {

    JFrame frame = new JFrame("提示");
    JLabel jlb;
    JButton jbtOk;
    private String regMessage;
    public notic(String _regMessage) {
        regMessage = _regMessage;
        jbinit();
    }
    public void jbinit()
    {
        jlb = new JLabel(regMessage);
        jbtOk = new JButton("确定");
        jlb.setFont(new Font("宋体",2,20));
        frame.getContentPane().add(jlb,BorderLayout.NORTH);
        frame.getContentPane().add(jbtOk,BorderLayout.SOUTH);
        frame.setResizable(false);
        frame.setSize(200,200);
        frame.setVisible(true);
        jbtOk.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                 closeframea();
                 RegFrame rf= new RegFrame();
                 rf.jbinit();
            }

        });
    }
   private void closeframea()
    {
        frame.setVisible(false);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}