SUPER DUPER HYPER!!!
This commit is contained in:
parent
3a528f307b
commit
cb63402b9f
12 changed files with 2741 additions and 494 deletions
|
|
@ -12,8 +12,11 @@ import utilities.Logger;
|
|||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.rmi.NotBoundException;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
|
|
@ -67,6 +70,23 @@ public class App extends JFrame {
|
|||
app = this;
|
||||
|
||||
HomePage home = new HomePage(this);
|
||||
|
||||
/* app.addWindowListener(new WindowAdapter()
|
||||
{
|
||||
public void windowClosing(WindowEvent e)
|
||||
{
|
||||
try {
|
||||
authService.logout(App.session.account.userName);
|
||||
System.out.println("LOGOUT BECAUSE WINDOW CLOSED");
|
||||
} catch (RemoteException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (NotBoundException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (MalformedURLException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
public static Point getWindowsPosition(){
|
||||
|
|
|
|||
|
|
@ -29,32 +29,20 @@ public class SendWords extends SwingWorker<Void,Void> {
|
|||
|
||||
@Override
|
||||
public Void doInBackground() {
|
||||
DatagramSocket clientSocket = null;
|
||||
try {
|
||||
InetAddress hostIP = InetAddress.getLocalHost();
|
||||
InetSocketAddress myAddress =
|
||||
new InetSocketAddress(hostIP, Config.WordsReceiverServerPort);
|
||||
InetSocketAddress myAddress = new InetSocketAddress(Config.WordsReceiverServerURI, Config.WordsReceiverServerPort);
|
||||
DatagramChannel datagramChannel = DatagramChannel.open();
|
||||
datagramChannel.bind(null);
|
||||
|
||||
ByteBuffer buffer = ByteBuffer.allocate(1024);
|
||||
buffer.clear();
|
||||
System.out.println("SENDER=" + App.session.account.userName);
|
||||
Message msg = new Message("WORDS", App.session.account.userName, "", words);
|
||||
String sentence = msg.toString();
|
||||
buffer.put(sentence.getBytes());
|
||||
buffer.flip();
|
||||
datagramChannel.send(buffer, myAddress);
|
||||
buffer.clear();
|
||||
|
||||
/*clientSocket = new DatagramSocket();
|
||||
|
||||
InetAddress IPAddress = InetAddress.getByName(Config.WordsReceiverServerURI);
|
||||
byte[] sendData = new byte[1024];
|
||||
Message msg = new Message("WORDS", App.session.account.userName, "", words);
|
||||
String sentence = msg.toString();
|
||||
sendData = sentence.getBytes();
|
||||
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, Config.WordsReceiverServerPort);
|
||||
clientSocket.send(sendPacket);
|
||||
clientSocket.close();*/
|
||||
System.out.println("WORDS INVIATE");
|
||||
System.out.println(sentence);
|
||||
|
||||
return null;
|
||||
} catch (UnknownHostException e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue