アットウィキロゴ

JAVC

import java.awt.*;
import java.awt.event.*;

class pro extends Frame implements MouseListener{

String urlx;
String[] data=new String[50000];
String[] z=new String[50000];
String[] title=new String[31];
String[] artist=new String[31];
String[] point=new String[31];
int[] x=new int[31];
int s,datanumber;
String str;
int p1,p2;
TextField t1,t2,t3;
String n1,n2,n3;
        
public static void main(String [] args) {
        Frame f=new pro();
        f.setTitle("game");
        f.setSize(700,700);
        f.setBackground(Color.yellow);
        f.setVisible(true);
            }

pro(){

setLayout(new FlowLayout());
t1=new TextField("2009");
t2=new TextField("3");
t3=new TextField("2");

add(t1);
add(t2);
add(t3);

check();

if(p1>-1)exc();

addMouseListener(this);

addWindowListener(new stopwin());

}


void check(){
n1=t1.getText();
n2=t2.getText();
n3=t3.getText();

urlx="http://www11.atpages.jp/ce00582/music.php?y=";
urlx=urlx+n1;
urlx=urlx+"&m=";
urlx=urlx+n2;
urlx=urlx+"&w=";
urlx=urlx+n3;

getdata sub=new getdata();
sub.makedata(urlx);
data=sub.data;
datanumber=sub.datanumber;

str="";
for(s=1;s<datanumber+1;s++){
str=str+data[s];
}

p1=str.indexOf("<rank>");

}

void exc(){

n1=t1.getText();
n2=t2.getText();
n3=t3.getText();

urlx="http://www11.atpages.jp/ce00582/music.php?y=";
urlx=urlx+n1;
urlx=urlx+"&m=";
urlx=urlx+n2;
urlx=urlx+"&w=";
urlx=urlx+n3;

getdata sub=new getdata();
sub.makedata(urlx);
data=sub.data;
datanumber=sub.datanumber;

str="";
for(s=1;s<datanumber+1;s++){
str=str+data[s];
}

p1=str.indexOf("<rank>");
str=str.substring(p1,str.length());

p1=-2;
for(s=1;s<31;s++){
p1=str.indexOf("<rank>",p1+1);
x[s]=p1;
}

for(s=1;s<30;s++){
z[s]=str.substring(x[s],x[s+1]);
}

z[30]=str.substring(x[30],str.length());

for(s=1;s<31;s++){
str=z[s];
p1=str.indexOf("<artist>");
p2=str.indexOf("</artist>");
str=str.substring(p1,p2);
artist[s]=str.replace("<artist>","");
str=z[s];
p1=str.indexOf("<title>");
p2=str.indexOf("</title>");
str=str.substring(p1,p2);
title[s]=str.replace("<title>","");
str=z[s];
p1=str.indexOf("<point>");
p2=str.indexOf("</point>");
str=str.substring(p1,p2);
point[s]=str.replace("<point>","");
}

}










class stopwin extends WindowAdapter{
    public void windowClosing(WindowEvent we){System.exit(0);}
}  

public void paint(Graphics g){

g.setColor(Color.black);

for(s=1;s<31;s++){
g.drawString(artist[s],50,100+20*s);
g.drawString(title[s],300,100+20*s);
g.drawString(point[s],600,100+20*s);
}

}

public void mouseEntered(MouseEvent e){
}

public void mouseExited(MouseEvent e){
}

public void mousePressed(MouseEvent e){
}

public void mouseReleased(MouseEvent e){
}

public void mouseClicked(MouseEvent e){  

exc();

repaint();

}







}
最終更新:2011年08月07日 13:14