boolean (JComponent comp, DataFlavor[] transferFlavors) { Editor editor = getEditor(comp); if (editor.isViewer()) return false; if (!editor.getDocument().isWritable()) return false; int offset = editor.getCaretModel().getOffset(); if (editor.getDocument().getRangeGuard(offset, offset) != null) return false; for (int i = 0; i < transferFlavors.length; i++) { DataFlavor transferFlavor = transferFlavors[i]; if (transferFlavor.equals(DataFlavor.stringFlavor)) return true; } return false; }