| 640 | public void lostOwnership (Clipboard clip, Transferable cont) {} |
| 641 | |
| 642 | private void find(String s) { |
| 643 | int first = 0; |
| 644 | if (s==null) { |
| 645 | GenericDialog gd = new GenericDialog("Find...", getTextWindow()); |
| 646 | gd.addStringField("Find: ", searchString, 20); |
| 647 | gd.showDialog(); |
| 648 | if (gd.wasCanceled()) |
| 649 | return; |
| 650 | s = gd.getNextString(); |
| 651 | } else { |
| 652 | if (selEnd>=0 && selEnd<iRowCount-1) |
| 653 | first = selEnd + 1; |
| 654 | else { |
| 655 | IJ.beep(); |
| 656 | return; |
| 657 | } |
| 658 | } |
| 659 | if (s.equals("")) |
| 660 | return; |
| 661 | boolean found = false; |
| 662 | for (int i=first; i<iRowCount; i++) { |
| 663 | String line = new String((char[])(vData.elementAt(i))); |
| 664 | if (line.contains(s)) { |
| 665 | setSelection(i, i); |
| 666 | found = true; |
| 667 | first = i + 1; |
| 668 | break; |
| 669 | } |
| 670 | } |
| 671 | if (!found) { |
| 672 | IJ.beep(); |
| 673 | first = 0; |
| 674 | } |
| 675 | searchString = s; |
| 676 | } |
| 677 | |
| 678 | private TextWindow getTextWindow() { |
| 679 | Component comp = getParent(); |