肯定程序代码的问题!黏上来看看!
解决方案 »
- GUI与多线程
- 如何做一个swing 程序,运行时不让他弹出命令行窗口,只显式swing自己的界面?
- 求救:关于Swing的前一步,后一步,复制,粘贴,剪切,删除操作的源代码.
- Reflect库里的一个基础问题 菜鸟的问
- 静态初始化和非静态初始化
- 如何从文件中读取中文字符?
- 请问怎么样判断一个字符串是不是整数啊?
- 又一个入门级的问题:关于在Graphics中输出文字
- 引用类型变量
- 有没有大神知道这是什么问题org.directwebremoting.extend.ServerException: Failed to read input
- 不用JDBC-ODBC连接oracle数据库?
- 问两个关于java的i/o的非常简单的问题。你不想要分吗?:)
{
scs1 dbcon;
Button button1;
Choice choice1;
Label label1;
Vector vector1;
String text;
Thread xianchen1=null;
int flag1=1;int flag2=1;
int biaozhi=0;
int canshuzhi=0;
int sb=0;
int shuzu[];
int x1,x2,y1,y2;public void init(){
setLayout(null);
button1=new Button();
choice1= new Choice();
label1=new Label();
add(label1);
add(button1);
add(choice1);
choice1.addItemListener(this);
button1.addActionListener(this);
label1.setBounds(300,10,200,10);
choice1.setBounds(100,240,50,50);
button1.setBounds(400,240,50,50);
shuzu=new int[400];}public void start(){
if(xianchen1==null);
{xianchen1=new Thread(this);
xianchen1.start();
}}public void stop(){}
public void run(){
dbcon=new scs1();
dbcon.dbConnection();
vector1=dbcon.results;
Enumeration enum=vector1.elements();
text=((String)enum.nextElement()).trim();repaint();if(text.equals(message)){
flag2=1;
choice1.add("");
choice1.add("温");
choice1.add("锅");
choice1.add("炉");}
else{
choice1.add("");
choice1.add("温x1");
choice1.add("锅x1");
choice1.add("炉x1");
flag2=2;}while(true){dbcon.canshuhao=canshuzhi;
dbcon.n=biaozhi;
dbcon.dbConnection();
vector1=dbcon.results;
repaint();
biaozhi++;
try{xianchen1.sleep(2000);}
catch(Exception sleepproblem){}
}
}public void itemStateChanged(ItemEvent e){
canshuzhi++;
biaozhi=0;
}
public void actionPerformed(ActionEvent e)
{}public void paint(Graphics g)
{
if (biaozhi<=4){
Enumeration enum=vector1.elements();
while(enum.hasMoreElements()){
String s=(String)enum.nextElement();
float temp1=Float.parseFloat(s);
int temp=(int)temp1;
shuzu[sb]=temp;
sb++;
}
if(biaozhi==1){
for(i=0;i<99;i++){
x1=480-i;
x2=480-(i+1);
y1=20*(550-shuzu[i]);
y2=20*(550-shuzu[i+1]);
g.drawLine(x1,y1,x2,y2);}}
else if(biaozhi==2){
for(i=0;i<199;i++){
x1=480-i;
x2=480-(i+1);
y1=20*(550-shuzu[i]);
y2=20*(550-shuzu[i+1]);
g.drawLine(x1,y1,x2,y2);}}
else if(biaozhi==3){
for(i=0;i<299;i++){
x1=480-i;
x2=480-(i+1);
y1=20*(550-shuzu[i]);
y2=20*(550-shuzu[i+1]);
g.drawLine(x1,y1,x2,y2);}}
else if(biaozhi==4){
for(i=0;i<399;i++){
x1=480-i;
x2=480-(i+1);
y1=20*(550-shuzu[i]);
y2=20*(550-shuzu[i+1]);
g.drawLine(x1,y1,x2,y2);}}
}
else if(biaozhi>4){
for(i=100;i<400;i++){
shuzu[i-100]=shuzu[i];}
Enumeration enum=vector1.elements();
int k=300;
while(enum.hasMoreElements()){
String s=(String)enum.nextElement();
float temp1=Float.parseFloat(s);
int temp=(int)temp1;
shuzu[k]=temp;
k++;}
for(i=0;i<399;i++){
x1=20+i;
x2=20+(i+1);
y1=20*(550-shuzu[i]);
y2=20*(550-shuzu[i+1]);
g.drawLine(x1,y1,x2,y2);}}
/*Enumeration enum=vector1.elements();
String s=(String)enum.nextElement();
float temp1=Float.parseFloat(s);
int temp=(int)temp1;
String temp2=String.valueOf(temp);
g.drawString(temp2,200,200);*/
}
}