01: /*
02: * SearchableTextPane.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.components;
13:
14: import java.awt.Window;
15: import javax.swing.JTextPane;
16: import workbench.gui.editor.SearchAndReplace;
17: import workbench.interfaces.TextContainer;
18:
19: /**
20: * @author support@sql-workbench.net
21: */
22: public class SearchableTextPane extends JTextPane implements
23: TextContainer {
24: private SearchAndReplace searcher;
25:
26: public SearchableTextPane(Window owner) {
27: super ();
28: searcher = new SearchAndReplace(owner, this );
29: TextComponentMouseListener l = new TextComponentMouseListener(
30: this );
31: l.addAction(searcher.getFindAction());
32: l.addAction(searcher.getFindAgainAction());
33: }
34:
35: public void setSelectedText(String aText) {
36: this.setText(aText);
37: }
38:
39: }
|