📄 miukono8.java
字号:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.io.*;
import java.awt.datatransfer.*;//用于打开文件和保存文件的一个类
import java.applet.Applet;
import java.sql.*;
class miukoNO8 extends Frame implements ActionListener
{
private Button b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12;
private Button b20,b21;
private Image img;
private Label g0,g[],g1[],g3[],g4[],g5[];
private Button bb[],bb1[],bb2[];
private Connection con;//定义一个能连接数据库的变量
private Statement stmt;
private ResultSet rs;
int u=0,o=0,h=0,t=0,nn=0;
String s[],s1[],s2[],s3[],s4[],s5[];
Color c1,c2,c3;
TextField t1,t2;
static TextField q1,q2,q3,q4,q5,q6,q7,q8;
Label y1,y2,y3,y4,y5,y6,y7;
String str1,str2,str3,str4,str5,str6,str7;
private boolean h1=false,h2=false,h3=false,h4=false;
private boolean qy1=false,qy2=false,qy3=false,qy4=false;
miukoNO8()
{
super("~NO.8~~附加选项");
Toolkit tool = getToolkit();
img = tool.getImage("Bingo.jpg");
c1 = new Color(55,235,130);
c3 = new Color(133,199,177);
c2 = new Color(99,177,233);
setBackground(c1);
setSize(460,388);
setIconImage(img);
setLayout(null);
setLocation(310,80);
y1 = new Label("要插入到的单元:");
y1.setBounds(130,72,100,20);
y1.setBackground(c1);
y1.setVisible(false);
add(y1);
q1 = new TextField();
q1.setBounds(232,72,100,20);
q1.setVisible(false);
q1.setBackground(c1);
add(q1);
y2 = new Label("要插入的单词:");
y2.setBounds(130,93,100,20);
y2.setBackground(c1);
y2.setVisible(false);
q2 = new TextField();
q2.setBounds(232,93,100,20);
q2.setVisible(false);
q2.setBackground(c1);
add(y2);
add(q2);
y3 = new Label("插入单词意思一:");
y3.setBounds(130,114,100,20);
y3.setBackground(c1);
y3.setVisible(false);
q3 = new TextField();
q3.setBounds(232,114,100,20);
q3.setVisible(false);
q3.setBackground(c1);
add(y3);
add(q3);
y4 = new Label("插入单词意思二:");
y4.setBounds(130,135,100,20);
y4.setBackground(c1);
y4.setVisible(false);
q4 = new TextField();
q4.setBounds(232,135,100,20);
q4.setVisible(false);
q4.setBackground(c1);
add(y4);
add(q4);
y5 = new Label("插入单词意思三:");
y5.setBounds(130,156,100,20);
y5.setBackground(c1);
y5.setVisible(false);
q5 = new TextField();
q5.setBounds(232,156,100,20);
q5.setVisible(false);
q5.setBackground(c1);
add(y5);
add(q5);
y6 = new Label("插入单词意思四:");
y6.setBounds(130,178,100,20);
y6.setBackground(c1);
y6.setVisible(false);
q6 = new TextField();
q6.setBounds(232,178,100,20);
q6.setVisible(false);
q6.setBackground(c1);
add(y6);
add(q6);
y7 = new Label("插入单词意思五:");
y7.setBounds(130,199,100,20);
y7.setBackground(c1);
y7.setVisible(false);
q7 = new TextField();
q7.setBounds(232,199,100,20);
q7.setVisible(false);
q7.setBackground(c1);
add(y7);
add(q7);
q8 = new TextField("您现在的位置是\"单词添加\"");
q8.setBounds(130,241,202,20);
q8.setVisible(false);
q8.setBackground(c1);
add(q8);
b20 =new Button("重新填写");
b20.setBackground(c1);
b20.addActionListener(this);
b20.setBounds(130,220,100,20);
b20.setVisible(false);
add(b20);
b21 =new Button("提交");
b21.addActionListener(this);
b21.setBackground(c1);
b21.setBounds(232,220,100,20);
b21.setVisible(false);
add(b21);
g0 =new Label("输入要转到的页数:");
g0.setBackground(c1);
g0.setBounds(112,340,105,20);
g0.setVisible(false);
add(g0);
t1 =new TextField("");
t1.setBackground(c1);
t1.setBounds(218,340,80,20);
t1.setVisible(false);
add(t1);
t2 =new TextField("英语汇集900句共有89页");
t2.setBackground(c1);
t2.setBounds(112,361,287,20);
t2.setVisible(false);
t2.setEnabled(false);
add(t2);
b0 =new Button("转到");
b0.setBackground(c1);
b0.addActionListener(this);
b0.setBounds(299,340,100,20);
b0.setVisible(false);
add(b0);
b1 =new Button("常用英语谚语");
b1.setBackground(c1);
b1.setBounds(10,30,100,30);
b1.setVisible(true);
add(b1);
b2 =new Button("四级高频词汇");
b2.setBackground(c1);
b2.setBounds(10,61,100,30);
b2.setVisible(true);
add(b2);
b3 =new Button("美式俚语汇集");
b3.setBackground(c1);
b3.setBounds(10,92,100,30);
b3.setVisible(true);
add(b3);
b4 =new Button("英语汇集900句");
b4.setBackground(c1);
b4.setBounds(10,123,100,30);
b4.setVisible(true);
add(b4);
b5 =new Button("单词添加");
b5.setBackground(c1);
b5.setBounds(10,154,100,30);
b5.setVisible(true);
add(b5);
b6 =new Button("单词修改");
b6.setBackground(c1);
b6.setBounds(10,185,100,30);
b6.setVisible(true);
add(b6);
b7 =new Button("单词删除");
b7.setBackground(c1);
b7.setBounds(10,216,100,30);
b7.setVisible(true);
add(b7);
b8 =new Button("短语修改");
b8.setBackground(c1);
b8.setBounds(10,247,100,30);
b8.setVisible(true);
add(b8);
b9 =new Button("返回主页");
b9.setBackground(c1);
b9.setBounds(10,278,100,30);
b9.setVisible(true);
add(b9);
b10 =new Button("退出软件");
b10.setBackground(c1);
b10.setBounds(10,309,100,30);
b10.setVisible(true);
add(b10);
b11 =new Button("上一页");
b11.setBackground(c1);
b11.setBounds(10,340,100,20);
b11.setVisible(true);
add(b11);
b12 =new Button("下一页");
b12.setBackground(c1);
b12.setBounds(10,361,100,20);
b12.setVisible(true);
add(b12);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
b10.addActionListener(this);
b11.addActionListener(this);
b12.addActionListener(this);
//_---====================----------------===========================================---------========
s=new String[230];
s1=new String[230];
s2=new String[230];
g=new Label[230];
g1=new Label[230];
g3=new Label[197];
s3=new String [197];
s4=new String [243];
g4=new Label [243];
s5=new String [1235];
g5=new Label [1235];
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:miukou");
stmt = con.createStatement();
}
catch(Exception eeee){}
try
{
h=0;
rs = stmt.executeQuery("SELECT * FROM miuko6");
while(rs.next())
{
s4[h]=rs.getString("name");
h++;
}
rs.close();
}
catch(Exception e9){}
try
{
h=0;
rs = stmt.executeQuery("SELECT * FROM miuko4");
while(rs.next())
{
s[h]=rs.getString("name");
t=s[h].indexOf('.',0);
s1[h]=s[h].substring(0,t);
s2[h]=s[h].substring(t+1,s[h].length());
h++;
}
rs.close();
}
catch(Exception e9){}
try
{
h=0;
rs = stmt.executeQuery("SELECT * FROM miuko5");
while(rs.next())
{
s3[h]=rs.getString("name");
h++;
}
rs.close();
}
catch(Exception e9){}
try
{
h=0;
rs = stmt.executeQuery("SELECT * FROM miuko7");
while(rs.next())
{
s5[h]=rs.getString("name");
h++;
}
rs.close();
}
catch(Exception e9){}
bb=new Button[230/7+1];
bb1=new Button[197/14+1];
bb2=new Button[243/14+1];
mu1();
setVisible(true);
}
public void mu1()
{
b0.setVisible(false);
g0.setVisible(false);
t1.setVisible(false);
t2.setVisible(false);
h1=true;
h2=false;
int k1=30,k2=51,l=112;
char ch[];
for (int i=0;i<230 ; i++)
{
if(k1>=310)
{
k1=30;
k2=51;
}
g[i]=new Label();
g[i].setBounds(112,k1,340,20);
if(i%2==1)
g[i].setBackground(Color.green);
else
g[i].setBackground(Color.orange);
if(i<15)
{
g[i].setVisible(true);
}
else
{
g[i].setVisible(false);
}
add(g[i]);
g[i].setText(s1[i]);
g1[i]=new Label();
g1[i].setBounds(112,k2,340,20);
if(i%2==0)
g1[i].setBackground(Color.orange);
else
g1[i].setBackground(Color.green);
if(i<15)
{
g1[i].setVisible(true);
}
else
{
g1[i].setVisible(false);
}
add(g1[i]);
g1[i].setText(s2[i]);
k1=k1+42;
k2=k2+42;
}
for(int i=0;i<(230/7+1);i++)
{
if(i>10&&i<22)
{
l=112+(i-11)*(350/(230/20+1)+2);
bb[i]=new Button(""+(1+i));
bb[i].setBounds(l,344,350/(230/20+1),20);
if(i%2==0)
bb[i].setBackground(Color.orange);
else
bb[i].setBackground(c1);
bb[i].setVisible(true);
bb[i].addActionListener(this);
add(bb[i]);
}
else if(i>21)
{
l=112+(i-22)*(350/(230/20+1)+2);
bb[i]=new Button(""+(1+i));
bb[i].setBounds(l,365,350/(230/20+1),20);
if(i%2==0)
bb[i].setBackground(Color.orange);
else
bb[i].setBackground(c1);
bb[i].setVisible(true);
bb[i].addActionListener(this);
add(bb[i]);
}
else
{
bb[i]=new Button(""+(1+i));
bb[i].setBounds(l,323,350/(230/20+1),20);
if(i%2==0)
bb[i].setBackground(Color.orange);
else
bb[i].setBackground(c1);
bb[i].setVisible(true);
bb[i].addActionListener(this);
add(bb[i]);
l=l+350/(230/20+1)+2;
}
}
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b2)
{
kkk();
b11.setVisible(true);
b12.setVisible(true);
b0.setVisible(false);
g0.setVisible(false);
t1.setVisible(false);
t2.setVisible(false);
if(h1==true)
{
for(int i=0;i<230;i++)
{
g[i].setVisible(false);
g1[i].setVisible(false);
}
for(int i=0;i<33;i++)
{
bb[i].setVisible(false);
}
}
if(h4==true)
{
for(int i=0;i<1235;i++)
{
g5[i].setVisible(false);
}
}
if(h3==true)
{
for(int i=0;i<243;i++)
{
g4[i].setVisible(false);
}
for(int i=0;i<18;i++)
{
bb2[i].setVisible(false);
}
}
int k=32,l=112;
h1=false;
h2=true;
h3=false;
for (int i=0;i<197 ;i++ )
{
if(k>=310)
{
k=32;
}
g3[i]=new Label();
g3[i].setBounds(112,k,340,20);
if(i%2==1)
g3[i].setBackground(Color.green);
else
g3[i].setBackground(Color.orange);
if(i<15)
{
g3[i].setVisible(true);
}
else
{
g3[i].setVisible(false);
}
add(g3[i]);
g3[i].setText(s3[i]);
k=k+21;
}
for(int i=0;i<15;i++)
{
if(i>6)
{
l=112+(i-7)*(335/(197/28+1)+2);
bb1[i]=new Button(""+(1+i));
bb1[i].setBounds(l,347,335/(197/28+1)+1,20);
if(i%2==0)
bb1[i].setBackground(Color.orange);
else
bb1[i].setBackground(c1);
bb1[i].setVisible(true);
bb1[i].addActionListener(this);
add(bb1[i]);
}
else
{
bb1[i]=new Button(""+(1+i));
bb1[i].setBounds(l,326,335/(197/28+1)+1,20);
if(i%2==0)
bb1[i].setBackground(Color.orange);
else
bb1[i].setBackground(c1);
bb1[i].setVisible(true);
bb1[i].addActionListener(this);
add(bb1[i]);
l=l+335/(197/28+1)+2;
}
}
}
for (int i=0;i<15 ;i++ )
{
if(e.getSource()==bb1[i])
{
u=i;
o=i;
for(int p=0;p<197;p++)
{
g3[p].setVisible(false);
}
if(197>i*14+14)
{
for(int j=i*14;j<i*14+14;j++)
{
g3[j].setVisible(true);
}
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -