public String getClipboardContents()
        {
            String result = "";
            Transferable contents = clipboard.getContents(null);
            boolean hasTransferableText = contents != null && contents.isDataFlavorSupported(DataFlavor.stringFlavor);
            if (hasTransferableText)
            {
                try
                {
                    result = (String)contents.getTransferData(DataFlavor.stringFlavor);
                }
                catch (UnsupportedFlavorException ex)
                {
                    //highly unlikely since we are using a standard DataFlavor
                    ex.printStackTrace();
                }
                catch (IOException ex)
                {
                    ex.printStackTrace();
                }
            }
            return result;
        }