package testbank.com.exam.ui;
import java.awt.Color;
import java.awt.Toolkit;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JToolBar;
import javax.swing.JButton;
import javax.swing.JRadioButton;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.TitledBorder;
import javax.swing.JTree;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JCheckBox;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JTextField;
import testbank.com.exam.dao.TestTopicDao;
import testbank.com.exam.entity.TestTopic;
import user.com.exam.ui.LodingWindowJFrame;
import java.awt.Font;
/**
*
* 试题库管理界面,实现增删改查的功能,对试卷的管理
*
* @author 周正
*
*/
public class ExamSystem extends JFrame {
static ArrayList<TestTopic> al = new ArrayList<TestTopic>();
TestTopicDao ttpall = new TestTopicDao();
JTabbedPane tabbedPane;
ButtonGroup bg;
// 新增中的变量
int increasetype = 0, increasediffculity = 0;
String rightanswer = null;
private JTable table;
private JTextField textField_right;
private JTextField textField_like;
JScrollPane scrollPane_all;
private JTextField textField_style;
private JTextField textField_diffculity;
private JTextField textField_suject;
private JTextField textField_type;
private JTextField textField_uhard;
private JTextField textField;
private JTextField textField_increase;
private JTextField textField_increaseh;
private JTextField textField_increasesu;
private JTextField textField_subject;
public ExamSystem() {
setResizable(false);
this.setBounds(200, 50, 800, 700);
this.setIconImage(Toolkit.getDefaultToolkit().createImage("./src/image/yidulog.png"));
setTitle("试题库管理");
getContentPane().setLayout(null);
JPanel panel_left = new JPanel();
panel_left.setBounds(0, 29, 162, 623);
getContentPane().add(panel_left);
panel_left.setLayout(null);
JLabel label_topic = new JLabel("类型:");
label_topic.setBounds(10, 10, 46, 15);
panel_left.add(label_topic);
JLabel label_hard = new JLabel("难度:");
label_hard.setBounds(10, 41, 46, 15);
panel_left.add(label_hard);
final JComboBox comboBox_topic = new JComboBox(new String[] { "单选",
"多选" });
// comboBox_topic.setToolTipText("哈哈");
comboBox_topic.setBounds(54, 7, 98, 21);
panel_left.add(comboBox_topic);
final JComboBox comboBox_hard = new JComboBox(new String[] { "容易",
"一般", "困难" });
comboBox_hard.setBounds(56, 38, 55, 21);
panel_left.add(comboBox_hard);
JPanel panel_tree = new JPanel();
panel_tree.setBounds(10, 66, 152, 551);
panel_tree.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(
Color.black, new Color(100, 1, 1)), "科目:"));
panel_left.add(panel_tree);
panel_tree.setLayout(null);
// 创建树,并将科目值放入树中
TestTopicDao ttp = new TestTopicDao();
List<TestTopic> lt = ttp.subjectall();
Vector ve = new Vector();
for (int i = 0; i < lt.size(); i++) {
ve.add(lt.get(i).getSubject_name());
}
final JTree tree = new JTree(ve);
tree.setBounds(10, 24, 132, 505);
panel_tree.add(tree);
// TreePath tpadd=tree.getSelectionPath();
// DefaultMutableTreeNode
// dmtn=(DefaultMutableTreeNode)tpadd.getLastPathComponent();
// List list=new ArrayList();
//
// //通地节点的方法创建子节点对象
// DefaultMutableTreeNode dm=new DefaultMutableTreeNode();
// dmtn.add(dm);
JPanel panel_tool = new JPanel();
panel_tool.setBounds(0, 0, 784, 19);
getContentPane().add(panel_tool);
panel_tool.setLayout(null);
JMenuBar menuBar = new JMenuBar();
menuBar.setBounds(0, 0, 883, 21);
panel_tool.add(menuBar);
JMenu mnFile = new JMenu("File");
menuBar.add(mnFile);
JMenu mnEdit = new JMenu("Edit");
menuBar.add(mnEdit);
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setToolTipText("题目");
tabbedPane.setBounds(167, 29, 617, 490);
getContentPane().add(tabbedPane);
// 全部试题选项卡
scrollPane_all = new JScrollPane();
tabbedPane.addTab("全部试题", null, scrollPane_all, null);
final JPanel panel_alter = new JPanel();
panel_alter.setLayout(null);
panel_alter.setForeground(Color.BLUE);
tabbedPane.addTab("修改试题", null, panel_alter, null);
JLabel label_1 = new JLabel("A\uFF1A");
label_1.setBounds(10, 176, 29, 15);
panel_alter.add(label_1);
JLabel label_2 = new JLabel("B\uFF1A");
label_2.setBounds(301, 176, 29, 15);
panel_alter.add(label_2);
JLabel label_3 = new JLabel("C\uFF1A");
label_3.setBounds(10, 227, 29, 15);
panel_alter.add(label_3);
JLabel label_4 = new JLabel("D\uFF1A");
label_4.setBounds(301, 237, 29, 15);
panel_alter.add(label_4);
JLabel label_5 = new JLabel("E\uFF1A");
label_5.setBounds(10, 297, 29, 15);
panel_alter.add(label_5);
JLabel label_6 = new JLabel("F\uFF1A");
label_6.setBounds(301, 297, 29, 15);
panel_alter.add(label_6);
JScrollPane scrollPane_9 = new JScrollPane();
scrollPane_9.setBounds(38, 156, 240, 50);
panel_alter.add(scrollPane_9);
final JTextArea textArea_au = new JTextArea();
scrollPane_9.setViewportView(textArea_au);
textArea_au.setWrapStyleWord(true);
textArea_au.setLineWrap(true);
JScrollPane scrollPane_11 = new JScrollPane();
scrollPane_11.setBounds(38, 217, 240, 50);
panel_alter.add(scrollPane_11);
final JTextArea textArea_cu = new JTextArea();
scrollPane_11.setViewportView(textArea_cu);
textArea_cu.setLineWrap(true);
textArea_cu.setBackground(Color.WHITE);
JScrollPane scrollPane_13 = new JScrollPane();
scrollPane_13.setBounds(38, 275, 240, 50);
panel_alter.add(scrollPane_13);
final JTextArea textArea_eu = new JTextArea();
scrollPane_13.setViewportView(textArea_eu);
JScrollPane scrollPane_10 = new JScrollPane();
scrollPane_10.setBounds(329, 156, 251, 50);
panel_alter.add(scrollPane_10);
final JTextArea textArea_bu = new JTextArea();
scrollPane_10.setViewportView(textArea_bu);
JScrollPane scrollPane_14 = new JScrollPane();
scrollPane_14.setBounds(329, 275, 251, 50);
panel_alter.add(scrollPane_14);
final JTextArea textArea_fu = new JTextArea();
scrollPane_14.setViewportView(textArea_fu);
textArea_fu.setLineWrap(true);
JScrollPane scrollPane_12 = new JScrollPane();
scrollPane_12.setBounds(329, 217, 251, 50);
panel_alter.add(scrollPane_12);
final JTextArea textArea_du = new JTextArea();
scrollPane_12.setViewportView(textArea_du);
JLabel label_rightanswer = new JLabel("设置正确答案为:");
label_rightanswer.setForeground(Color.RED);
label_rightanswer.setBounds(251, 390, 104, 15);
panel_alter.add(label_rightanswer);
final JCheckBox checkBox_A = new JCheckBox("A");
checkBox_A.setBounds(357, 386, 36, 23);
panel_alter.add(checkBox_A);
final JCheckBox checkBox_B = new JCheckBox("B");
checkBox_B.setBounds(395, 386, 36, 23);
panel_alter.add(checkBox_B);
final JCheckBox checkBox_C = new JCheckBox("C");
checkBox_C.setBounds(433, 386, 36, 23);
panel_alter.add(checkB
评论0
最新资源