{"id":26928,"date":"2021-05-05T23:10:06","date_gmt":"2021-05-06T03:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/simple-example-illustrating-the-use-of-check-boxes-programming-code-examples-java-j2ee-j2me-basic-swing\/"},"modified":"2021-05-05T23:10:06","modified_gmt":"2021-05-06T03:10:06","slug":"simple-example-illustrating-the-use-of-check-boxes-programming-code-examples-java-j2ee-j2me-basic-swing","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=26928","title":{"rendered":"Simple example illustrating the use of check boxes #Programming Code Examples #Java\/J2EE\/J2ME #Basic Swing"},"content":{"rendered":"<pre>\nJCheckBoxTest.java Simple example illustrating the use of check boxes. \nimport javax.swing.*; \nimport java.awt.event.*;\n\n *\/\n\npublic class JCheckBoxTest extends JPanel \n                           implements ItemListener, \n                                      ActionListener{\n  JCheckBox checkBox1, checkBox2;\n   \n  public JCheckBoxTest() {\n    checkBox1 = new JCheckBox(&quot;Java Servlets&quot;);\n    checkBox2 = new JCheckBox(&quot;JavaServer Pages&quot;);\n    checkBox1.setContentAreaFilled(false);\n    checkBox2.setContentAreaFilled(false);\n   \n    checkBox1.addItemListener(this);\n    checkBox2.addActionListener(this);\n      \n    add(checkBox1);\n    add(checkBox2);\n  }\n   \n  public void actionPerformed(ActionEvent event) {\n    System.out.println(&quot;JavaServer Pages selected: &quot; + \n                        checkBox2.isSelected());\n  }\n   \n  public void itemStateChanged(ItemEvent event) {\n    JCheckBox checkbox = (JCheckBox)event.getItem();\n      \n    if (event.getStateChange() == ItemEvent.SELECTED) {\n      System.out.println(checkbox.getText() + &quot; selected.&quot;);\n    } else {\n      System.out.println(checkbox.getText() + &quot; deselected.&quot;);\n    }\n  }  \n   \n  public static void main(String[] args) {\n    JPanel panel = new JCheckBoxTest();\n    WindowUtilities.setNativeLookAndFeel();\n    WindowUtilities.openInJFrame(panel, 300, 75);\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=10317<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, Basic Swing<br \/>Tags:Java\/J2EE\/J2MEBasic Swing<br \/> Post Data:2017-01-02 16:04:31<\/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>JCheckBoxTest.java Simple example illustrating the use of check boxes. import javax.swing.*; import java.awt.event.*; *\/ public class JCheckBoxTest extends JPanel implements ItemListener, ActionListener{ JCheckBox checkBox1, checkBox2; public JCheckBoxTest() { checkBox1 = new JCheckBox(&quot;Java Servlets&quot;); checkBox2 = new JCheckBox(&quot;JavaServer Pages&quot;); checkBox1.setContentAreaFilled(false); checkBox2.setContentAreaFilled(false); checkBox1.addItemListener(this); checkBox2.addActionListener(this); add(checkBox1); add(checkBox2); } public void actionPerformed(ActionEvent event) { System.out.println(&quot;JavaServer Pages selected: &quot; + &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=26928\">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-26928","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":10241,"url":"http:\/\/bangla.sitestree.com\/?p=10241","url_meta":{"origin":26928,"position":0},"title":"Simple example illustrating the use of check boxes","author":"","date":"August 25, 2015","format":false,"excerpt":"JCheckBoxTest.java Simple example illustrating the use of check boxes. import javax.swing.*; import java.awt.event.*; \u00a0*\/ public class JCheckBoxTest extends JPanel \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 implements ItemListener, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ActionListener{ \u00a0 JCheckBox checkBox1, checkBox2; \u00a0 \u00a0 \u00a0 public JCheckBoxTest() { \u00a0\u00a0\u00a0 checkBox1 = new JCheckBox(\"Java Servlets\"); \u00a0\u00a0\u00a0 checkBox2 = new JCheckBox(\"JavaServer Pages\"); \u00a0\u00a0\u00a0 checkBox1.setContentAreaFilled(false); \u00a0\u00a0\u00a0 checkBox2.setContentAreaFilled(false);\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":10232,"url":"http:\/\/bangla.sitestree.com\/?p=10232","url_meta":{"origin":26928,"position":1},"title":"mall example showing the basic use of a JToolBar","author":"","date":"August 25, 2015","format":false,"excerpt":"mall example showing the basic use of a JToolBar import java.awt.*; import javax.swing.*; import java.awt.event.*; \/** Small example showing basic use of JToolBar. \u00a0* \u00a0* \u00a0*\/ public class JToolBarExample extends JFrame \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 implements ItemListener { \u00a0 private BrowserToolBar toolbar; \u00a0 private JCheckBox labelBox; \u00a0 public static void main(String[] args) {\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":26920,"url":"http:\/\/bangla.sitestree.com\/?p=26920","url_meta":{"origin":26928,"position":2},"title":"mall example showing the basic use of a JToolBar #Programming Code Examples #Java\/J2EE\/J2ME #Basic Swing","author":"Author-Check- Article-or-Video","date":"May 5, 2021","format":false,"excerpt":"mall example showing the basic use of a JToolBar import java.awt.*; import javax.swing.*; import java.awt.event.*; \/** Small example showing basic use of JToolBar. * * *\/ public class JToolBarExample extends JFrame implements ItemListener { private BrowserToolBar toolbar; private JCheckBox labelBox; public static void main(String[] args) { new JToolBarExample(); } public\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":26948,"url":"http:\/\/bangla.sitestree.com\/?p=26948","url_meta":{"origin":26928,"position":3},"title":"Creates three radio buttons and illustrates handling #Programming Code Examples #Java\/J2EE\/J2ME #Basic Swing","author":"Author-Check- Article-or-Video","date":"May 6, 2021","format":false,"excerpt":"JRadioButtonTest.java Creates three radio buttons and illustrates handling ItemEvents in response to selecting a radio button. import javax.swing.JRadioButton; import javax.swing.ButtonGroup; import java.awt.*; import java.awt.event.*; import javax.swing.*; \/** *\/ public class JRadioButtonTest extends JPanel implements ItemListener { public JRadioButtonTest() { String[] labels = {\"Java Swing\",\"Java Servlets\", \"JavaServer Pages\"}; JRadioButton[] buttons =\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":10239,"url":"http:\/\/bangla.sitestree.com\/?p=10239","url_meta":{"origin":26928,"position":4},"title":"Simple button that the user can select to load the entered URL.","author":"","date":"August 25, 2015","format":false,"excerpt":"JIconButton.java A simple button that the user can select to load the entered URL. import javax.swing.*; \/** A regular JButton created with an ImageIcon and with borders \u00a0*\u00a0 and content areas turned off. \u00a0* \u00a0 *\/ public class JIconButton extends JButton { \u00a0 public JIconButton(String file) { \u00a0\u00a0\u00a0 super(new ImageIcon(file));\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":26926,"url":"http:\/\/bangla.sitestree.com\/?p=26926","url_meta":{"origin":26928,"position":5},"title":"Simple button that the user can select to load the entered URL. #Programming Code Examples #Java\/J2EE\/J2ME #Basic Swing","author":"Author-Check- Article-or-Video","date":"May 5, 2021","format":false,"excerpt":"JIconButton.java A simple button that the user can select to load the entered URL. import javax.swing.*; \/** A regular JButton created with an ImageIcon and with borders * and content areas turned off. * *\/ public class JIconButton extends JButton { public JIconButton(String file) { super(new ImageIcon(file)); setContentAreaFilled(false); setBorderPainted(false); setFocusPainted(false);\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\/26928","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=26928"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26928\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26928"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}