{"id":26818,"date":"2021-05-02T23:10:05","date_gmt":"2021-05-03T03:10:05","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/pluginapplet-jsp-page-that-demonstrates-the-use-of-jspplugin-programming-code-examples-java-j2ee-j2me-jsp\/"},"modified":"2021-05-02T23:10:05","modified_gmt":"2021-05-03T03:10:05","slug":"pluginapplet-jsp-page-that-demonstrates-the-use-of-jspplugin-programming-code-examples-java-j2ee-j2me-jsp","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=26818","title":{"rendered":"PluginApplet.jsp  Page that demonstrates the use of jsp:plugin. #Programming Code Examples #Java\/J2EE\/J2ME #JSP"},"content":{"rendered":"<pre>\nPluginApplet.jsp  Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java  Since these are classes sent to the client to used by applets, the .class files should be in the same directory as the JSP page, not in the WEB-INF\/classes directory where classes the server uses go. Uses the JSP-Styles  style sheet. Warning: Allaire JRun 3.0 SP2 does not properly support jsp:plugin.\n\n\n&lt;!DOCTYPE HTML PUBLIC &quot;-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN&quot;&gt;\n&lt;!-- \nExample of using jsp:plugin for an applet that uses Java 2. \n\nTaken from Core Web Programming Java 2 Edition\nfrom Prentice Hall and Sun Microsystems Press,\n.\nMay be freely used or adapted.\n--&gt;\n&lt;HTML&gt;\n&lt;HEAD&gt;\n&lt;TITLE&gt;Using jsp:plugin&lt;\/TITLE&gt;\n&lt;LINK REL=STYLESHEET\n      HREF=&quot;JSP-Styles.css&quot;\n      TYPE=&quot;text\/css&quot;&gt;\n&lt;\/HEAD&gt;\n\n&lt;BODY&gt;\n\n&lt;TABLE BORDER=5 ALIGN=&quot;CENTER&quot;&gt;\n  &lt;TR&gt;&lt;TH CLASS=&quot;TITLE&quot;&gt;\n      Using jsp:plugin&lt;\/TABLE&gt;\n&lt;P&gt;\n&lt;CENTER&gt;\n&lt;jsp:plugin type=&quot;applet&quot; \n            code=&quot;PluginApplet.class&quot;\n            width=&quot;370&quot; height=&quot;420&quot;&gt;\n&lt;\/jsp:plugin&gt;\n&lt;\/CENTER&gt;\n\n&lt;\/BODY&gt;\n&lt;\/HTML&gt;\n\nPluginApplet.java\n\nimport javax.swing.*;\n\n\/** An applet that uses Swing and Java 2D and thus requires\n *  the Java Plug-In.\n *  &lt;P&gt;\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 PluginApplet extends JApplet {\n  public void init() {\n    WindowUtilities.setNativeLookAndFeel();\n    setContentPane(new TextPanel());\n  }\n}\n\n\nTextPanel.java\nimport java.awt.*;\nimport java.awt.event.*;\nimport javax.swing.*;\n\n\/** JPanel that places a panel with text drawn at various angles\n *  in the top part of the window and a JComboBox containing\n *  font choices in the bottom part.\n *  &lt;P&gt;\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 TextPanel extends JPanel\n                       implements ActionListener {\n  private JComboBox fontBox;\n  private DrawingPanel drawingPanel;\n\n  public TextPanel() {\n    GraphicsEnvironment env =\n      GraphicsEnvironment.getLocalGraphicsEnvironment();\n    String[] fontNames = env.getAvailableFontFamilyNames();\n    fontBox = new JComboBox(fontNames);\n    setLayout(new BorderLayout());\n    JPanel fontPanel = new JPanel();\n    fontPanel.add(new JLabel(&quot;Font:&quot;));\n    fontPanel.add(fontBox);\n    JButton drawButton = new JButton(&quot;Draw&quot;);\n    drawButton.addActionListener(this);\n    fontPanel.add(drawButton);\n    add(fontPanel, BorderLayout.SOUTH);\n    drawingPanel = new DrawingPanel();\n    fontBox.setSelectedItem(&quot;Serif&quot;);\n    drawingPanel.setFontName(&quot;Serif&quot;);\n    add(drawingPanel, BorderLayout.CENTER);\n  }\n\n  public void actionPerformed(ActionEvent e) {\n    drawingPanel.setFontName((String)fontBox.getSelectedItem());\n    drawingPanel.repaint();\n  }\n}\n\n\nDrawingPanel.java\nimport java.awt.*;\nimport java.awt.geom.*;\nimport javax.swing.*;\n\n\/** A window with text drawn at an angle. The font is\n *  set by means of the setFontName method.\n *  &lt;P&gt;\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\nclass DrawingPanel extends JPanel {\n  private Ellipse2D.Double circle =\n    new Ellipse2D.Double(10, 10, 350, 350);\n  private GradientPaint gradient =\n    new GradientPaint(0, 0, Color.red, 180, 180, Color.yellow,\n                      true); \/\/ true means to repeat pattern\n  private Color[] colors = { Color.white, Color.black };\n\n  public void paintComponent(Graphics g) {\n    super.paintComponent(g);\n    Graphics2D g2d = (Graphics2D)g;\n    g2d.setPaint(gradient);\n    g2d.fill(circle);\n    g2d.translate(185, 185);\n    for (int i=0; i&lt;16; i++) {\n      g2d.rotate(Math.PI\/8.0);\n      g2d.setPaint(colors[i%2]);\n      g2d.drawString(&quot;jsp:plugin&quot;, 0, 0);\n    }\n  }\n\n  public void setFontName(String fontName) {\n    setFont(new Font(fontName, Font.BOLD, 35));\n  }\n}\n\n\nWindowUtilities.java\n\nimport javax.swing.*;\nimport java.awt.*;\n\n\/** A few utilities that simplify using windows in Swing.\n *  &lt;P&gt;\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 WindowUtilities {\n\n  \/** Tell system to use native look and feel, as in previous\n   *  releases. Metal (Java) LAF is the default otherwise.\n   *\/\n\n  public static void setNativeLookAndFeel() {\n    try {\n      UIManager.setLookAndFeel\n        (UIManager.getSystemLookAndFeelClassName());\n    } catch(Exception e) {\n      System.out.println(&quot;Error setting native LAF: &quot; + e);\n    }\n  }\n\n  public static void setJavaLookAndFeel() {\n    try {\n      UIManager.setLookAndFeel\n        (UIManager.getCrossPlatformLookAndFeelClassName());\n    } catch(Exception e) {\n      System.out.println(&quot;Error setting Java LAF: &quot; + e);\n    }\n  }\n\n  public static void setMotifLookAndFeel() {\n    try {\n      UIManager.setLookAndFeel\n        (&quot;com.sun.java.swing.plaf.motif.MotifLookAndFeel&quot;);\n    } catch(Exception e) {\n      System.out.println(&quot;Error setting Motif LAF: &quot; + e);\n    }\n  }\n\n  \/** A simplified way to see a JPanel or other Container.\n   *  Pops up a JFrame with specified Container\n   *  as the content pane.\n   *\/\n\n  public static JFrame openInJFrame(Container content,\n                                    int width,\n                                    int height,\n                                    String title,\n                                    Color bgColor) {\n    JFrame frame = new JFrame(title);\n    frame.setBackground(bgColor);\n    content.setBackground(bgColor);\n    frame.setSize(width, height);\n    frame.setContentPane(content);\n    frame.addWindowListener(new ExitListener());\n    frame.setVisible(true);\n    return(frame);\n  }\n\n  \/** Uses Color.white as the background color. *\/\n\n  public static JFrame openInJFrame(Container content,\n                                    int width,\n                                    int height,\n                                    String title) {\n    return(openInJFrame(content, width, height, title, Color.white));\n  }\n\n  \/** Uses Color.white as the background color, and the\n   *  name of the Container's class as the JFrame title.\n   *\/\n\n  public static JFrame openInJFrame(Container content,\n                                    int width,\n                                    int height) {\n    return(openInJFrame(content, width, height,\n                        content.getClass().getName(),\n                        Color.white));\n  }\n}\n\n\n\n<\/pre>\n<p>Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From: http:\/\/sitestree.com\/?p=10261<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, JSP<br \/>Tags:Java\/J2EE\/J2MEJSP<br \/> Post Data:2017-01-02 16:04:28<\/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>PluginApplet.jsp Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java Since these are classes sent to the client to used by applets, the .class files should be in the same directory as the JSP page, not in the WEB-INF\/classes directory where classes the server uses go. &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=26818\">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-26818","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":26793,"url":"http:\/\/bangla.sitestree.com\/?p=26793","url_meta":{"origin":26818,"position":0},"title":"Expressions.jsp  Page that demonstrates JSP expressions. Uses the JSP-Styles  style sheet. #Programming Code Examples #Java\/J2EE\/J2ME #JSP","author":"Author-Check- Article-or-Video","date":"May 1, 2021","format":false,"excerpt":"Expressions.jsp Page that demonstrates JSP expressions. Uses the JSP-Styles style sheet. <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Example of JSP Expressions. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. --> <HTML> <HEAD> <TITLE>JSP Expressions<\/TITLE>\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":10132,"url":"http:\/\/bangla.sitestree.com\/?p=10132","url_meta":{"origin":26818,"position":1},"title":"Expressions.jsp Page that demonstrates JSP expressions. Uses the JSP-Styles style sheet.","author":"","date":"July 29, 2015","format":false,"excerpt":"Expressions.jsp\u00a0 Page that demonstrates JSP expressions. Uses the JSP-Styles\u00a0 style sheet. <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Example of JSP Expressions. \u00a0 \u00a0 Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. --> <HTML> <HEAD>\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":10135,"url":"http:\/\/bangla.sitestree.com\/?p=10135","url_meta":{"origin":26818,"position":2},"title":"Expressions.jsp Page that demonstrates JSP expressions. Uses the JSP-Styles style sheet.","author":"","date":"August 9, 2015","format":false,"excerpt":"Expressions.jsp\u00a0 Page that demonstrates JSP expressions. Uses the JSP-Styles\u00a0 style sheet. <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Example of JSP Expressions. \u00a0 \u00a0 Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. --> <HTML> <HEAD>\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":26810,"url":"http:\/\/bangla.sitestree.com\/?p=26810","url_meta":{"origin":26818,"position":3},"title":"BGColor.jsp  Page that demonstrates JSP scriptlets. Uses the JSP-Styles  style sheet. #Programming Code Examples #Java\/J2EE\/J2ME #JSP","author":"Author-Check- Article-or-Video","date":"May 2, 2021","format":false,"excerpt":"BGColor.jsp Page that demonstrates JSP scriptlets. Uses the JSP-Styles style sheet. <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. --> <HTML> <HEAD> <TITLE>Color Testing<\/TITLE> <\/HEAD> <% String bgColor\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":10137,"url":"http:\/\/bangla.sitestree.com\/?p=10137","url_meta":{"origin":26818,"position":4},"title":"BGColor.jsp Page that demonstrates JSP scriptlets. Uses the JSP-Styles style sheet.","author":"","date":"August 10, 2015","format":false,"excerpt":"BGColor.jsp\u00a0 Page that demonstrates JSP scriptlets. Uses the JSP-Styles\u00a0 style sheet. <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!--\u00a0\u00a0 \u00a0 Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. --> <HTML> <HEAD> \u00a0 <TITLE>Color Testing<\/TITLE> <\/HEAD> <%\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":26814,"url":"http:\/\/bangla.sitestree.com\/?p=26814","url_meta":{"origin":26818,"position":5},"title":"ImportAttribute.jsp  Page that demonstrates the import attribute of the page directive. Uses the ServletUtilities class #Programming Code Examples #Java\/J2EE\/J2ME #JSP","author":"Author-Check- Article-or-Video","date":"May 2, 2021","format":false,"excerpt":"ImportAttribute.jsp Page that demonstrates the import attribute of the page directive. Uses the ServletUtilities class (Check Servlet Section) <!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"> <!-- Example of the import attribute of the page directive. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press,\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\/26818","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=26818"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26818\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26818"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}