List of usage examples for javax.swing.text JTextComponent equals
public boolean equals(Object obj)
From source file:DragColorTextFieldDemo.java
public boolean importData(JComponent c, Transferable t) { JTextComponent tc = (JTextComponent) c; if (!canImport(c, t.getTransferDataFlavors())) { return false; }/*ww w. jav a 2 s.c om*/ if (tc.equals(source) && (tc.getCaretPosition() >= p0.getOffset()) && (tc.getCaretPosition() <= p1.getOffset())) { shouldRemove = false; return true; } if (hasStringFlavor(t.getTransferDataFlavors())) { try { String str = (String) t.getTransferData(stringFlavor); tc.replaceSelection(str); return true; } catch (UnsupportedFlavorException ufe) { System.out.println("importData: unsupported data flavor"); } catch (IOException ioe) { System.out.println("importData: I/O exception"); } } //The ColorTransferHandler superclass handles color. return super.importData(c, t); }