{"id":10228,"date":"2015-08-25T00:00:43","date_gmt":"2015-08-25T04:00:43","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/?p=10228"},"modified":"2015-08-24T08:42:54","modified_gmt":"2015-08-24T12:42:54","slug":"demonstrates-the-use-of-a-jcolorchooser-which-presents-a-dialog-with-three-different-tabbed-panes-to-allow-the-user-to-select-a-color-preference","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=10228","title":{"rendered":"Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference"},"content":{"rendered":"<p style=\"text-align: justify;\">Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference. The dialog returns a Color object based on the user&#8217;s selection or null if the user entered Cancel.<\/p>\n<pre>import java.awt.*;\r\nimport java.awt.event.*;\r\nimport javax.swing.*;\r\n\r\n\/** Simple example illustrating the use of JColorChooser. \r\n\u00a0*\r\n\u00a0*\u00a0 .\r\n\u00a0*\/\r\n\r\npublic class JColorChooserTest extends JFrame\r\n\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 implements ActionListener {\r\n\u00a0 public static void main(String[] args) {\r\n\u00a0\u00a0\u00a0 new JColorChooserTest();\r\n\u00a0 }\r\n\r\n\u00a0 public JColorChooserTest() {\r\n\u00a0\u00a0\u00a0 super(\"Using JColorChooser\");\r\n\u00a0\u00a0\u00a0 WindowUtilities.setNativeLookAndFeel();\r\n\u00a0\u00a0\u00a0 addWindowListener(new ExitListener());\r\n\u00a0\u00a0\u00a0 Container content = getContentPane();\r\n\u00a0\u00a0\u00a0 content.setBackground(Color.white);\r\n\u00a0\u00a0\u00a0 content.setLayout(new FlowLayout());\r\n\u00a0\u00a0\u00a0 JButton colorButton\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 = new JButton(\"Choose Background Color\");\r\n\u00a0\u00a0\u00a0 colorButton.addActionListener(this);\r\n\u00a0\u00a0\u00a0 content.add(colorButton);\r\n\u00a0\u00a0\u00a0 setSize(300, 100);\r\n\u00a0\u00a0\u00a0 setVisible(true);\r\n\u00a0 }\r\n\r\n\u00a0 public void actionPerformed(ActionEvent e) {\r\n\u00a0\u00a0\u00a0 \/\/ Args are parent component, title, initial color.\r\n\u00a0\u00a0\u00a0 Color bgColor\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 = JColorChooser.showDialog(this,\r\n\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 \"Choose Background Color\",\r\n\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 getBackground());\r\n\u00a0\u00a0\u00a0 if (bgColor != null)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 getContentPane().setBackground(bgColor);\r\n\u00a0 }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference. The dialog returns a Color object based on the user&#8217;s selection or null if the user entered Cancel. import java.awt.*; import java.awt.event.*; import javax.swing.*; \/** Simple example illustrating the use of &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=10228\">Continue reading<\/a><\/p>\n","protected":false},"author":130,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1417,1424],"tags":[706,308,285],"class_list":["post-10228","post","type-post","status-publish","format-standard","hentry","category-code-programming-samples--","category-javaj2eej2me","tag-code","tag-java","tag-285","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":10230,"url":"http:\/\/bangla.sitestree.com\/?p=10230","url_meta":{"origin":10228,"position":0},"title":"Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference","author":"","date":"August 25, 2015","format":false,"excerpt":"Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference. The dialog returns a Color object based on the user's selection or null if the user entered Cancel. \u00a0 import java.awt.*; import java.awt.event.*; import javax.swing.*; \/**\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":26916,"url":"http:\/\/bangla.sitestree.com\/?p=26916","url_meta":{"origin":10228,"position":1},"title":"Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference #Programming Code Examples #Java\/J2EE\/J2ME #Basic Swing","author":"Author-Check- Article-or-Video","date":"May 5, 2021","format":false,"excerpt":"Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference. The dialog returns a Color object based on the user's selection or null if the user entered Cancel. import java.awt.*; import java.awt.event.*; import javax.swing.*; \/** Simple\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":26918,"url":"http:\/\/bangla.sitestree.com\/?p=26918","url_meta":{"origin":10228,"position":2},"title":"Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference #Programming Code Examples #Java\/J2EE\/J2ME #Basic Swing","author":"Author-Check- Article-or-Video","date":"May 5, 2021","format":false,"excerpt":"Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference. The dialog returns a Color object based on the user's selection or null if the user entered Cancel. import java.awt.*; import java.awt.event.*; import javax.swing.*; \/** Simple\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":10214,"url":"http:\/\/bangla.sitestree.com\/?p=10214","url_meta":{"origin":10228,"position":3},"title":"Basic Swing Details","author":"","date":"August 25, 2015","format":false,"excerpt":"WindowUtilities.java Utility class that simplifies creating a window and setting the look and feel. ExitListener.java A WindowListener with support to close the window. JAppletExample.java A simple applet (JApplet) created in Swing. Illustrates setting the look and feel, adding components to the content pane, and changing the layout to FlowLayout (default\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":26896,"url":"http:\/\/bangla.sitestree.com\/?p=26896","url_meta":{"origin":10228,"position":4},"title":"Basic Swing Details #Programming Code Examples #Java\/J2EE\/J2ME #Basic Swing","author":"Author-Check- Article-or-Video","date":"May 4, 2021","format":false,"excerpt":"* WindowUtilities.java Utility class that simplifies creating a window and setting the look and feel. * ExitListener.java A WindowListener with support to close the window. * JAppletExample.java A simple applet (JApplet) created in Swing. Illustrates setting the look and feel, adding components to the content pane, and changing the layout\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":10341,"url":"http:\/\/bangla.sitestree.com\/?p=10341","url_meta":{"origin":10228,"position":5},"title":"A Frame that uses the Confirm dialog to verify quit","author":"","date":"August 27, 2015","format":false,"excerpt":"ConfirmTest.java **************** import java.awt.*; import java.awt.event.*; \/** A Frame that uses the Confirm dialog to verify that \u00a0*\u00a0 users really want to quit. \u00a0* \u00a0 public class ConfirmTest extends Frame { \u00a0 public static void main(String[] args) { \u00a0\u00a0\u00a0 new ConfirmTest(); \u00a0 } \u00a0 public ConfirmTest() { \u00a0\u00a0\u00a0 super(\"Confirming QUIT\");\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":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10228","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\/130"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10228"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10228\/revisions"}],"predecessor-version":[{"id":10229,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10228\/revisions\/10229"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10228"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}