G
Guest
Gast
Also ich schreibe gerade ein programm indem man eine ip und einen text angeben kann, der dann per net send an die ip geschickt wird....
Läuft auch so weit aber ich glaub beim umwandeln der ip stimmt was nicht aber ich komm nicht drauf... hab jetzt schon ne stunde gegoogled aber nix gefunden. Hoffe hier kann mir jemand helfen...
multiNetSend.java
MyActionListener.java
Als Fehlermeldung kommt wenn ich den Button drücke:
at java.lang.Double.parseDouble(Double.java:220)
at MyActionListener.actionPerformed(MyActionListener.java:21)
usw usw ....
Läuft auch so weit aber ich glaub beim umwandeln der ip stimmt was nicht aber ich komm nicht drauf... hab jetzt schon ne stunde gegoogled aber nix gefunden. Hoffe hier kann mir jemand helfen...
multiNetSend.java
Code:
import java.awt.*;;
public class multiNetSend extends Frame
{
private Label lblIp = new Label("IP:");
private Label lblText = new Label("Text:");
private Label lblAnzahl = new Label("Anzahl:");
public TextField tfIp = new TextField(11);
public TextField tfText = new TextField(15);
public TextField tfAnzahl = new TextField(1);
public Button btnLos = new Button("START");
public Button btnAus = new Button("BEENDEN");
private Panel pnlNorth = new Panel();
private MyActionListener
myActionListener = new MyActionListener(this);
public multiNetSend()
{
super("multi NETSEND");
this.pnlNorth.add(this.lblIp);
this.pnlNorth.add(this.tfIp);
this.pnlNorth.add(this.lblText);
this.pnlNorth.add(this.tfText);
this.pnlNorth.add(this.lblAnzahl);
this.pnlNorth.add(this.tfAnzahl);
this.pnlNorth.add(this.btnLos);
this.add(this.pnlNorth, BorderLayout.NORTH);
this.add(this.btnAus, BorderLayout.SOUTH);
this.pack();
this.show();
//Ergebnissteuerung
this.btnLos.addActionListener(myActionListener);
this.btnAus.addActionListener(myActionListener);
}
public static void main(String argv[])
{
multiNetSend M = new multiNetSend();
}
}
MyActionListener.java
Code:
import java.awt.event.*;
import java.io.*;
public class MyActionListener implements ActionListener
{
public multiNetSend M;
public MyActionListener(multiNetSend M)
{
this.M=M;
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource()==M.btnAus)
{
System.exit(0);
}
if (e.getSource()==M.btnLos)
{
double ip;
ip=Double.parseDouble(M.tfIp.getText());
String text;
text=M.tfText.getText();
try
{
System.out.println(text);
Process proc = Runtime.getRuntime().exec("cmd.exe /c START net send "+ip+" "+text);
BufferedReader in=new BufferedReader(new InputStreamReader (proc.getInputStream()));
while(in.readLine()!=null)
{
System.out.println(in.readLine());
}
}
catch(Exception M)
{
System.out.println("Net Send funzt net!!");
System.err.println(e.toString());
M.printStackTrace();
}
}
}
}
Als Fehlermeldung kommt wenn ich den Button drücke:
at java.lang.Double.parseDouble(Double.java:220)
at MyActionListener.actionPerformed(MyActionListener.java:21)
usw usw ....