Hallo,
Frage an die Java-Profis, ich habe folgenden Java Code:
Code:
/**
* @(#)Wifibot.java
*
* Sample Applet application
*
* @author
* @version 1.00 07/10/15
*/
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.Graphics2D;
public class Wifibot extends Applet {
Button Up_Button ;
Button Down_Button ;
Button Left_Button ;
Button Right_Button ;
Button Grab_Button;
int Port_Id = 10001;
TcpIP gtp=null;
BufferedImage Graphic_buffer=new BufferedImage(88,120,BufferedImage.TYPE_INT_ARGB);
int[] Tmp_graphic_Buffer=new int[88*120];
/***************************/
int x_pad=20;
int y_pad=140;
public void init()
{
setLayout(null);
gtp= new TcpIP(Port_Id,this);
//set the up left right down buttons
Up_Button = new Button("Up");
Up_Button.setBounds(x_pad+50,y_pad,40,40); // param int
Up_Button.addActionListener( new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
gtp.send("UP0");
System.out.println("");
}
}
);
add(Up_Button);
Left_Button = new Button("Left");
Left_Button.setBounds(x_pad,y_pad+50,40,40);
Left_Button.addActionListener( new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
gtp.send("LE0");
System.out.println("");
}
}
);
add(Left_Button);
Right_Button = new Button("Right");
Right_Button.setBounds(x_pad+100,y_pad+50,40,40); // param int
Right_Button.addActionListener( new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
gtp.send("RI0");
System.out.println("");
}
}
);
add(Right_Button);
Down_Button = new Button("Down");
Down_Button.setBounds(x_pad+50,y_pad+100,40,40); // param int
Down_Button.addActionListener( new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
gtp.send("DO0");
byte[] in=null;
in=gtp.receive();
System.out.println("lenght ->"+in.length);
for(int i=0;i<in.length;i++)
{
System.out.println("lenght ->"+in[i]+'A');
}
}
}
);
add(Down_Button);
Grab_Button = new Button("Grab");
Grab_Button.setBounds(x_pad+180,y_pad+50,40,40); // param int
Grab_Button.addActionListener( new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
gtp.send("RGB"); //send order to grab picture
int tmp=0;
gtp.send("RED");
byte[] in=null;
if (gtp.available()>0) in=gtp.receive(); //flush the input buffer
for (int k=0,j=0,i=0; k<120*88;)
{
in=gtp.receive();
for(j =0 ;j<in.length;j++)
{
tmp=(int)in[j];
if(tmp<0) tmp=256+tmp;
Tmp_graphic_Buffer[k++]=0xFF000000|tmp<<16|tmp<<8|tmp;
}
gtp.send("e");
}
repaint();
}
}
);
add(Grab_Button);
for (int i=0; i<120*88;i++)
{
Tmp_graphic_Buffer[i]=0xff808080;
}
}
public void paint(Graphics g)
{
Graphic_buffer.setRGB(0,0,88,120,Tmp_graphic_Buffer,0,88);
g.drawImage(Graphic_buffer,x_pad+24,y_pad-130,null);
}
}
Wenn ich kompilieren will kommt:
Datei.java:42: cannot find symbol
symbol: class TcpIP
location: class Datei;
Die Datei TcpIP.class liegt im gleichen Verzeichnis.
Was fehlt hier?
Lesezeichen