AnsweredAssumed Answered

browser problem with self-made "google-search"-plugin

Question asked by honkidonki on Sep 18, 2007

 

Hello.

 

 

As the subject line says, I've made a little google-search plugin with the help of spark's development kit. actually it works fine. the only problem is, that when my favourite browser is set to Firefox, the JBrowser function throws out a grey empty window. But when my favourite browser is set to Internet Explorer, the JBrowser function shows correctly a window with the google search with the query, which has been written down within the spark search.

My question is, if there is a possibility to make this code work also with Firefox set as the favourite Browser.

I would be very grateful for any helpful hints and/or ideas.

 

 

with kind regards,

honkidonki

 

 

MY CODE:

 

 

 

public class MyPlugin implements Plugin {

 

 

.....

 

 

public void initialize() {

        ......

        SearchManager searchManager = SparkManager.getSearchManager();

        searchManager.addSearchService(new SearchMe());

 

    }

 

 

.....

 

 

public class SearchMe implements Searchable {

 

        /**

          

  • The icon to show in the search box.

          

  • @return the icon.

         */

        public Icon getIcon() {

            return SparkRes.getImageIcon(SparkRes.SMALL_AGENT_IMAGE);

        }

 

        /**

          

  • Returns the name of this search object that is displayed in the drop down box.

          

  • @return the name.

         */

        public String getName() {

            return "Google-Search";

        }

 

        /**

          

  • Returns the text that should be displayed in grey when this searchable object

          

  • is initially selected.

          

  • @return the text.

         */

        public String getDefaultText() {

            return "Use Google-Search";

        }

 

        /**

          

  • Returns the text to display in the tooltip.

          

  • @return the tooltip text.

         */

        public String getToolTip() {

            return "Google-Search";

        }

 

        /**

          

  • Is called when a user hits "Enter" key.

          

  • @param query the query the user is searching for.

         */

 

        public void search(String query) {

 

 

            String messageText = "Google-Suche";

            final JFrame frame =  new JFrame(messageText);   

 

            WebBrowser webBrowser = new WebBrowser();

            webBrowser.setSize(700,500);

 

 

            try {

 

                webBrowser.setURL(new URL("http://www.google.com/search?q="+query));

            }

 

            catch (MalformedURLException e) {

                System.out.println(e.getMessage());

            }

 

            frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

 

            frame.add(webBrowser);

            frame.pack();

            frame.setVisible(true);

 

 

            }

 

    }

 

}

Outcomes