{"id":27058,"date":"2021-05-09T23:10:06","date_gmt":"2021-05-10T03:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/an-applet-that-searches-multiple-search-engines-displaying-the-results-in-side-by-side-frame-cells-programming-code-examples-java-j2ee-j2me-applets-and-basic-graphics\/"},"modified":"2021-05-09T23:10:06","modified_gmt":"2021-05-10T03:10:06","slug":"an-applet-that-searches-multiple-search-engines-displaying-the-results-in-side-by-side-frame-cells-programming-code-examples-java-j2ee-j2me-applets-and-basic-graphics","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=27058","title":{"rendered":"An applet that searches multiple search engines, displaying the results in side-by-side frame cells. #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics"},"content":{"rendered":"<pre>\nUsing Applets as Front Ends to Server-Side Programs\n**************************************************\nSearchApplet.java An applet that searches multiple search engines,\n displaying the results in side-by-side frame cells. Uses the following files: \nSearchSpec.javaParallelSearches.htmlSearchAppletFrame.htmlGoogleResultsFrame.htmlInfoseekResultsFrame.htmlLycosResultsFrame.html\n***************************************************\n\/\/\nimport java.applet.Applet;\nimport java.awt.*;\nimport java.awt.event.*;\nimport java.net.*;\n\/\/\n\n\/** An applet that reads a value from a TextField,\n *  then uses it to build three distinct URLs with embedded\n *  GET data: one each for Google, Infoseek, and Lycos.\n *  The browser is directed to retrieve each of these\n *  URLs, displaying them in side-by-side frame cells.\n *  Note that standard HTML forms cannot automatically\n *  perform multiple submissions in this manner.\n *  <p>\n *  Taken from Core Web Programming Java 2 Edition\n *  from Prentice Hall and Sun Microsystems Press,\n\n *  May be freely used or adapted.\n *\/\n\npublic class SearchApplet extends Applet\n                          implements ActionListener {\n  private TextField queryField;\n  private Button submitButton;\n\n  public void init() {\n    setBackground(Color.white);\n    setFont(new Font(&quot;Serif&quot;, Font.BOLD, 18));\n    add(new Label(&quot;Search String:&quot;));\n    queryField = new TextField(40);\n    queryField.addActionListener(this);\n    add(queryField);\n    submitButton = new Button(&quot;Send to Search Engines&quot;);\n    submitButton.addActionListener(this);\n    add(submitButton);\n  }\n\n  \/** Submit data when button is pressed <b>or<\/b>\n   *  user presses Return in the TextField.\n   *\/\n  \n  public void actionPerformed(ActionEvent event) {\n    String query = URLEncoder.encode(queryField.getText());\n    SearchSpec[] commonSpecs = SearchSpec.getCommonSpecs();\n    \/\/ Omitting HotBot (last entry), as they use JavaScript to\n    \/\/ pop result to top-level frame. Thus the length-1 below.\n    for(int i=0; i&lt;commonspecs .length-1; i++) {\n      try {\n        SearchSpec spec = commonSpecs[i];\n        \/\/ The SearchSpec class builds URLs of the\n        \/\/ form needed by some common search engines.\n        URL searchURL = new URL(spec.makeURL(query, &quot;10&quot;));\n        String frameName = &quot;results&quot; + i;\n        getAppletContext().showDocument(searchURL, frameName);\n      } catch(MalformedURLException mue) {}\n    }\n  }\n}\n<\/p><\/pre>\n<p>Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From: http:\/\/sitestree.com\/?p=10211<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, Applets and Basic Graphics<br \/>Tags:Java\/J2EE\/J2MEApplets and Basic Graphics<br \/> Post Data:2017-01-02 16:04:23<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using Applets as Front Ends to Server-Side Programs ************************************************** SearchApplet.java An applet that searches multiple search engines, displaying the results in side-by-side frame cells. Uses the following files: SearchSpec.javaParallelSearches.htmlSearchAppletFrame.htmlGoogleResultsFrame.htmlInfoseekResultsFrame.htmlLycosResultsFrame.html *************************************************** \/\/ import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.net.*; \/\/ \/** An applet that reads a value from a TextField, * then uses it to &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=27058\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-27058","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":10419,"url":"http:\/\/bangla.sitestree.com\/?p=10419","url_meta":{"origin":27058,"position":0},"title":"An applet that searches multiple search engines, displaying the results in side-by-side frame cells.","author":"","date":"August 28, 2015","format":false,"excerpt":"Using Applets as Front Ends to Server-Side Programs ************************************************** SearchApplet.java An applet that searches multiple search engines, \u00a0displaying the results in side-by-side frame cells. Uses the following files: SearchSpec.javaParallelSearches.htmlSearchAppletFrame.htmlGoogleResultsFrame.htmlInfoseekResultsFrame.htmlLycosResultsFrame.html *************************************************** \/\/ import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.net.*; \/\/ \/** An applet that reads a value from a TextField,\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27148,"url":"http:\/\/bangla.sitestree.com\/?p=27148","url_meta":{"origin":27058,"position":1},"title":"Basic template for a Java applet #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 12, 2021","format":false,"excerpt":"AppletTemplate.java >>>>>>>>>>>>>>>>>>>> import java.applet.Applet; import java.awt.*; ******************** public class AppletTemplate extends Applet { \/\/ Variable declarations. public void init() { \/\/ Variable initializations, image loading, etc. } public void paint(Graphics g) { \/\/ Drawing operations. } } >>>>>>>>>>>>>>>>>>>>> Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From:\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27150,"url":"http:\/\/bangla.sitestree.com\/?p=27150","url_meta":{"origin":27058,"position":2},"title":"HelloWWW2.java Illustrates the ability of an applet to read parameters contained in the HTML document #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 12, 2021","format":false,"excerpt":"HelloWWW2.java Illustrates the ability of an applet to read parameters contained in the HTML document (PARAM element containing a NAME-VALUE pair). &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& import java.applet.Applet; import java.awt.*; ************************* public class HelloWWW2 extends Applet { public void init() { setFont(new Font(\"SansSerif\", Font.BOLD, 30)); Color background = Color.gray; Color foreground = Color.darkGray; String\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27152,"url":"http:\/\/bangla.sitestree.com\/?p=27152","url_meta":{"origin":27058,"position":3},"title":"Loading Images #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 12, 2021","format":false,"excerpt":"JavaMan1.java Applet that loads an image from a relative URL. ************************************************************* import java.applet.Applet; import java.awt.*; \/** An applet that loads an image from a relative URL. * >>>>>>>>>>>>>>>>>>> public class JavaMan1 extends Applet { private Image javaMan; public void init() { javaMan = getImage(getCodeBase(),\"images\/Java-Man.gif\"); } public void paint(Graphics g) {\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27062,"url":"http:\/\/bangla.sitestree.com\/?p=27062","url_meta":{"origin":27058,"position":4},"title":"An applet that reads arrays of strings packaged inside a QueryCollection and places them in a scrolling TextArea. #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 9, 2021","format":false,"excerpt":"import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.net.*; \/** Applet reads arrays of strings packaged inside * a QueryCollection and places them in a scrolling * TextArea. The QueryCollection obtains the strings * by means of a serialized object input stream * connected to the QueryGenerator servlet. * * Taken\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27154,"url":"http:\/\/bangla.sitestree.com\/?p=27154","url_meta":{"origin":27058,"position":5},"title":"Controlling Image Loading #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 12, 2021","format":false,"excerpt":"~~~~~~~~~~~~~~~~~~~ ImageBox.java A class that incorrectly tries to load an image and draw an outline around it. The problem is that the size of the image is requested before the image is completely loaded, thus, returning a width and height of -1. ~~~~~~~~~~~~~~~~~~~ import java.applet.Applet; import java.awt.*; \/** A class\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/27058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27058"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/27058\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27058"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}