B
Brenton Fletcher
Hello
I am creating a Java program to search the internet.
+--------------+ +----------------------------------+
|GoogleSearcher| |Utilities |
|extends JFrame| |doSearch(Search s, String browser)|
+--------------+ +----------------------------------+
+--------+
|Search |
|getURL()|
+--------+
||
\/
+------------+
|GoogleSearch|
+------------+
Here is an excerpt from GoogleSearcher:
when button is clicked, Utilities.doSearch(new GoogleSearch("Hello World!"), "C:\Program Files\Internet Explorer\IEXPLORE.EXE");
Utilities.doSearch(Search s, String browser) calles Runtime.exec(browser + " \"" + s.getURL() + "\"");
This opens a new browser window, with the search url as its url.
What I want is an OOP way to have CompletelyDifferentParamtetersSearcher, YahooSearcher, and FooBarSearcher, perhaps with an abstract base class? The CompletelyDifferentParameterSearcher, for example, might have different options that need to be displayed in the Searcher window, different options to GoogleSearcher, or YahooSearcher. Currently, a new instance of GoogleSearcher is created when the user clicks a button.
Any help would be appreaciated.
B.F.
I am creating a Java program to search the internet.
+--------------+ +----------------------------------+
|GoogleSearcher| |Utilities |
|extends JFrame| |doSearch(Search s, String browser)|
+--------------+ +----------------------------------+
+--------+
|Search |
|getURL()|
+--------+
||
\/
+------------+
|GoogleSearch|
+------------+
Here is an excerpt from GoogleSearcher:
when button is clicked, Utilities.doSearch(new GoogleSearch("Hello World!"), "C:\Program Files\Internet Explorer\IEXPLORE.EXE");
Utilities.doSearch(Search s, String browser) calles Runtime.exec(browser + " \"" + s.getURL() + "\"");
This opens a new browser window, with the search url as its url.
What I want is an OOP way to have CompletelyDifferentParamtetersSearcher, YahooSearcher, and FooBarSearcher, perhaps with an abstract base class? The CompletelyDifferentParameterSearcher, for example, might have different options that need to be displayed in the Searcher window, different options to GoogleSearcher, or YahooSearcher. Currently, a new instance of GoogleSearcher is created when the user clicks a button.
Any help would be appreaciated.
B.F.