{"id":10235,"date":"2015-08-25T07:16:57","date_gmt":"2015-08-25T11:16:57","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/?p=10235"},"modified":"2015-08-24T08:43:29","modified_gmt":"2015-08-24T12:43:29","slug":"a-simple-button-that-contains-an-image-and-a-label-for-use-in-a-toolbar","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=10235","title":{"rendered":"A simple button that contains an image and a label for use in a toolbar"},"content":{"rendered":"<pre>ToolBarButton.java A simple button that contains an image and a label for use in a toolbar. \r\nimport java.awt.*;\r\nimport javax.swing.*;\r\n\r\n\/** Part of a small example showing basic use of JToolBar.\r\n\u00a0*\u00a0 The point here is that dropping a regular JButton in a\r\n\u00a0*\u00a0 JToolBar (or adding an Action) in JDK 1.2 doesn't give \r\n\u00a0*\u00a0 you what you want -- namely, a small button just enclosing\r\n\u00a0*\u00a0 the icon, and with text labels (if any) below the icon,\r\n\u00a0*\u00a0 not to the right of it. In JDK 1.3, if you add an Action\r\n\u00a0*\u00a0 to the toolbar, the Action label is no longer displayed.\r\n\u00a0*\r\n\u00a0 *\/\r\n\r\npublic class ToolBarButton extends JButton {\r\n\u00a0 private static final Insets margins =\r\n\u00a0\u00a0\u00a0 new Insets(0, 0, 0, 0);\r\n\r\n\u00a0 public ToolBarButton(Icon icon) {\r\n\u00a0\u00a0\u00a0 super(icon);\r\n\u00a0\u00a0\u00a0 setMargin(margins);\r\n\u00a0\u00a0\u00a0 setVerticalTextPosition(BOTTOM);\r\n\u00a0\u00a0\u00a0 setHorizontalTextPosition(CENTER);\r\n\u00a0 }\r\n\r\n\u00a0 public ToolBarButton(String imageFile) {\r\n\u00a0\u00a0\u00a0 this(new ImageIcon(imageFile));\r\n\u00a0 }\r\n\r\n\u00a0 public ToolBarButton(String imageFile, String text) {\r\n\u00a0\u00a0\u00a0 this(new ImageIcon(imageFile));\r\n\u00a0\u00a0\u00a0 setText(text);\r\n\u00a0 }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>ToolBarButton.java A simple button that contains an image and a label for use in a toolbar. import java.awt.*; import javax.swing.*; \/** Part of a small example showing basic use of JToolBar. \u00a0*\u00a0 The point here is that dropping a regular JButton in a \u00a0*\u00a0 JToolBar (or adding an Action) in JDK 1.2 doesn&#8217;t give \u00a0*\u00a0 &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=10235\">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-10235","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":26922,"url":"http:\/\/bangla.sitestree.com\/?p=26922","url_meta":{"origin":10235,"position":0},"title":"A simple button that contains an image and a label for use in a toolbar #Programming Code Examples #Java\/J2EE\/J2ME #Basic Swing","author":"Author-Check- Article-or-Video","date":"May 5, 2021","format":false,"excerpt":"ToolBarButton.java A simple button that contains an image and a label for use in a toolbar. import java.awt.*; import javax.swing.*; \/** Part of a small example showing basic use of JToolBar. * The point here is that dropping a regular JButton in a * JToolBar (or adding an Action) in\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":10237,"url":"http:\/\/bangla.sitestree.com\/?p=10237","url_meta":{"origin":10235,"position":1},"title":"Basic tool bar for holding multiple buttons.","author":"","date":"August 25, 2015","format":false,"excerpt":"BrowserToolBar.java A basic tool bar for holding multiple buttons. import java.awt.*; import javax.swing.*; \/** Part of a small example showing basic use of JToolBar. \u00a0*\u00a0 Creates a small dockable toolbar that is supposed to look \u00a0*\u00a0 vaguely like one that might come with a Web browser. \u00a0*\u00a0 Makes use of\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":26924,"url":"http:\/\/bangla.sitestree.com\/?p=26924","url_meta":{"origin":10235,"position":2},"title":"Basic tool bar for holding multiple buttons. #Programming Code Examples #Java\/J2EE\/J2ME #Basic Swing","author":"Author-Check- Article-or-Video","date":"May 5, 2021","format":false,"excerpt":"BrowserToolBar.java A basic tool bar for holding multiple buttons. import java.awt.*; import javax.swing.*; \/** Part of a small example showing basic use of JToolBar. * Creates a small dockable toolbar that is supposed to look * vaguely like one that might come with a Web browser. * Makes use of\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":10232,"url":"http:\/\/bangla.sitestree.com\/?p=10232","url_meta":{"origin":10235,"position":3},"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":10235,"position":4},"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":10271,"url":"http:\/\/bangla.sitestree.com\/?p=10271","url_meta":{"origin":10235,"position":5},"title":"Printing in Java 2","author":"","date":"August 26, 2015","format":false,"excerpt":"\u00a0\u00a0 * \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 o PrintExample.java Demonstrates printing a Graphics2D object. import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.print.*; \/** An example of a printable window in Java 1.2. The key point \u00a0*\u00a0 here is that any component is printable in Java 1.2. \u00a0*\u00a0 However, you have to be careful to\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\/10235","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=10235"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10235\/revisions"}],"predecessor-version":[{"id":10236,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10235\/revisions\/10236"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10235"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}