java综合项目之医疗信息管理系统


1.主界面部分

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
/**
 * @Author: WenBingnan
 * @Date: 2021/2/13 
 */
public class logintext extends JFrame {
    // 用户名
    private JTextField username;
    // 密码
    private JPasswordField password;
    // 小容器
    private JLabel jl1;
    private JLabel jl2;
    private JLabel jl3;
    private JLabel jl4;
    // 小按钮
    private JButton bu1;
    private JButton bu2;
    private JButton bu3;
    // 列表框
    private JComboBox jcb;

    public logintext() {
        // 设置窗口标题
        this.setTitle("诊所预约就医系统");
        // 窗口组件初始化
        init();
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        // 设置布局方式为绝对定位
        this.setLayout(null);
        this.setBounds(0, 0, 345, 290);
        // 设置窗体的标题图标
        Image image = new ImageIcon("C:\\Users\\Administrator\\Desktop\\课设\\background.jpg").getImage();
        this.setIconImage(image);
        // 窗口大小改变
        this.setResizable(false);
        // 居中显示
        this.setLocationRelativeTo(null);
        // 可见
        this.setVisible(true);
    }

    private void init() {
        // 创建一个容器
        JFrame jf = this;
        Container con = jf.getContentPane();

        jl1 = new JLabel();
        // 设置背景图片
        Image image1 = new ImageIcon("C:\\Users\\Administrator\\Desktop\\课设\\background.jpg").getImage();
        jl1.setIcon(new ImageIcon(image1));
        jl1.setBounds(0, 0, 355, 256);

        // 将 “学生管理系统” 显示在界面上
        jl2 = new JLabel();
        Image image2 = new ImageIcon("C:\\\\Users\\Administrator\\Desktop\\课设\\background.jpg").getImage();
        jl2.setIcon(new ImageIcon(image2));
        jl2.setBounds(35, 40, 55, 40);

        // 用户号码登录输入框
        username = new JTextField();
        username.setBounds(100, 100, 150, 20);
        // 账号输入框旁边的文字
        jl3 = new JLabel("用户名 :");
        jl3.setBounds(55, 100, 70, 20);

        // 密码输入框
        password = new JPasswordField();
        password.setBounds(100, 130, 150, 20);
        // 密码输入框旁边的文字
        jl4 = new JLabel("密 码 :");
        jl4.setBounds(55, 130, 70, 20);

        // 按钮设定
        bu1 = new JButton("医生信息录入界面");
        bu1.setBounds(110, 200, 150, 30);
        // 给按钮添加一个事件
        bu1.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                if (username.getText().equals("") || password.getText().equals("")) {
                    JOptionPane.showConfirmDialog(null, "必填项不许为空!", "警告", JOptionPane.OK_OPTION);
                } else if (username.getText().equals("wen") && password.getText().equals("wen")) {
                    JOptionPane.showConfirmDialog(null, "管理员登录成功", null, JOptionPane.OK_OPTION);
                    jf.dispose();
                    new TestMian().test ();//为跳转的界面
                }
                else {
                    JOptionPane.showConfirmDialog(null, "登录失败", null, JOptionPane.OK_OPTION);
                }

            }
        });

        bu2 = new JButton("找回");
        bu2.setBounds(50, 160, 65, 20);

        bu3 = new JButton("就医信息预约界面");
        bu3.setBounds(120, 160, 180, 20);
        // 给按钮添加一个事件,使用户点按钮后进入相应的界面
        bu3.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                if (username.getText().equals("") || password.getText().equals("")) {
                    JOptionPane.showConfirmDialog(null, "必填项不许为空!", "警告", JOptionPane.OK_OPTION);
                } else if (username.getText().equals("wen") && password.getText().equals("wen")) {
                    JOptionPane.showConfirmDialog(null, "管理员登录成功", null, JOptionPane.OK_OPTION);
                    jf.dispose();
                    new TestMian1().test ();//为跳转的界面
                }
                else {
                    JOptionPane.showConfirmDialog(null, "登录失败", null, JOptionPane.OK_OPTION);
                }

            }
        });
        // 所有组件用容器装载
        jl1.add(jl2);
        jl1.add(jl3);
        jl1.add(jl4);
        jl1.add(bu1);
        jl1.add(bu2);
        jl1.add(bu3);
        jl1.add(jl3);
//		jl1.add(jcb);
        con.add(jl1);
        con.add(username);
        con.add(password);
    }
    public static void main(String[] args) {
        logintext login = new logintext();
    }
}

2.人员信息(1)

import java.io.Serializable;

public class Person implements Serializable {
	private static final long serialVersionUID = 1L;
	private String fid;
	private String fname;
	private String fage;
	public Person(String fid, String fname, String fage) {
		this.fid = fid;
		this.fname = fname;
		this.fage = fage;
	}
	public String getFid() {
		return fid;
	}
	public void setFid(String fid) {
		this.fid = fid;
	}
	public String getFname() {
		return fname;
	}
	public void setFname(String fname) {
		this.fname = fname;
	}
	public String getFage() {
		return fage;
	}
	public void setFage(String fage) {
		this.fage = fage;
	}
}

3.人员信息(2)

import java.io.Serializable;

public class Person1 implements Serializable {
	private static final long serialVersionUID = 1L;
	private String fid;
	private String fname;
	private String fage;
	public Person1(String fid, String fname, String fage) {
		this.fid = fid;
		this.fname = fname;
		this.fage = fage;
	}
	public String getFid() {
		return fid;
	}
	public void setFid(String fid) {
		this.fid = fid;
	}
	public String getFname() {
		return fname;
	}
	public void setFname(String fname) {
		this.fname = fname;
	}
	public String getFage() {
		return fage;
	}
	public void setFage(String fage) {
		this.fage = fage;
	}
}

4.医生界面

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class TestMian extends JFrame {

	private JPanel contentPane;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTable table;
	private List<Person> person =new ArrayList<Person>();
	private List<Person> person1 =new ArrayList<Person>();
	private String[] columnNames = {"姓名","医龄","医科"};
	private Person seletd;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args){
		new TestMian().test ();
	}
	public  void test() {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					TestMian frame = new TestMian();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public TestMian() {
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		setBounds(100, 100, 595, 620);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		JLabel label = new JLabel("姓名");
		label.setBounds(54, 13, 43, 18);
		contentPane.add(label);

		textField = new JTextField();
		textField.setBounds(106, 10, 86, 24);
		contentPane.add(textField);
		textField.setColumns(10);

		JLabel label_1 = new JLabel("医龄");
		label_1.setBounds(221, 13, 35, 18);
		contentPane.add(label_1);

		textField_1 = new JTextField();
		textField_1.setBounds(270, 10, 86, 24);
		contentPane.add(textField_1);
		textField_1.setColumns(10);

		JLabel label_2 = new JLabel("医科");
		label_2.setBounds(385, 9, 86, 27);
		contentPane.add(label_2);

		textField_2 = new JTextField();
		textField_2.setBounds(427, 9, 86, 27);
		contentPane.add(textField_2);
		textField_2.setColumns(10);

		textField_3 = new JTextField();
		textField_3.setBounds(490, 44, 86, 27);
		contentPane.add(textField_3);
		textField_3.setColumns(10);



		JButton button = new JButton("增加");
		button.setBounds(70, 44, 70, 27);
		button.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO 自动生成的方法存根
				add();
			}
		});
		contentPane.add(button);


		JButton button_1 = new JButton("删除");
		button_1.setBounds(320, 44, 70, 27);
		button_1.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				int row = table.getSelectedRow();
				System.out.println(row);
				int a = table.getSelectedRows().length;
				System.out.println(a);
				if(row!=-1){
					for(int i =0;i<a;i++){

						person.remove(row);

					}
				}
				getinfo(person);
			}
		});
		contentPane.add(button_1);

		JButton button_2 = new JButton("修改");
		button_2.setBounds(200, 44, 70, 27);
		button_2.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO 自动生成的方法存根
				modify();
			}
		});
		contentPane.add(button_2);

		JButton button4 = new JButton("查找");
		button4.setBounds(420, 44, 70, 27);
		button4.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				String string = textField_3.getText();
				for(int i=0;i<person.size();i++){
					if(string.equals(person.get(i).getFid())){
						person1.add(person.get(i));
					}
				}
				getinfo(person1);
				textField.setText("");
				textField_1.setText("");
				textField_2.setText("");
			}
		});
		contentPane.add(button4);

		JScrollPane scrollPane_1 = new JScrollPane();
		scrollPane_1.setBounds(14, 78, 549, 468);
		contentPane.add(scrollPane_1);

		JScrollPane scrollPane = new JScrollPane();
		scrollPane_1.setViewportView(scrollPane);

		table = new JTable();
		table.addMouseListener(new MouseListener() {

			@Override
			public void mouseReleased(MouseEvent e) {
				// 鼠标松开
				int row = table.getSelectedRow();
				seletd = person.get(row);
				if(row!=-1){
					textField.setText(seletd.getFid());
					textField_1.setText(seletd.getFname());
					textField_2.setText(seletd.getFage()+"");
					textField.setEnabled(false);
				}

			}

			@Override
			public void mousePressed(MouseEvent e) {
				// 鼠标点下

			}

			@Override
			public void mouseExited(MouseEvent e) {
				// 鼠标移出

			}

			@Override
			public void mouseEntered(MouseEvent e) {
				//鼠标移入

			}

			@Override
			public void mouseClicked(MouseEvent e) {
				// 鼠标点了一下

			}
		});
		scrollPane.setViewportView(table);
		scrollPane.addMouseListener(new MouseListener() {

			@Override
			public void mouseReleased(MouseEvent e) {
				//点击表格空白处,输入框清空,序号无法选择
				// TODO 自动生成的方法存根
				textField.setText("");
				textField_1.setText("");
				textField_2.setText("");
				textField.setEnabled(true);
			}

			@Override
			public void mousePressed(MouseEvent e) {
				// TODO 自动生成的方法存根

			}

			@Override
			public void mouseExited(MouseEvent e) {
				// TODO 自动生成的方法存根

			}

			@Override
			public void mouseEntered(MouseEvent e) {
				// TODO 自动生成的方法存根

			}

			@Override
			public void mouseClicked(MouseEvent e) {
				// TODO 自动生成的方法存根

			}
		});
		addWindowListener(new WindowListener() {

			@Override
			public void windowOpened(WindowEvent e) {
				// TODO 自动生成的方法存根

			}

			@Override
			public void windowIconified(WindowEvent e) {
				// TODO 自动生成的方法存根

			}

			@Override
			public void windowDeiconified(WindowEvent e) {
				// TODO 自动生成的方法存根

			}

			@Override
			public void windowDeactivated(WindowEvent e) {
				// TODO 自动生成的方法存根

			}

			@Override
			public void windowClosing(WindowEvent e) {
				// TODO 自动生成的方法存根
				int i = JOptionPane.showConfirmDialog(null, "是否保存数据");
				switch (i) {
					case 0:
						OutputStream os=null;
						ObjectOutputStream oos=null;
						try {
							os = new FileOutputStream("C:\\Users\\Administrator\\Desktop\\课设\\an.data");
							oos = new ObjectOutputStream(os);
							for(Person pp:person){
								oos.writeObject(pp);
							}
						} catch (Exception e1) {
							// TODO 自动生成的 catch 块
							e1.printStackTrace();
						}finally{
							try {
								oos.close();
							} catch (IOException e1) {
								// TODO 自动生成的 catch 块
								e1.printStackTrace();
							}
							try {
								os.close();
							} catch (IOException e1) {
								// TODO 自动生成的 catch 块
								e1.printStackTrace();
							}
						}
						System.exit(0);
						break;
					case 1:
						System.exit(0);
						break;
					case 2:

						break;

					default:
						break;
				}


			}

			@Override
			public void windowClosed(WindowEvent e) {
				// TODO 自动生成的方法存根

			}

			@Override
			public void windowActivated(WindowEvent e) {
				// TODO 自动生成的方法存根

			}
		});
		InputStream is=null;
		ObjectInputStream ois=null;

		try {
			is = new FileInputStream("C:\\Users\\Administrator\\Desktop\\课设\\an.data");
			ois = new ObjectInputStream(is);
			while (true) {
				Person p = (Person)ois.readObject();
				person.add(p);
			}
		} catch(EOFException e1){

		}catch (Exception e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}finally{
			try {
				if(ois!=null){
					ois.close();
				}

			} catch (IOException e1) {
				// TODO 自动生成的 catch 块
				e1.printStackTrace();
			}
			try {
				if(is!=null){
					is.close();
				}

			} catch (IOException e1) {
				// TODO 自动生成的 catch 块
				e1.printStackTrace();
			}
		}
		getinfo(person);

	}


	//修改
	public void modify(){
		String aid = textField.getText();
		String naem = textField_1.getText();
		String age = textField_2.getText();
		seletd.setFid(aid);
		seletd.setFname(naem);
		seletd.setFage(age);
		getinfo(person);



	}
	//增加
	public void add(){
		String aid = textField.getText();
		String naem = textField_1.getText();
		String age = textField_2.getText();
		Person p = new Person(aid, naem, age);
		person.add(p);
		getinfo(person);
		textField.setText("");
		textField_1.setText("");
		textField_2.setText("");
	}
	//刷新
	public void getinfo(List<Person>person){
		System.out.println(person);
		Object[][] tableValues = new Object[person.size()][];
		for(int i =0;i<person.size();i++){
			Person p1 = person.get(i);
			System.out.println(p1);
			Object[] ff = {p1.getFid(),p1.getFname(),p1.getFage()};
			System.out.println(Arrays.toString(ff));
			tableValues[i] = ff;
		}
		table.setModel(new DefaultTableModel(tableValues, columnNames));

	}
}

5.病人界面

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @Author: WenBingnan
 * @Date: 2020/6/23 
 */
public class TestMian1 extends JFrame {

    private JPanel contentPane;
    private JTextField textField;
    private JTextField textField_1;
    private JTextField textField_2;
    private JTextField textField_3;
    private JTable table;
    private List<Person1> person =new ArrayList<Person1>();
    private List<Person1> person1 =new ArrayList<Person1>();
    private String[] columnNames = {"姓名","年龄","症状"};
    private Person1 seletd;

    /**
     * Launch the application.
     */
    public static void main(String[] args){
        new TestMian1().test ();
    }
    public  void test() {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    TestMian1 frame = new TestMian1();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the frame.
     */
    public TestMian1() {
        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        setBounds(100, 100, 595, 620);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(null);

        JLabel label = new JLabel("姓名");
        label.setBounds(54, 13, 43, 18);
        contentPane.add(label);

        textField = new JTextField();
        textField.setBounds(106, 10, 86, 24);
        contentPane.add(textField);
        textField.setColumns(10);

        JLabel label_1 = new JLabel("年龄");
        label_1.setBounds(221, 13, 35, 18);
        contentPane.add(label_1);

        textField_1 = new JTextField();
        textField_1.setBounds(270, 10, 86, 24);
        contentPane.add(textField_1);
        textField_1.setColumns(10);

        JLabel label_2 = new JLabel("症状");
        label_2.setBounds(385, 9, 86, 27);
        contentPane.add(label_2);

        textField_2 = new JTextField();
        textField_2.setBounds(427, 9, 86, 27);
        contentPane.add(textField_2);
        textField_2.setColumns(10);

        textField_3 = new JTextField();
        textField_3.setBounds(490, 44, 86, 27);
        contentPane.add(textField_3);
        textField_3.setColumns(10);



        JButton button = new JButton("增加");
        button.setBounds(70, 44, 70, 27);
        button.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO 自动生成的方法存根
                add();
            }
        });
        contentPane.add(button);

        JButton button_1 = new JButton("删除");
        button_1.setBounds(320, 44, 70, 27);
        button_1.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                int row = table.getSelectedRow();
                System.out.println(row);
                int a = table.getSelectedRows().length;
                System.out.println(a);
                if(row!=-1){
                    for(int i =0;i<a;i++){

                        person.remove(row);

                    }
                }
                getinfo(person);
            }
        });
        contentPane.add(button_1);

        JButton button_2 = new JButton("修改");
        button_2.setBounds(200, 44, 70, 27);
        button_2.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO 自动生成的方法存根
                modify();
            }
        });
        contentPane.add(button_2);

        JButton button4 = new JButton("查找");
        button4.setBounds(420, 44, 70, 27);
        button4.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                String string = textField_3.getText();
                for(int i=0;i<person.size();i++){
                    if(string.equals(person.get(i).getFid())){
                        person1.add(person.get(i));
                    }
                }
                getinfo(person1);
                textField.setText("");
                textField_1.setText("");
                textField_2.setText("");
            }
        });
        contentPane.add(button4);

        JScrollPane scrollPane_1 = new JScrollPane();
        scrollPane_1.setBounds(14, 78, 549, 468);
        contentPane.add(scrollPane_1);

        JScrollPane scrollPane = new JScrollPane();
        scrollPane_1.setViewportView(scrollPane);

        table = new JTable();
        table.addMouseListener(new MouseListener() {

            @Override
            public void mouseReleased(MouseEvent e) {
                // 鼠标松开
                int row = table.getSelectedRow();
                seletd = person.get(row);
                if(row!=-1){
                    textField.setText(seletd.getFid());
                    textField_1.setText(seletd.getFname());
                    textField_2.setText(seletd.getFage()+"");
                    textField.setEnabled(false);
                }

            }

            @Override
            public void mousePressed(MouseEvent e) {
                // 鼠标点下

            }

            @Override
            public void mouseExited(MouseEvent e) {
                // 鼠标移出

            }

            @Override
            public void mouseEntered(MouseEvent e) {
                //鼠标移入

            }

            @Override
            public void mouseClicked(MouseEvent e) {
                // 鼠标点了一下

            }
        });
        scrollPane.setViewportView(table);
        scrollPane.addMouseListener(new MouseListener() {

            @Override
            public void mouseReleased(MouseEvent e) {
                //点击表格空白处,输入框清空,序号无法选择
                // TODO 自动生成的方法存根
                textField.setText("");
                textField_1.setText("");
                textField_2.setText("");
                textField.setEnabled(true);
            }

            @Override
            public void mousePressed(MouseEvent e) {
                // TODO 自动生成的方法存根

            }

            @Override
            public void mouseExited(MouseEvent e) {
                // TODO 自动生成的方法存根

            }

            @Override
            public void mouseEntered(MouseEvent e) {
                // TODO 自动生成的方法存根

            }

            @Override
            public void mouseClicked(MouseEvent e) {
                // TODO 自动生成的方法存根

            }
        });
        addWindowListener(new WindowListener() {

            @Override
            public void windowOpened(WindowEvent e) {
                // TODO 自动生成的方法存根

            }

            @Override
            public void windowIconified(WindowEvent e) {
                // TODO 自动生成的方法存根

            }

            @Override
            public void windowDeiconified(WindowEvent e) {
                // TODO 自动生成的方法存根

            }

            @Override
            public void windowDeactivated(WindowEvent e) {
                // TODO 自动生成的方法存根

            }

            @Override
            public void windowClosing(WindowEvent e) {
                // TODO 自动生成的方法存根
                int i = JOptionPane.showConfirmDialog(null, "是否保存数据");
                switch (i) {
                    case 0:
                        OutputStream os=null;
                        ObjectOutputStream oos=null;
                        try {
                            os = new FileOutputStream("C:\\Users\\Administrator\\Desktop\\课设\\an.data");
                            oos = new ObjectOutputStream(os);
                            for(Person1 pp:person){
                                oos.writeObject(pp);
                            }
                        } catch (Exception e1) {
                            // TODO 自动生成的 catch 块
                            e1.printStackTrace();
                        }finally{
                            try {
                                oos.close();
                            } catch (IOException e1) {
                                // TODO 自动生成的 catch 块
                                e1.printStackTrace();
                            }
                            try {
                                os.close();
                            } catch (IOException e1) {
                                // TODO 自动生成的 catch 块
                                e1.printStackTrace();
                            }
                        }
                        System.exit(0);
                        break;
                    case 1:
                        System.exit(0);
                        break;
                    case 2:

                        break;

                    default:
                        break;
                }


            }

            @Override
            public void windowClosed(WindowEvent e) {
                // TODO 自动生成的方法存根

            }

            @Override
            public void windowActivated(WindowEvent e) {
                // TODO 自动生成的方法存根

            }
        });
        InputStream is=null;
        ObjectInputStream ois=null;

        try {
            is = new FileInputStream("C:\\Users\\Administrator\\Desktop\\课设\\an.data");
            ois = new ObjectInputStream(is);
            while (true) {
                Person1 p = (Person1)ois.readObject();
                person.add(p);
            }
        } catch(EOFException e1){

        }catch (Exception e) {
            // TODO 自动生成的 catch 块
            e.printStackTrace();
        }finally{
            try {
                if(ois!=null){
                    ois.close();
                }

            } catch (IOException e1) {
                // TODO 自动生成的 catch 块
                e1.printStackTrace();
            }
            try {
                if(is!=null){
                    is.close();
                }

            } catch (IOException e1) {
                // TODO 自动生成的 catch 块
                e1.printStackTrace();
            }
        }
        getinfo(person);

    }


    //修改
    public void modify(){
        String aid = textField.getText();
        String naem = textField_1.getText();
        String age = textField_2.getText();
        seletd.setFid(aid);
        seletd.setFname(naem);
        seletd.setFage(age);
        getinfo(person);



    }
    //增加
    public void add(){
        String aid = textField.getText();
        String naem = textField_1.getText();
        String age = textField_2.getText();
        Person1 p = new Person1(aid, naem, age);
        person.add(p);
        getinfo(person);
        textField.setText("");
        textField_1.setText("");
        textField_2.setText("");
    }
    //刷新
    public void getinfo(List<Person1>person){
        System.out.println(person);
        Object[][] tableValues = new Object[person.size()][];
        for(int i =0;i<person.size();i++){
            Person1 p1 = person.get(i);
            System.out.println(p1);
            Object[] ff = {p1.getFid(),p1.getFname(),p1.getFage()};
            System.out.println(Arrays.toString(ff));
            tableValues[i] = ff;
        }
        table.setModel(new DefaultTableModel(tableValues, columnNames));

    }

}



总结

提供全部代码,仅供参考,希望此文有所帮助,并加以创新! 谢谢支持

  • 7
    点赞
  • 40
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值