package shijuansc;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import Db.Sql;
public class zsdxsj extends JFrame {
private JTextField textField_6;
private JTextField textField_5;
private JTextField textField_4;
private JTextField textField_3;
private JTextField textField_2;
private JTextField textField_1;
private JTextField textField;
private Sql dbsql = new Sql();
final JScrollPane scrollPane ;
ResultSet zsdgs = dbsql.select("select * from zsd");
JPanel panel_1;
//int gs=0;
// try {
// while(zsdgs.next()){
// //gs++;
// }
// } catch (SQLException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
public JComboBox[] ComboBox_ = new JComboBox[100];
public JLabel[] label_ = new JLabel[100];
public JTextField[] textField_ = new JTextField[100];
public JLabel[] label2_ = new JLabel[100];
public static void main(String args[]) {
try {
zsdxsj frame = new zsdxsj();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
public zsdxsj() {
super();
setBounds(100, 100, 500, 552);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel panel = new Mypanel();
panel.setLayout(null);
getContentPane().add(panel, BorderLayout.CENTER);
final JLabel label = new JLabel();
label.setForeground(new Color(0, 0, 255));
label.setFont(new Font("", Font.BOLD, 16));
label.setText("知识点型试卷生成界面");
label.setBounds(154, 10, 193, 24);
panel.add(label);
final JLabel label_1 = new JLabel();
label_1.setForeground(new Color(0, 0, 255));
label_1.setText("输入试卷主标题");
label_1.setBounds(19, 55, 104, 18);
panel.add(label_1);
final JLabel label_2 = new JLabel();
label_2.setForeground(new Color(0, 0, 255));
label_2.setText("输入试卷副标题");
label_2.setBounds(19, 90, 104, 18);
panel.add(label_2);
final JLabel label_3 = new JLabel();
label_3.setForeground(new Color(0, 0, 255));
label_3.setText("输入考生信息格式");
label_3.setBounds(19, 128, 104, 18);
panel.add(label_3);
final JLabel label_4 = new JLabel();
label_4.setForeground(new Color(0, 0, 255));
label_4.setText("输入试卷总题数");
label_4.setBounds(19, 169, 104, 18);
panel.add(label_4);
final JLabel label_5 = new JLabel();
label_5.setForeground(new Color(0, 0, 255));
label_5.setText("输入总分");
label_5.setBounds(235, 169, 66, 18);
panel.add(label_5);
final JLabel label_6 = new JLabel();
label_6.setForeground(new Color(0, 0, 255));
label_6.setText("输入考试限时");
label_6.setBounds(19, 210, 87, 18);
panel.add(label_6);
final JLabel label_7 = new JLabel();
label_7.setForeground(new Color(0, 0, 255));
label_7.setText("输入知识点总数");
label_7.setBounds(19, 241, 106, 18);
panel.add(label_7);
textField = new JTextField();
textField.setBounds(129, 53, 282, 22);
panel.add(textField);
textField_1 = new JTextField();
textField_1.setBounds(129, 88, 282, 22);
panel.add(textField_1);
textField_2 = new JTextField();
textField_2.setBounds(129, 126, 282, 22);
panel.add(textField_2);
textField_3 = new LimitedTextField("0123456789",3);
textField_3.setBounds(129, 167, 87, 22);
panel.add(textField_3);
textField_4 = new LimitedTextField("0123456789",3);
textField_4.setBounds(324, 167, 87, 22);
panel.add(textField_4);
textField_5 = new LimitedTextField(": -0123456789",20);
textField_5.setBounds(129, 208, 282, 22);
panel.add(textField_5);
textField_6 = new LimitedTextField("0123456789",4);
textField_6.setBounds(129, 239, 87, 22);
panel.add(textField_6);
final JButton button = new JButton();
button.setBackground(new Color(51, 153, 255));
button.setForeground(new Color(255, 255, 255));
button.setText("确认");
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if(textField_6.getText().trim()==""){
JOptionPane.showMessageDialog(null, "请填写正确信息", "错误", JOptionPane.ERROR_MESSAGE);
}else{
ResultSet rs;
rs=dbsql.select("select * from Zsd ");
int i1=0;
try {
while(rs.next()){
i1++;
}
} catch (SQLException e1) {
e1.printStackTrace();
}
System.out.println(Integer.parseInt(textField_6.getText().trim()));
int gs=Integer.parseInt(textField_6.getText().trim());
System.out.println(gs+"***");
if(gs<=0||gs>i1)
{
JOptionPane.showMessageDialog(null, "请填写正确信息或超出范围", "错误", JOptionPane.ERROR_MESSAGE);
zsdxsj zsd = new zsdxsj();
zsd.setVisible(true);
setVisible(false);
}else{
System.out.println(Integer.parseInt(textField_6.getText().trim()));
//int gs=Integer.parseInt(textField_6.getText().trim());
xzzsd(Integer.parseInt(textField_6.getText().trim()));
}
}
}
});
button.setBounds(279, 236, 106, 28);
panel.add(button);
scrollPane = new JScrollPane();
scrollPane.setBounds(40, 291, 418, 141);
panel.add(scrollPane);
panel_1 = new JPanel();
panel_1.setLayout(null);
scrollPane.setViewportView(panel_1);
final JButton button_1 = new JButton();
button_1.setForeground(new Color(0, 0, 255));
button_1.setText("提交");
button_1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
StringBuffer stringBuffer = new StringBuffer();
File file = new File("D:\\"+textField.getText()+".html");
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e1) {
e1.printStackTrace();
}
}
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(file);
} catch (IOException e1) {
e1.printStackTrace();
}
stringBuffer.append("<html><head><title>"
+ textField.getText()
+ "试卷</title></head><body bgcolor='#ffffff'><center><H2>"
+ textField.getText() + " 试卷</h2></center>" +
"<br><center>"+textField_1.getText().trim()+"</center>" +
"<br><center>总分:"+textField_4.getText().trim()+"</center>"+
"<br><center>"+textField_2.getText().trim()+"</center><center>考试限时:"
+textField_5.getText().trim()+"</center>" );
stringBuffer.append("<center><table border=1><tr>");
String zid_[] = new String[100000];
HashSet hs = new HashSet();
HashMap map = new HashMap();
int zid1=0;
for(int y=0;y<Integer.parseInt(textField_6.getText());y++){
HashSet hs1 = new HashSet();
HashMap map1 = new HashMap();
ResultSet rs;
String str1="select * from Tiku where 知识点='"+ComboBox_[y].getSelectedItem()+"'";
rs=dbsql.select(str1);
try {
while(rs.next()){
hs1.add(rs.getString(6));
}
} catch (SQLException e1) {
e1.printStackTrace();
}
Collection conCollection = hs1;
Iterator iterator1 = conCollection.iterator(
没有合适的资源?快使用搜索试试~ 我知道了~
试卷生成系统-Java课程设计
共124个文件
class:92个
java:21个
doc:3个
5星 · 超过95%的资源 需积分: 50 55 下载量 118 浏览量
2009-09-01
09:21:45
上传
评论 1
收藏 1.21MB RAR 举报
温馨提示
试卷生成系统试卷生成系统试卷生成系统试卷生成系统试卷生成系统试卷生成系统试卷生成系统试卷生成系统试卷生成系统试卷生成系统
资源推荐
资源详情
资源评论
收起资源包目录
试卷生成系统-Java课程设计 (124个子文件)
Addst.class 7KB
nyxsj$1.class 6KB
zhxsj.class 6KB
zsdxsj.class 6KB
wlzsdnyx$1.class 6KB
Sjg.class 6KB
zhxsj$2.class 5KB
题库修改.class 5KB
zsdxsj$2.class 5KB
nyxsj.class 5KB
题库添加.class 5KB
查询结果.class 4KB
wlzsdnyx.class 4KB
Sjg2.class 4KB
Tk.class 3KB
查询界面.class 3KB
Select.class 3KB
Sql.class 3KB
shijuansc.class 3KB
题库.class 3KB
Zjm.class 3KB
查看题干.class 2KB
题库修改$1.class 2KB
zsdxsj$1.class 2KB
zhxsj$1.class 2KB
Addst$1.class 2KB
Sjg$6.class 2KB
题库添加$1.class 2KB
查询结果$3.class 2KB
查询结果$1.class 2KB
查询结果$2.class 1KB
Sjg$3.class 1KB
LimitedTextField$1.class 1KB
Select$1.class 1KB
查询界面$1.class 1KB
题库修改$2.class 1KB
题库添加$2.class 1KB
Tk$1.class 880B
Addst$2.class 854B
nyxsj$3.class 853B
Mypanel.class 834B
Mypanel.class 820B
Addst$3.class 812B
查询结果$4.class 785B
查看题干$1.class 785B
Sjg$4.class 778B
题库修改$3.class 774B
shijuansc$1.class 773B
Select$2.class 773B
shijuansc$3.class 769B
wlzsdnyx$3.class 769B
shijuansc$2.class 767B
shijuansc$4.class 767B
zsdxsj$4.class 757B
zhxsj$4.class 751B
shijuansc$6.class 750B
Tk$2.class 750B
Zjm$1.class 746B
题库添加$3.class 745B
查询界面$2.class 745B
Tk$4.class 741B
题库$1.class 721B
题库$2.class 721B
题库修改$4.class 707B
查询结果$5.class 707B
zsdxsj$3.class 704B
Zjm$2.class 704B
题库$3.class 702B
zhxsj$3.class 697B
shijuansc$7.class 692B
wlzsdnyx$4.class 686B
Addst$4.class 680B
题库添加$4.class 678B
查询界面$3.class 678B
zsdxsj$5.class 674B
nyxsj$4.class 668B
zhxsj$5.class 668B
wlzsdnyx$2.class 664B
Sjg2$2.class 656B
Sjg$5.class 650B
nyxsj$2.class 646B
Sjg2$1.class 644B
题库$4.class 642B
Select$3.class 639B
shijuansc$5.class 638B
Sjg$2.class 627B
Sjg$1.class 626B
Zjm$4.class 621B
Tk$5.class 615B
LimitedTextField.class 590B
Zjm$3.class 567B
Tk$3.class 561B
.classpath 668B
Thumbs.db 5KB
Thumbs.db 4KB
详细设计说明书 .doc 452KB
用户手册.doc 436KB
软件需求说明书.doc 48KB
zsdxsj.java 13KB
zhxsj.java 12KB
共 124 条
- 1
- 2
资源评论
- zhou8736514362013-05-07对我写论文很有帮助
- martin56782012-10-03还不错,有参考价值 多谢了
- bjxl902012-10-12挺受启发的。谢谢分享,适合学习~
zhongguo1999
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功