From: Steve F. <sm...@us...> - 2002-08-04 01:41:51
|
Update of /cvsroot/mockobjects/no-stone-unturned/src/nostone/gui In directory usw-pr-cvs1:/tmp/cvs-serv30310/src/nostone/gui Modified Files: Searcher.java Directory.java Log Message: More on GUI testing Index: Searcher.java =================================================================== RCS file: /cvsroot/mockobjects/no-stone-unturned/src/nostone/gui/Searcher.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Searcher.java 3 Aug 2002 22:22:59 -0000 1.2 +++ Searcher.java 4 Aug 2002 01:41:47 -0000 1.3 @@ -7,7 +7,7 @@ import java.awt.event.*; public class Searcher extends JFrame { - public Searcher(Directory directory) throws HeadlessException { + public Searcher(final Directory directory) throws HeadlessException { super("Searcher"); JButton searchButton = new JButton("Search"); @@ -16,19 +16,32 @@ final JLabel statusBar = new JLabel(" "); statusBar.setName("status"); + final JTextArea results = new JTextArea(); + results.setName("results"); + searchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - statusBar.setText("No entries found"); + String result = directory.lookFor(""); + if (null == result) { + statusBar.setText("No entries found"); + } else { + results.setText(result); + } } }); getContentPane().add(searchButton, BorderLayout.NORTH); + getContentPane().add(results, BorderLayout.CENTER); getContentPane().add(statusBar, BorderLayout.SOUTH); pack(); } static public void main(String[] args) { - Searcher searcher = new Searcher(new Directory() {}); + Searcher searcher = new Searcher(new Directory() { + public String lookFor(String searchString) { + return "One Result"; + } + }); searcher.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Window w = e.getWindow(); Index: Directory.java =================================================================== RCS file: /cvsroot/mockobjects/no-stone-unturned/src/nostone/gui/Directory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Directory.java 3 Aug 2002 22:22:59 -0000 1.1 +++ Directory.java 4 Aug 2002 01:41:47 -0000 1.2 @@ -1,4 +1,5 @@ package nostone.gui; public interface Directory { + String lookFor(String searchString); } |