اخواني اخواتي الاعزاء
عندي البرنامج التالي وابي احوله من جافا نصي الى جرافيكال باستخدام
SWING
AWT
ساعدوني تكفون يالنشاما
import java.io.*;
import java.net.*;
class Client1
{
// main program for client for file transfer, gets data from host and sends it to server
public static void main (String args[]) throws IOException
{
// get remoteIPaddress name either default local host or passed by command line parameter
InetAddress remoteIPaddress = InetAddress.getByName("localhost");
if (args.length > 0)
remoteIPaddress = InetAddress.getByName(args[0]); // get server host name
System.out.println("\nClient: file transfer program using unrestricted simplex data link protcol");
System.out.println("Local IP address " + InetAddress.getLocalHost().toString() +
" Remote IP address " + remoteIPaddress.toString() );
FromHost fromHost = new FromHost(); // open a file to read from
// open physical layer to send to remoteIPaddress on remotePort, receive on receivePort
int remotePort = 10000; // port on server to send datagrams to
int receivePort = 10001; // local port to receive datagrams on
PhysicalLayer phLayer = new PhysicalLayer(remoteIPaddress, remotePort, receivePort);
PhysicalFrame Sframe = new PhysicalFrame(); // holds frame to send
PhysicalFrame Rframe = new PhysicalFrame(); // holds frame to receive
int event; // event indicator
// read HostFrames from from host until false (end of file), send data
System.out.println("sending file - S indicates a frame transmitted");
while (fromHost.get(Sframe.info)) // loop reading frames from host until end of file
{
Sframe.kind = PhysicalFrame.FRAME_DATA; // set up data frame
phLayer.sendFrame(Sframe); // send the frame
System.out.println('S'); // display an 'S' every frame sent
}
phLayer.terminate(); // finished!
System.out.println("Client terminating");
System.exit(0);
}
}