⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upname.java

📁 这是一个简单的考试系统
💻 JAVA
字号:
package login.UI;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import com.tool.createName;
import com.tool.saveName;

public class upName extends JFrame implements ActionListener {
	private JComboBox jc;
	private JButton jb1,jb2,jb3;
	private JPanel jp,jp1;
	private ArrayList list;
	upName(){
		super();
		this.setDefaultCloseOperation(3);
		this.setResizable(false);
		this.setLocation(300,300);
		this.setSize(300,200);
		jb1=new JButton("添加");
		jb2=new JButton("删除");
		jb3=new JButton("返回");
		jb1.addActionListener(this);
		jb2.addActionListener(this);
		jb3.addActionListener(this);
		jp=new JPanel();
		jp1=new JPanel();
		jc=new JComboBox();
		list=createName.run();
		System.out.println();
		for(int i=0;i<list.size();i++)
			jc.addItem(list.get(i).toString());
		jp.add(jc);
		jp1.add(jb1);
		jp1.add(jb2);
		jp1.add(jb3);
		this.getContentPane().add(jp,"Center");
		this.getContentPane().add(jp1,"South");
		this.setVisible(true);
	}

	public void actionPerformed(ActionEvent e) {
		if(e.getSource()==jb1){
			String str=JOptionPane.showInputDialog("输入姓名");
			if(str!=null){
				jc.addItem(str);
				list.add(str);
				new saveName(list);
			}
		}
		if(e.getSource()==jb2){
			jc.removeItemAt(jc.getSelectedIndex());
			list.remove(jc.getSelectedIndex());
			new saveName(list);
		}
		if(e.getSource()==jb3){
			new teacher();
			this.dispose();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -