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

📄 setting.java

📁 包括源代码
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package testgui;import DBOperation.DBItem;import java.awt.event.*;import java.awt.event.ItemListener;import javax.swing.*;import java.awt.*;/** * * @author DancingMoon */public class Setting extends JDialog implements ActionListener,ItemListener{     Label 题型,难度,限制时间;     Checkbox 选择,判断,填空,简单,中等,较难,限制时间2,不限制时间;     CheckboxGroup  限制时间1;     Button 确定,重置;          String [][] s1,s2,s3,s4,s5,s6;     String st[][]=new String[60][60];          public Setting(){}     public Setting(UserTest usertest) {     super();         s1=new String[30][30];     s2=new String[30][30];     s3=new String[30][30];     s4=new String[30][30];     s5=new String[30][30];     s6=new String[30][30];     //super(usertest,"设置",false);          st=usertest.s;     setLayout(new FlowLayout(FlowLayout.LEFT,18,20));     题型=new Label ("题型");     选择=new Checkbox("选择");     判断=new Checkbox("判断");     填空=new Checkbox("填空");     难度=new Label ("难度");          确定=new Button("确定");     重置=new Button("重置");          简单=new Checkbox("简单");     中等=new Checkbox("中等");     较难=new Checkbox("较难");     限制时间=new Label ("限制时间");            add(题型);      add(选择);      add(判断);      add(填空);      add(难度);      add(简单);      add(中等);      add(较难);            add(限制时间);          选择.addItemListener(this);      判断.addItemListener(this);      填空.addItemListener(this);      简单.addItemListener(this);      中等.addItemListener(this);      较难.addItemListener(this);      确定.addActionListener(this);      重置.addActionListener(this);            限制时间1 = new CheckboxGroup();      限制时间2=new Checkbox("限制时间",限制时间1,true);      不限制时间=new Checkbox("不限制时间",限制时间1,false);            this.add(限制时间2);      this.add(不限制时间);            限制时间2.addItemListener(this);      不限制时间.addItemListener(this);            add(确定);      add(重置);                  //限制时间1.addItemListener(限制时间1);      确定.addActionListener(this);      重置.addActionListener(this);            this.setBounds(600, 300, 290,220);      setVisible(false);        }    public void actionPerformed(ActionEvent e) {                if(e.getSource()==重置)        {            选择.setState(false);            判断.setState(false);            填空.setState(false);            简单.setState(false);            中等.setState(false);            较难.setState(false);            限制时间1.setSelectedCheckbox(限制时间2);        }                if(e.getSource()==确定)        {            DBItem item=new DBItem();            if(选择.getState())                s1=item.getItemL("ItemTypeID", 1);            if(判断.getState())                s2=item.getItemL("ItemTypeID", 2);            if(填空.getState())                s3=item.getItemL("ItemTypeID", 3);            if(简单.getState())                s4=item.getItemL("ItemDifID", 1);            if(中等.getState())                s5=item.getItemL("ItemDifID", 2);            if(较难.getState())                s6=item.getItemL("ItemDifID", 3);              this.setVisible(false);        }    }       public String[][] settingItem()    {        String str[][]=new String[60][60];        System.arraycopy(s1,0,str,str.length+1,s1.length);        System.arraycopy(s2,0,str,str.length+1,s2.length);        System.arraycopy(s3,0,str,str.length+1,s3.length);        System.arraycopy(s4,0,str,str.length+1,s4.length);        System.arraycopy(s5,0,str,str.length+1,s5.length);        System.arraycopy(s6,0,str,str.length+1,s6.length);        return str;    }        public boolean timeselct()    {        if(限制时间2.getState())            return true;        else            return false;    }        public void itemStateChanged(ItemEvent e) {    }/*  public static void main(String args[])  {  Setting frame=new Setting();     Dialog.addWindowListener(new WindowAdapter(){ public void windowClosing (WindowEvent e){ System.exit(0);} });  }*/}

⌨️ 快捷键说明

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