<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-305516462606604883</id><updated>2011-12-23T23:31:02.478-08:00</updated><category term='resize'/><category term='package'/><category term='super'/><category term='chapter'/><category term='Overriding'/><category term='PIXEL'/><category term='struts2'/><category term='io system'/><category term='border'/><category term='array'/><category term='autocompleter'/><category term='SCJP 1.5'/><category term='exceptions'/><category term='inheritance'/><category term='fundamentals'/><category term='OBJECT'/><category term='Game Java 240x320'/><category term='PALINDROME'/><category term='Game Sony Ericsson'/><category term='History'/><category term='diagrams'/><category term='JSONObject'/><category term='TERNARY OPERATOR'/><category term='abstract'/><category term='jQuery'/><category term='threads'/><category term='flow control'/><category term='jpeg'/><category term='RADIANS'/><category term='string tokenizer'/><category term='SORT'/><category term='OPERATOR'/><category term='HEXADECIMAL TO BINARY'/><category term='DETERMINE'/><category term='richtext'/><category term='ALPHABET'/><category term='SCJP 1.4'/><category term='dojo'/><category term='integration'/><category term='form validation'/><category term='jlable'/><category term='SCREEN'/><category term='final'/><category term='showcase'/><category term='GET'/><category term='Game Java 176x208'/><category term='eamcet'/><category term='inner class'/><category term='jqueryui'/><category term='JAVA'/><category term='sub class'/><category term='DEGREE'/><category term='modifier'/><category term='COMPONENT'/><category term='classpath'/><category term='SCJP'/><category term='collection'/><category term='MOVE'/><category term='swings'/><category term='CHANGE'/><category term='grid'/><category term='interface'/><category term='jmjrst'/><category term='SIMPLE'/><category term='results'/><category term='plugin'/><category term='CURSOR'/><category term='GATE'/><category term='CLASS'/><category term='JAUTORUNKILLER'/><category term='PLAY'/><category term='WAV'/><category term='casting'/><category term='JSON'/><category term='Game Java 176x220'/><category term='STRING'/><category term='java.lang'/><category term='Game Nokia'/><category term='hibernate'/><category term='jbutton'/><category term='util'/><category term='basic'/><category term='ajax'/><category term='ckeditor'/><category term='parse'/><category term='2010'/><category term='enumeration'/><category term='version'/><category term='widgets'/><category term='constructor'/><category term='BINARY'/><category term='METHOD'/><category term='RECEIVE'/><category term='generics'/><category term='slideshow'/><category term='structure'/><category term='LOVE'/><category term='USER INPUT'/><category term='jtext'/><category term='multiSearch'/><category term='FILE'/><category term='JRADIOBUTTON'/><category term='Wrapper Classes'/><category term='jqgrid'/><category term='WHITESPACE'/><category term='assignment'/><category term='KEYS'/><category term='RECURSIVE'/><title type='text'>SASA JAVA</title><subtitle type='html'>sasa java</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default?start-index=101&amp;max-results=100'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>102</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-8975597555027341815</id><published>2010-07-08T04:36:00.000-07:00</published><updated>2011-12-23T23:31:02.489-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='border'/><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>Border Layout</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span style="font-family: arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;BorderLayout divides the container into five Geographical regions namely&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;North,South,East,West and Center.This is very commonly used Lyout&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Manager.You can add at most one component to each region of a BorderLayout.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;To put more than one component in a section, put them in a JPanel (with its own layout),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;then add that panel to the border layout.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;When you add components to a container which uses BorderLayout, specify the target region as the second parameter as, for example, BorderLayout.SOUTH.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;If nothing is added to a region then neighbouring regions go on to fill up space.&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="display: inline; height: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: visible; overflow-y: visible; padding-bottom: 1px; padding-left: 0px; padding-right: 0px; padding-top: 1px;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CvsF-MJpr4/SZ-_XLh1_SI/AAAAAAAAABo/85KuASBptzg/s1600-h/borderlayout.bmp" style="clear: left; color: #cc0000; float: left; margin-bottom: 1em; margin-right: 1em; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5305169291018370338" src="http://3.bp.blogspot.com/_1CvsF-MJpr4/SZ-_XLh1_SI/AAAAAAAAABo/85KuASBptzg/s320/borderlayout.bmp" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; float: right; height: 198px; margin-bottom: 10px; margin-left: 10px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 247px;" /&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-family: arial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;span style="font-size: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Construcors:-&lt;/span&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;new BorderLayout();&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;new BorderLayout(int hgap,int vgap);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;strong style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Example&lt;/strong&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;span style="color: red; font-size: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Source Code:-&lt;/span&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;import javax.swing.*;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;import java.awt.*;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;class borderlayout extends JFrame{&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;public static void main(String a[]){&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;//initializing frames&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JFrame jf=new JFrame("BorderLayout");&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JFrame jf1=new JFrame("BorderLayout");&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;//initializing panels&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JPanel panel=new JPanel();&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;//initializing buttons&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JButton jbn=new JButton("North");&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JButton jbs=new JButton("South");&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JButton jbe=new JButton("East");&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JButton jbw=new JButton("West");&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JButton jbc=new JButton("Central");&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;//setting up layout&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;panel.setLayout(new BorderLayout());&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;panel.add(jbn,BorderLayout.NORTH);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;panel.add(jbs,BorderLayout.SOUTH);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;panel.add(jbe,BorderLayout.EAST);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;panel.add(jbw,BorderLayout.WEST);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;panel.add(jbc,BorderLayout.CENTER);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;//adding to frame&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;jf.getContentPane().add(panel);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;jf.setSize(250,200);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;jf.setVisible(true);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;}&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-8975597555027341815?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/8975597555027341815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/border-layout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/8975597555027341815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/8975597555027341815'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/border-layout.html' title='Border Layout'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_1CvsF-MJpr4/SZ-_XLh1_SI/AAAAAAAAABo/85KuASBptzg/s72-c/borderlayout.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-2327944381727136717</id><published>2010-07-08T04:35:00.002-07:00</published><updated>2010-07-08T04:35:36.797-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>Card Layout Manager</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;One of the most complex Layout Manager is Card Layout manager.Using this manager you can create a stack of cards and flip from one layout to another.This type of organization is similar to tabbed dialogs.Card Layout provides following&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;Costructors&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;:-&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public CardLayout(); //Constructor creates new CardLayout&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public CardLayout(int hgap,int vgap);//Constructor creates a new card layout with specified horizontal and vertical gap.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;To Create a Card Layout Manager with card layout manager object,you first create a parent panel to hold the cards .Then you create an object of the CardLayout class and set it as the layout manager of the panel.Finally ,you add each card to the layout by creating the component and adding the to the panel.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Following are the methods to switch between cards that are in stack of layout.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;1.void first(Container parent) //Display first card&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;2.void last(Container parent) //Display last card&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;3.void next(Container parent) //Display next card&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;4.void previous(Container parent) //Display previous card&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;5.void first(Container parent,String name) //Display specified card&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Example&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;code snippet:-&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;/*&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;CardLayout c1;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JPanel panel;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JButton jb 1;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;cardlayout()&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFrame jf1=new JFrame("Card Layout demo");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JButton jb1=new JButton("Next Button&amp;gt;&amp;gt;");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JButton jb2=new JButton("Last Button&amp;gt;&amp;gt;");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;CardLayout c1=new CardLayout();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.setLayout(c1);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add("button1",jb1);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add("button2",jb2);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;jb1.addActionListener(this);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;jb2.addActionListener(this);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;jf1.getContentPane().add(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;jf1.setVisible(true);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;jf1.setSize(200,200);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c1.next(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}*/&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-2327944381727136717?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/2327944381727136717/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/card-layout-manager.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/2327944381727136717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/2327944381727136717'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/card-layout-manager.html' title='Card Layout Manager'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-5506679398701292855</id><published>2010-07-08T04:35:00.000-07:00</published><updated>2010-07-11T19:23:47.130-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><category scheme='http://www.blogger.com/atom/ns#' term='grid'/><title type='text'>Grid Bag Layout</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;The GridBag Layout manager is the most flexible and complex layout manager that the AWT provides. It places components in rows and columns allowing specific components by assigning weights to individual components in the gridbag layout.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;When you specify the size and position of components,you also need to specify the constraint for each component.To specify constraint ,you need to set the variables in&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;GridBagConstraints&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Object and specify the&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;GridBagLayout&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;manager object with the&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&amp;nbsp;setConstraint()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;method, to associate the constraint with the component.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;The&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;GridBagLayout&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;class has a single constructor that does not take any arguments.Since the position of each component in a layout is controlled by a&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;GridBagLayout&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;object and is determined by the currently set&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;GridBagConstraints&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;object,you need to create the&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;GridBagConstraints&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;object before the layout can be built.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagLayout g=new GridBagLayout();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints cons=new GridBagConstraints();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;You can assign following values to&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;GridBagConstraints&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;attributes:-&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;anchor:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;It is used when the component is smaller than its display area to determine where to place the compoenent.valid values are shown below:&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.CENTER&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.NORTH&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.NORTHEAST&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.EAST&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.SOUTHEAST&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.SOUTH&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.SOUTHWEST&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.WEST&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.NORTHWEST&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;fill:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;It is used when the display area of component is larger than the requested size of the component to determine whether to resize the component.valid values are:-&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.NONE&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.HORIZONTAL&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.VERTICAL&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.BOTH&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;gridwidth,gridheight:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;It specifies number of columns or rows in display area of components the default value is 1,valid values are:&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.REMAINDER&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints.RELATIVE&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;gridx,gridy:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;They specify the row and column at the upper left of the components display area.The leftmost column has the address gridx=0 and topmost cell has the address gridy=0.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;insets:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;They specify the extenal padding of the component ,that is ,the minimum amount of space between the components and the edges of its display area.The value is specified as an Insets object .By default ,each component does not have external padding.The default padding value is insets(0,0,0,0).&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;ipadx,ipady:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;They specify the internal padding to be added to the minimum size of the component.The default value is 0.The width of the component will be its minimum width plus ipadx*2 pixels.Similarly ,the height of the component will be its minimum height plus ipady*2 pixels.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;weightx,weighty:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;They determine whether the component stretch horizontally to fill the display area of the applet or vertically.The default value is 0 for both.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CvsF-MJpr4/SaK0vte5D9I/AAAAAAAAABw/qyJBA436F9g/s1600-h/gridbaglayout.bmp" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5306002042751881170" src="http://4.bp.blogspot.com/_1CvsF-MJpr4/SaK0vte5D9I/AAAAAAAAABw/qyJBA436F9g/s320/gridbaglayout.bmp" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 163px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 216px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Example&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: red; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Source code:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class GridBagWindow extends JFrame {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;boolean inAnApplet = true;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;final boolean shouldFill = true;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;final boolean shouldWeightX = true;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public GridBagWindow() {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JButton button;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Container contentPane = getContentPane();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagLayout gridbag = new GridBagLayout();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagConstraints c = new GridBagConstraints();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;contentPane.setLayout(gridbag);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;if (shouldFill) {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//natural height, maximum width&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.fill = GridBagConstraints.HORIZONTAL;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;button = new JButton("Button 1");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;if (shouldWeightX) {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.weightx = 0.5;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridx = 0;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridy = 0;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;contentPane.add(button);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;button = new JButton("2");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridx = 1;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridy = 0;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;contentPane.add(button);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;button = new JButton("Button 3");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridx = 2;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridy = 0;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;contentPane.add(button);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;button = new JButton("Long-Named Button 4");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.ipady = 40; //make this component tall&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.weightx = 0.0;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridwidth = 3;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridx = 0;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridy = 1;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;contentPane.add(button);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;button = new JButton("Button 5");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.ipady = 0; //reset to default&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.weighty = 1.0; //request any extra vertical space&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.anchor = GridBagConstraints.SOUTH; //bottom of space&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.insets = new Insets(10,0,0,0); //top padding&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridx = 1; //aligned with button 2&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridwidth = 2; //2 columns wide&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;c.gridy = 2; //third row&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;contentPane.add(button);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;addWindowListener(new WindowAdapter() {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public void windowClosing(WindowEvent e) {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;if (inAnApplet) {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;dispose();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;} else {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;System.exit(0);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;});&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;GridBagWindow window = new GridBagWindow();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;window.inAnApplet = false;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;window.setTitle("GridBagLayout");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;window.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;window.setVisible(true);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-5506679398701292855?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/5506679398701292855/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/grid-bag-layout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/5506679398701292855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/5506679398701292855'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/grid-bag-layout.html' title='Grid Bag Layout'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1CvsF-MJpr4/SaK0vte5D9I/AAAAAAAAABw/qyJBA436F9g/s72-c/gridbaglayout.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-8899078083111651955</id><published>2010-07-08T04:34:00.002-07:00</published><updated>2010-07-08T04:34:38.356-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><category scheme='http://www.blogger.com/atom/ns#' term='jbutton'/><title type='text'>JButton</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="display: inline; height: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: visible; overflow-y: visible; padding-bottom: 1px; padding-left: 0px; padding-right: 0px; padding-top: 1px;"&gt;&lt;span class="Apple-style-span" style="font-size: large; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JButton&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Jbutton is the standrad command button used in Java.It is mainly used for event driven programming.A JButton when clicked fires an event which is handled by an event handler which in response do some work as indicated in hadler.On click the JButton takes some set of input and process that.The JButton is a Swing Component.&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JButton Class&lt;/span&gt;&amp;nbsp;has following&amp;nbsp;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #000099; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;constructors:-&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JButton() // Creates a button with no text or icon&lt;span class="Apple-style-span" style="font-family: 'times new roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JButton(Action a) //Creates a button where are properties are tak&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;en from action supplied&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JButton(Icon icon)//Creates a button with a icon&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JButton(String text)//Creates a button with some text&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JButton(String text ,Icon icon)//Creates button with both text and icon&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #000099; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Features of JButton:-&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #000099; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;1.JButton applies event handling.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;2.JButton has a different look and feel for enabled and disabled buttons.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;3.You can set mnemonics for JButtons.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;4.TooltipText can also be set for JButtons.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Following&amp;nbsp;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;example&lt;/span&gt;&lt;/span&gt;&amp;nbsp;shows the application of all above mentioned features:-&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;In this example there are buttons which on click disable and enable the corresponding buttons.&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;The program follows:-&lt;/div&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5306299690214809090" src="http://2.bp.blogspot.com/_1CvsF-MJpr4/SaPDdEsE3gI/AAAAAAAAACA/-Y8gV1N9-BU/s320/buttondemo2.bmp" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; color: #4c4c4c; cursor: pointer; float: right; font-family: Arial, sans-serif; font-size: 13px; height: 42px; line-height: 20px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 320px;" /&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5306299102185889890" src="http://4.bp.blogspot.com/_1CvsF-MJpr4/SaPC62HDoGI/AAAAAAAAAB4/DLwqHvIhFM8/s320/buttondemo.bmp" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 58px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 320px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;import javax.swing.*;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;import java.awt.event.*;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public class ButtonDemo extends JPanel&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;implements ActionListener {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;protected JButton but1, but2, but3;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public ButtonDemo() {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;ImageIcon leftButtonIcon = createImageIcon("d:/image/left.gif");&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;ImageIcon middleButtonIcon = createImageIcon("c:/image/middle.gif");&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;ImageIcon rightButtonIcon = createImageIcon("c:/image/right.gif");&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but1 = new JButton("Disable middle button", leftButtonIcon);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but1.setActionCommand("disable");&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;//setting up mnemonics&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but1.setMnemonic(KeyEvent.VK_D);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but2 = new JButton("Middle button", middleButtonIcon);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but2.setMnemonic(KeyEvent.VK_M);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but3 = new JButton("Enable middle button", rightButtonIcon);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;//Use the default text position of CENTER, TRAILING (RIGHT).&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but3.setMnemonic(KeyEvent.VK_E);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but3.setActionCommand("enable");&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;//enabling the command button&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but3.setEnabled(false);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;//Listeners for actions on buttons 1 and 3.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but1.addActionListener(this);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but3.addActionListener(this);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but1.setToolTipText("Click this button to disable the middle button.");&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but3.setToolTipText("Click this button to enable the middle button.");&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;//Add Components to this container, using the default FlowLayout.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;add(but1);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;add(but2);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;add(but3);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public void actionPerformed(ActionEvent e) {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;if ("disable".equals(e.getActionCommand())) {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but2.setEnabled(false);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but1.setEnabled(false);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but3.setEnabled(true);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;} else {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but2.setEnabled(true);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but1.setEnabled(true);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;but3.setEnabled(false);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;/** Returns an ImageIcon, or null if the path was invalid. */&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;protected static ImageIcon createImageIcon(String path) {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;java.net.URL imgURL = ButtonDemo.class.getResource(path);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;if (imgURL != null) {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;return new ImageIcon(imgURL);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;} else {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;System.err.println("Couldn't find file: " + path);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;return null;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;// Create the GUI.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;private static void createAndShowGUI() {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;//Create and set up the JFrame.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JFrame frame = new JFrame("ButtonDemo");&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;//Create and set up the content pane.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;ButtonDemo newContentPane = new ButtonDemo();&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;newContentPane.setOpaque(true); //content panes must be opaque&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.setContentPane(newContentPane);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;//Display the JFrame.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.pack();&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.setVisible(true);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public static void main(String[] args) {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;//creating and showing this application's GUI.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;javax.swing.SwingUtilities.invokeLater(new Runnable() {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public void run() {&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;createAndShowGUI();&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;});&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-8899078083111651955?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/8899078083111651955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/jbutton.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/8899078083111651955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/8899078083111651955'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/jbutton.html' title='JButton'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_1CvsF-MJpr4/SaPDdEsE3gI/AAAAAAAAACA/-Y8gV1N9-BU/s72-c/buttondemo2.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-7906812036719802690</id><published>2010-07-08T04:34:00.000-07:00</published><updated>2010-07-08T04:34:02.557-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><category scheme='http://www.blogger.com/atom/ns#' term='jlable'/><title type='text'>JLabel</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabels in Swing can contain text, images or both.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel do not generate an action event though&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;it works on Mouse Events.Like MouseMotion,MouseListener etc.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;We can also add non-functional labels in our interface(GUI).&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;You can also specify the position of the text relative to the image.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Also we can align,specify border,size and many more properties.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Constructors:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel class has following Constructors&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel()&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #000099; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Creates&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;a&lt;/span&gt;&amp;nbsp;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel&amp;nbsp;&lt;/span&gt;without an image and with empty string title&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel(Icon icon)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #000099; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&amp;nbsp;//Creates a JLabel instance with specified image as title&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel(Icon image,int horizontalAlignment)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #000099; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;// Creates a JLabel object with image and alignment&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel(String text)//JLabel with some text as title&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel(String text,Icon image,int horizontalAlignment)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #000099; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel(String text ,int horizontalalignment)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #000099; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: red; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Example:-&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CvsF-MJpr4/SaS_BOXNwXI/AAAAAAAAACI/1wIHd21nVWs/s1600-h/simplelabel.bmp" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5306576288705528178" src="http://4.bp.blogspot.com/_1CvsF-MJpr4/SaS_BOXNwXI/AAAAAAAAACI/1wIHd21nVWs/s400/simplelabel.bmp" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 106px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 137px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;The following exmaple is for simple label showing only text:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public class SimpleJLabel extends JFrame{&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public static void main(String[] args) {&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel label = new JLabel("A Simple Text Label");&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JFrame frame = new JFrame();&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.getContentPane().add(label);&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.pack();&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.setVisible(true);&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: red; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Example:-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;The Following Example shows setting up an Icon on Label&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CvsF-MJpr4/SaS_BNauCBI/AAAAAAAAACQ/d-z8wVVBFaU/s1600-h/labelpic.bmp" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5306576288451790866" src="http://1.bp.blogspot.com/_1CvsF-MJpr4/SaS_BNauCBI/AAAAAAAAACQ/d-z8wVVBFaU/s400/labelpic.bmp" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 106px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 171px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public class SimpleJLabel extends JFrame{&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public static void main(String[] args) {&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JLabel label = new JLabel();&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;label.setIcon(new ImageIcon("e1.png"));&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JFrame frame = new JFrame();&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.getContentPane().add(label);&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.pack();&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;frame.setVisible(true);&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #000099; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;You can also set many more properties like mnemonics,tooltiptext alignment etc.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-7906812036719802690?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/7906812036719802690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/jlabel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/7906812036719802690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/7906812036719802690'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/jlabel.html' title='JLabel'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1CvsF-MJpr4/SaS_BOXNwXI/AAAAAAAAACI/1wIHd21nVWs/s72-c/simplelabel.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-6580987408223676600</id><published>2010-07-08T04:33:00.001-07:00</published><updated>2010-07-08T04:33:31.428-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jtext'/><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>JTextField</title><content type='html'>&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-size: large; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JTextField&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;A text field is a basic text control that enables the user to type a small amount of text.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;The text field is editable. It is handy in cases&amp;nbsp;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;where a single line of input is required or a little information is neede.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;It is mostly used in forms and does most work on Event handling.There are certain methods which copies the contents of TextField whenever an action is fired.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Constructors:-&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;JTextField has four types of constructors which are as follows&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;1.JTextField()&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;2.JTextField(String) &amp;nbsp;//Creates a TextField with initial text as String&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;3.JTextField(String,int) &amp;nbsp;//creates a TextField with length of cloumn being chars and default text is as String&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;4.JTextField(int) &amp;nbsp; //creates s TextField with length &amp;nbsp;of column being chars.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;Note: Always try to specify the number of columns for each text field. If you do not specify the number of columns or a preferred size, then the field's preferred size changes whenever the text changes, which can result in unwanted layout changes.&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Example:-&lt;/span&gt;Creating a form with JTextField&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5309969687436659794" src="http://4.bp.blogspot.com/_1CvsF-MJpr4/SbDNTBvBDFI/AAAAAAAAADA/Audl15udp5o/s400/textfield.bmp" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; display: block; height: 103px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; text-align: justify; width: 356px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;//textfield.java&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;import javax.swing.*;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;class textfield extends JFrame{&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;public static void main(String a[]){&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;JFrame frame=new JFrame("JTextFieldDemo");&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;JPanel panel=new JPanel();&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;JTextField txt=new JTextField(10);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;JTextField txtf=new JTextField("Default",20); &amp;nbsp; //with default text written and size of 20&amp;nbsp;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;panel.add(txt);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;panel.add(txtf);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;frame.getContentPane().add(panel);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;frame.setVisible(true);&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;frame.pack();&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;}&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;We have several methods&amp;nbsp;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;for getting and setting values from and to JTextField&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;1.String getText()&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;2.void setText(String)&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Edit methods of JTextField component&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;1.void setEditable(boolean) &amp;nbsp;//set whether the text in the JTextField is editable or not&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;2. boolean isEditable() &amp;nbsp; //returns whether the tetfield is editable or not&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;For setting and getting the width of JTextField use&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;void setColumns(int) &amp;nbsp;//specifies the width of textfield&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;int getColumns() &amp;nbsp;//obtains number of columns of the TextField&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;For selecting whole field at once use following&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;void selectAll()&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: pre-wrap;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: pre-wrap;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;For adding ActionListeners use following&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;void addActionListener(ActionListener)&lt;/span&gt;&amp;nbsp;&amp;nbsp;//adds action listener&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/div&gt;&lt;div style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;void removeActionListener(ActionListener)&lt;/span&gt;&amp;nbsp;&amp;nbsp;//removes ActionListener&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-6580987408223676600?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/6580987408223676600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/jtextfield.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/6580987408223676600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/6580987408223676600'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/jtextfield.html' title='JTextField'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1CvsF-MJpr4/SbDNTBvBDFI/AAAAAAAAADA/Audl15udp5o/s72-c/textfield.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-8116479288337155781</id><published>2010-07-08T04:32:00.004-07:00</published><updated>2010-07-08T04:32:54.065-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>Setting ToolTip and Icon</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-size: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Adding Icons and ToolTips&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Tooltips are shot information messages which are displayed when your mouse pointer rests at some components.That is if suppose your mose pointer is at a button whose tooltiop is set as "click here" the if your pointer comes over button the a small message will appear saying "click here".&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;For setting ToolTip we can use setToolTipText() method of JComponent class.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;ToolTip Example:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CvsF-MJpr4/ScHYqyCNLlI/AAAAAAAAAFo/upDWSEksdU4/s1600-h/tooltip.jpg" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5314767264771026514" src="http://4.bp.blogspot.com/_1CvsF-MJpr4/ScHYqyCNLlI/AAAAAAAAAFo/upDWSEksdU4/s400/tooltip.jpg" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 70px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 221px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;// tooltip.java&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class tooltip&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public static void main(String a[])&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFrame frm=new JFrame("ToolTip Demo");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JLabel labeltool=new JLabel("ToolTio DemoPlace mouse over it");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;labeltool.setToolTipText("This is ToolTip");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(labeltool);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.getContentPane().add(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.setVisible(true);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;SettingIcon Example:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;// settingicon.java&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CvsF-MJpr4/ScHaJ4s6iZI/AAAAAAAAAFw/dNNQDgxnHlI/s1600-h/settingicon.bmp" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5314768898648344978" src="http://1.bp.blogspot.com/_1CvsF-MJpr4/ScHaJ4s6iZI/AAAAAAAAAFw/dNNQDgxnHlI/s400/settingicon.bmp" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 69px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 176px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class settingicon&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public static void main(String a[])&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFrame frm=new JFrame("Setting Icon Demo");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JLabel label=new JLabel(new ImageIcon("BAK.png"));&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(label);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.getContentPane().add(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.setVisible(true);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-8116479288337155781?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/8116479288337155781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/setting-tooltip-and-icon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/8116479288337155781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/8116479288337155781'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/setting-tooltip-and-icon.html' title='Setting ToolTip and Icon'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1CvsF-MJpr4/ScHYqyCNLlI/AAAAAAAAAFo/upDWSEksdU4/s72-c/tooltip.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-2088703422762159254</id><published>2010-07-08T04:32:00.002-07:00</published><updated>2010-07-08T04:32:32.329-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>Setting Mnemonics and Shortcut Keys</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Setting a Shrotcut Key(Mnemonic)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;A shortcut key is an underlined character you may in labels,buttons,menus etc.These are called as mnemonics.You can select a control by pressing the combination of Alt key and the character.For example if underlined character is 's' then in order to activate control press Alt+s.You can set mnemonic by using setMnemonic(Char ch)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Syntax:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://2.bp.blogspot.com/_1CvsF-MJpr4/ScHtjG2ifgI/AAAAAAAAAF4/0UF5f-ydZec/s1600-h/mnemonic.bmp" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5314790222664465922" src="http://2.bp.blogspot.com/_1CvsF-MJpr4/ScHtjG2ifgI/AAAAAAAAAF4/0UF5f-ydZec/s400/mnemonic.bmp" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 85px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 196px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;component.setMnemonic(Char ch);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Exapmle:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;In the Screen shot the mnemonic is set as 'M'.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;So this button can be activated by pressing Alt+M.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;// memonic.java&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class mnemonic&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public static void main(String a[])&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFrame frm=new JFrame("Mnemonic Demo");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JButton Button=new JButton("Setting Mnemonic");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Button.setMnemonic('M');&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(Button);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.getContentPane().add(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.setVisible(true);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-2088703422762159254?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/2088703422762159254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/setting-mnemonics-and-shortcut-keys.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/2088703422762159254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/2088703422762159254'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/setting-mnemonics-and-shortcut-keys.html' title='Setting Mnemonics and Shortcut Keys'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_1CvsF-MJpr4/ScHtjG2ifgI/AAAAAAAAAF4/0UF5f-ydZec/s72-c/mnemonic.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-7782280350381798484</id><published>2010-07-08T04:32:00.000-07:00</published><updated>2010-07-08T04:32:12.420-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>DropDown Menu or Choice menu</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-size: 17px; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;DropDown Menu or The Choice class&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;A choice menu is a dropdown menu which upon clicking presents a list of menus(choices) from which user may choose one.That is when a user clicks on the choice control a list of option drops down from which a user can select only one choice.It enforces user to choose from the list of options provided.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Constructor:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;// Choice();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;creating an object of Choice class&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;e.g. Choice choice=new Choice();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Adding Items:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Items in the list of menu are added by using addItem(String Item) method.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;e.g. choice.addItem("Option 1");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CvsF-MJpr4/SeLQESa1x2I/AAAAAAAAAH0/7S5_jCEPVvQ/s1600-h/choice.JPG" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5324046481587816290" src="http://3.bp.blogspot.com/_1CvsF-MJpr4/SeLQESa1x2I/AAAAAAAAAH0/7S5_jCEPVvQ/s400/choice.JPG" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 199px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 249px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Example:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//choice.java&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class choice&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public static void main(String a[])&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Frame frm=new Frame("Choice menu demo");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Panel panel=new Panel();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Choice choice=new Choice();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.add(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;choice.addItem("Option 1");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;choice.addItem("Option 2");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;choice.addItem("Option 3");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;choice.addItem("Option 4");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(new Label("This is DropDown MENU"));&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(choice);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.show();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.setBounds(100,100,250,200);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Useful Methods of Choice Class:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CvsF-MJpr4/SeMNU_EgpuI/AAAAAAAAAH8/z59N8yuaMPE/s1600-h/choice+table.JPG" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5324113838660953826" src="http://1.bp.blogspot.com/_1CvsF-MJpr4/SeMNU_EgpuI/AAAAAAAAAH8/z59N8yuaMPE/s400/choice+table.JPG" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; display: block; height: 175px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-7782280350381798484?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/7782280350381798484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/dropdown-menu-or-choice-menu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/7782280350381798484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/7782280350381798484'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/dropdown-menu-or-choice-menu.html' title='DropDown Menu or Choice menu'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_1CvsF-MJpr4/SeLQESa1x2I/AAAAAAAAAH0/7S5_jCEPVvQ/s72-c/choice.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-2956583129363588625</id><published>2010-07-08T04:31:00.001-07:00</published><updated>2010-07-08T04:31:22.169-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>How to create and use Check Boxes</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;CheckBox is a unique java control which lets user select one or more options.This control becomes handy where some sort of selection is to be made.I will explain here the CheckBoxes In Java Swings.Which are created using JCheckBox class.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Constructors:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;There are five constructors of CheckBox&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;1.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Checkbox()&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;--&amp;gt; Creates a check box with an empty string for its label.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;2.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Checkbox(String label, boolean state)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;--&amp;gt; Creates a check box with the specified label and sets the specified state.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;3.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Checkbox(String label)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;--&amp;gt; Creates a check box with the specified label.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;4.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Checkbox(String label, boolean state, CheckboxGroup group)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;--&amp;gt; Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;5.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Checkbox(String label, CheckboxGroup group, boolean state)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;--&amp;gt; Creates a check box with the specified label, in the specified check box group, and set to the specified state.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Example:-This simple swing example illustrates how checkboxes are added.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//test.java&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CvsF-MJpr4/SeWjgg6moGI/AAAAAAAAAIM/hc9H308v1F0/s1600-h/checkbox.JPG" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5324841913422356578" src="http://4.bp.blogspot.com/_1CvsF-MJpr4/SeWjgg6moGI/AAAAAAAAAIM/hc9H308v1F0/s400/checkbox.JPG" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 68px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 235px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class test{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public static void main(String[] args){&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFrame frame = new JFrame("Check Box Frame");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JCheckBox chkop1 = new JCheckBox("option 1");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JCheckBox chkop2 = new JCheckBox("option 2");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JCheckBox chkop3 = new JCheckBox("option 3");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(chkop1);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(chkop2);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(chkop3);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.getContentPane().add(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.setVisible(true);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Selecting Checkboxes:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;In this example the checkboxes are default selected using setSelected(boolean state) method of JCheckBox class.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//test1.java&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://3.bp.blogspot.com/_1CvsF-MJpr4/SeWk4GevwmI/AAAAAAAAAIU/7LbnBDE-gmk/s1600-h/setselected+in+checkbox.JPG" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5324843418154680930" src="http://3.bp.blogspot.com/_1CvsF-MJpr4/SeWk4GevwmI/AAAAAAAAAIU/7LbnBDE-gmk/s400/setselected+in+checkbox.JPG" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 67px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 236px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class test{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public static void main(String[] args){&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFrame frame = new JFrame("Check Box Frame");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JCheckBox chkop1 = new JCheckBox("option 1");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;chkop1.setSelected(true);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JCheckBox chkop2 = new JCheckBox("option 2");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;chkop2.setSelected(true);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JCheckBox chkop3 = new JCheckBox("option 3");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(chkop1);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(chkop2);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(chkop3);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.getContentPane().add(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.setVisible(true);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Other useful methods:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;setLabel()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;:-Sets Label as provided string to this CheckBox.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;getLabel()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;:-Returns Label of CheckBox.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;addItemListener()&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;:-Only ItemListeners can be added to CheckBox control for event handling purposes.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-2956583129363588625?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/2956583129363588625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/how-to-create-and-use-check-boxes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/2956583129363588625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/2956583129363588625'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/how-to-create-and-use-check-boxes.html' title='How to create and use Check Boxes'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1CvsF-MJpr4/SeWjgg6moGI/AAAAAAAAAIM/hc9H308v1F0/s72-c/checkbox.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-6768485989457621175</id><published>2010-07-08T04:30:00.004-07:00</published><updated>2010-07-08T04:30:58.349-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>How to Use CheckBoxGroup</title><content type='html'>&lt;div class="post-body" id="post-8321995201923508123" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;div style="display: inline; height: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: visible; overflow-y: visible; padding-bottom: 1px; padding-left: 0px; padding-right: 0px; padding-top: 1px;"&gt;CheckboxGroup class is used to group togather the Checkboxes,from which only one can be selected at a time.&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;That is exactly one Checkbox in that goup will be "on" else remain "false".By clicking on Checkbox we may "on" or "off" the desired Checkbox.This control is mostly used in making selection ,where exactly one selection is needed form given choices.&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;more on Checkboxes Visit Checkbox Tutorial&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Constructor:-&lt;/span&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;CheckboxGroup() ---&amp;gt; Creates a new instance of CheckboxGroup.&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Important Methods:-&lt;/span&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;void getSelectedCheckbox() ----&amp;gt; Gets the current choice from this check box group.&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;void setSelectedCheckbox(Checkbox cb) ----&amp;gt; Turn "on" the specified CheckBox.&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;How to Use CheckboxGroup:-&lt;/span&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;a href="http://3.bp.blogspot.com/_1CvsF-MJpr4/SeylVszijNI/AAAAAAAAAJI/G9TR4UfkmpI/s1600-h/checkboxgroup.JPG" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5326814251495623890" src="http://3.bp.blogspot.com/_1CvsF-MJpr4/SeylVszijNI/AAAAAAAAAJI/G9TR4UfkmpI/s400/checkboxgroup.JPG" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; display: block; height: 63px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; text-align: center; width: 203px;" /&gt;&lt;/a&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Example:-&lt;/span&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;// test.java&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;import javax.swing.*;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;import java.awt.*;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;public class test{&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;public static void main(String[] args){&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JFrame frame = new JFrame("Check Box Frame");&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;CheckboxGroup cb=new CheckboxGroup();&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;Checkbox chkop1 = new Checkbox("option1",false,cb);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;Checkbox chkop2 = new Checkbox("option2",false,cb);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;Checkbox chkop3 = new Checkbox("option3",true,cb);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;JPanel panel=new JPanel();&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;panel.add(chkop1);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;panel.add(chkop2);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;panel.add(chkop3);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;frame.getContentPane().add(panel);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;frame.pack();&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;frame.setVisible(true);&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;}&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;}&lt;/div&gt;&lt;div style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="post-footer" style="background-attachment: initial; background-clip: initial; background-color: #fafafa; background-image: initial; background-origin: initial; border-bottom-color: rgb(243, 243, 243); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(243, 243, 243); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(243, 243, 243); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(243, 243, 243); border-top-style: solid; border-top-width: 1px; color: #b3b3b3; display: block; font-family: Arial, sans-serif; font-size: 13px; font-weight: normal; font: normal normal normal 82%/normal Arial, sans-serif; line-height: 1.6em; margin-bottom: 25px; margin-left: 0px; margin-right: 0px; margin-top: 15px; padding-bottom: 7px; padding-left: 20px; padding-right: 20px; padding-top: 7px; text-align: left; text-decoration: none;"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-6768485989457621175?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/6768485989457621175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/how-to-use-checkboxgroup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/6768485989457621175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/6768485989457621175'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/how-to-use-checkboxgroup.html' title='How to Use CheckBoxGroup'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_1CvsF-MJpr4/SeylVszijNI/AAAAAAAAAJI/G9TR4UfkmpI/s72-c/checkboxgroup.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-1676164091189440010</id><published>2010-07-08T04:30:00.002-07:00</published><updated>2010-07-08T04:30:35.731-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>Using JTextField and JTextArea</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;TextFields are used to take input from user also it can be used to display results.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;The various constructors and methods are defined in the previous JTextField tutorials.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Values from a TextField is extracted using String&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;getText()&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;and set using&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;void&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;setText(String txt).&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;The user can select a portion from the JTextField and JTextArea using&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;String&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;getSelectedText()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;and&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;void select(int start_index,int end_index)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;String getSelectedText()&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;retrurns the String portion selected by the user from the textfield.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;You can also enable or disable the TextField that is if you want TextField to be editable the use the methos void&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;setEditable(boolean value)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;to true else set false.If you want to get value of editable TextField use&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;boolean isEditable()&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Sometimes you wish to set a password field in which the entered character must not be shown.It has to be replaced by some other sign or value.To set a password field you must use&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;void&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;setEchoChar(Char ch)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;character you specified in 'ch' will be shown when some charater is typed.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;If you want to get the Charcter specified the use&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;char&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;getEchoChar()&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-size: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Example :-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;getting selected value from a text field and displaying it to other and use of Password field.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;// textfield.java&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://2.bp.blogspot.com/_1CvsF-MJpr4/SflslLsG5TI/AAAAAAAAAKw/ZgtgJHrLVzQ/s1600-h/textfield.JPG" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5330411020018443570" src="http://2.bp.blogspot.com/_1CvsF-MJpr4/SflslLsG5TI/AAAAAAAAAKw/ZgtgJHrLVzQ/s320/textfield.JPG" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 62px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 320px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class textfield extends JFrame implements ActionListener&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFrame frame;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JPanel panel;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JTextField txtname,txtdisplay;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;TextField txtpass;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JButton button;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public textfield()&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame=new JFrame("Text Field usage demo");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel=new JPanel();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;txtname=new JTextField(25);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;txtpass=new TextField(25);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;txtpass.setEchoChar('#');&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;txtdisplay =new JTextField(25);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JButton button=new JButton("Display selected");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;button.addActionListener(this);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.setLayout(new GridLayout(3,2));&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(new JLabel("Name :"));&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(txtname);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(new JLabel("Password :"));&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(txtpass);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(txtdisplay);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(button);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.getContentPane().add(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.show();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;txtdisplay.setText("Name :"+txtname.getSelectedText()+" Pass :"+txtpass.getText());&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public static void main(String a[])&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;new textfield();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-size: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Example:-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;getting selected value from a text area and displaying selected in textfield.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;// textarea.java&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CvsF-MJpr4/SflslIekWVI/AAAAAAAAAKo/ntr13RsE1lA/s1600-h/textarea.JPG" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5330411019156347218" src="http://4.bp.blogspot.com/_1CvsF-MJpr4/SflslIekWVI/AAAAAAAAAKo/ntr13RsE1lA/s320/textarea.JPG" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 58px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 320px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class textarea extends JFrame implements ActionListener&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFrame frame;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JPanel panel;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JTextField txtname,txtdisplay;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;TextField txtpass;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JTextArea area;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JButton button;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public textarea()&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame=new JFrame("Text Area usage demo");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel=new JPanel();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;txtdisplay =new JTextField(25);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;area = new JTextArea("vaibhav pandey has made this programme",5,5);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JButton button=new JButton("Display selected");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;button.addActionListener(this);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(area);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(txtdisplay);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;panel.add(button);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.getContentPane().add(panel);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.show();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frame.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;txtdisplay.setText("Selected String :"+area.getSelectedText());&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public static void main(String a[])&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;new textarea();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-1676164091189440010?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/1676164091189440010/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/using-jtextfield-and-jtextarea.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/1676164091189440010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/1676164091189440010'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/using-jtextfield-and-jtextarea.html' title='Using JTextField and JTextArea'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_1CvsF-MJpr4/SflslLsG5TI/AAAAAAAAAKw/ZgtgJHrLVzQ/s72-c/textfield.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-6378107350709037141</id><published>2010-07-08T04:30:00.000-07:00</published><updated>2010-07-08T04:30:09.096-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='util'/><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>Loading Image on JFrame using JFileChooser</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-size: 17px; font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JFileChooser&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;is a very handy utility in java Swings to choose any particular file of an extension.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Sometimes in our applications we need to load images onto our main container .In java we can use either JFrame or JPanel to load images.Statically we can provide the path of image into our program,but most of times it is not feasible for us to give image path statically.For specifying image path dynamically we use JFileChooser which returns path of a selected image.You can also select the desierd file extensions for whom you are looking.In following Example it is elaborated how to use JFileChooser and using it how we can load an image on a container.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Example (Source code ):-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//imageloading.java&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//Program developed by Vaibhav Pandey&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.awt.image.BufferedImage;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.io.File;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.io.IOException;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.sql.SQLException;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.util.logging.Level;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import java.util.logging.Logger;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.imageio.ImageIO;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.ImageIcon;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.JFileChooser;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.JFrame;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.JLabel;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;import javax.swing.JOptionPane;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public class imageloading extends JFrame&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;BufferedImage mImage;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;String name,name1;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public imageloading()&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFrame frm=new JFrame("image loading test");&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;String source=filechoose();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;File inputFile = new File(source);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;try {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;mImage = ImageIO.read(inputFile);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;} catch (IOException ex) {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//Logger.getLogger(index.class.getName()).log(Level.SEVERE, null, ex);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JLabel lb=new JLabel(new ImageIcon(mImage));&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.getContentPane().add(lb);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.show();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;frm.pack();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;String filechoose()&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;JFileChooser chooser = new JFileChooser();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;chooser.setCurrentDirectory(new File("."));&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;chooser.setFileFilter(new javax.swing.filechooser.FileFilter() {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public boolean accept(File f) {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;name = f.getName().toLowerCase();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;return name.endsWith(".gif") || name.endsWith(".jpg")&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;|| name.endsWith(".jpeg") || f.isDirectory();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;public String getDescription() {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;return "Image files";&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;}&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;});&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;int r = chooser.showOpenDialog(this);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;if (r == JFileChooser.APPROVE_OPTION) {&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;name1 = chooser.getSelectedFile().getAbsolutePath();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;StringBuffer sb=new StringBuffer();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;sb.append(name1);&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;int l=sb.length();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;for(int i=0;i&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;{&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;if(sb.charAt(i)=='\\')&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;{&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;sb.insert(i, "\\");i++;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;return name1;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;public static void main(String a[])&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;{&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;new imageloading();&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Output&amp;nbsp;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Windows:-&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Following first widow shows the&amp;nbsp;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JFileChooser&lt;/span&gt;() instance opened and asking to&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;select a file of given extension,and in second window you can see the loaded image.&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;l;i++) style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://4.bp.blogspot.com/_1CvsF-MJpr4/SgHRChtKiiI/AAAAAAAAALc/oWdWiGiylPA/s1600-h/imageloading1.JPG" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332773275121125922" src="http://4.bp.blogspot.com/_1CvsF-MJpr4/SgHRChtKiiI/AAAAAAAAALc/oWdWiGiylPA/s400/imageloading1.JPG" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: left; height: 282px; margin-bottom: 10px; margin-left: 0pt; margin-right: 10px; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 400px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a href="http://1.bp.blogspot.com/_1CvsF-MJpr4/SgHRauFntjI/AAAAAAAAALk/2jHKVIymYtg/s1600-h/imageloading2.JPG" style="color: #cc0000; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5332773690761786930" src="http://1.bp.blogspot.com/_1CvsF-MJpr4/SgHRauFntjI/AAAAAAAAALk/2jHKVIymYtg/s320/imageloading2.JPG" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(255, 255, 255); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(255, 255, 255); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; cursor: pointer; float: right; height: 212px; margin-bottom: 10px; margin-left: 10px; margin-right: 0pt; margin-top: 0pt; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 132px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Elaboration:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;In the given code we have used the&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;ImageIO&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;class to read the image file whose file is being specified and consequently is buffered.Later this buffered image is set on a Label as a&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;ImageIcon&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;to display it on the frame.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;JFileChooser&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;() is used to choose the files of desired extension here&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;FileFilter()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;method is used to filter the files on the basis of extensions .Here we have considered only .jpeg and .gif images.Since the '/' is treated as a escape sequence in&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;a class="kLink" href="http://www.javasync.com/search/label/Java%20Swings#" id="KonaLink1" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: initial initial !important; background-repeat: initial initial !important; border-bottom-color: transparent !important; border-bottom-style: none !important; border-bottom-width: 0px !important; border-left-color: transparent !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: transparent !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: transparent !important; border-top-style: none !important; border-top-width: 0px !important; bottom: 0px; color: blue !important; cursor: pointer; display: inline !important; font-family: verdana; font-variant: normal; left: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; right: 0px; text-decoration: underline !important; text-transform: none !important; top: 0px;" target="undefined"&gt;&lt;span style="color: blue !important; font-family: Arial, sans-serif; font-size: 13px; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static;"&gt;&lt;span class="kLink" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; color: blue !important; display: inline !important; float: none !important; font-family: Arial, sans-serif; font-size: 13px; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;"&gt;Java&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;thus in when we are fetching path name in variable 'name1' using method 'J&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="font-style: italic; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;FileChoose.getSelectedFile().getAbsolutePath()&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;' ,in order to omit the escape sequence we embed '//' in the path when we have some path selected.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;We have used 'JFileChooser.APPROVE_OPTION' because to verify that we have selected a legitimate file or not.Any queries and comments are most welcome.In Java JFileChooser is a nice utility ,use it and tell me about the tutorial.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-6378107350709037141?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/6378107350709037141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/loading-image-on-jframe-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/6378107350709037141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/6378107350709037141'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/loading-image-on-jframe-using.html' title='Loading Image on JFrame using JFileChooser'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1CvsF-MJpr4/SgHRChtKiiI/AAAAAAAAALc/oWdWiGiylPA/s72-c/imageloading1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-1786757161244624993</id><published>2010-07-08T04:29:00.000-07:00</published><updated>2010-07-08T04:29:35.123-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>Menus In Java Swings</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Every window can have a menu associated with it.Menu Bars basic function is to provide a list of choices.Each choice has its own drop-down menu(is provided otherwise none).This is implemented in Java by using following classes:-&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Menu&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;CheckboxMenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;A menu bar can contains many menu objects.Each menu object may contain many MenuItem objects.In this implementation it is also possible to include checkable menu items.These can be implemented by CheckboxMenuItem class and will place a check mark next to them when they get selected.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;First look at the constructors involved in creation of a menubar application.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;1. MenuBar:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;MenuBar is the highest class in this application and it will contain all the menu's inside it.It has only default constructor.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//MenuBar () only default constructor&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;2.Menu:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;The constructors for Menu is as following.Menu's object will hold menu item's in them.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//Menu()&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//Menu(String optionName)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//Menu(String optionName,boolean Removable)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;In this case optionName provides the name of menu selection.If removable are set to true then menu can be removed and allowed to roam free.Otherwise it will remain with the menu bar.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;3.MenuItem:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;The Individual menuitems are of type MenuItem .These controls are to be placed on Menu object.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//MenuItem()&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//MenuItem(String itemName)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//MenuItem(String itemName,MenuShortcut key)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;here itemName is the name of item shown on menu and key is the menu shortcut for this item.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;4.CheckboxMenuItem:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;CheckboxMenuItem creates the checkboxes which can be placed as a menu and show their state by checked or unchecked.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//CheckboxMenuItem()&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//CheckboxMenuItem(String itemName)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;//CheckboxMenuItem(String itemName,boolean on)&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;itemName refers to the name of checkbox displayed on menu and on refers its state checked or unchecked.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span style="color: #3333ff; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;Important Methods:-&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;There are methods with various functionality lets see&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;1.void setEnabled(boolean flagvalue):-This method sets any menuitem to enabled or disabled state.Which specifies whether the menuitem is active or not(Click works or not).&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;2.boolean isEnabled():-This method returns the value whether the menuitem is active or inactive.That is either true or false.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;3.void setLabel(String newName):-This method changes the name of a menuitem.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;4.String getLabel():-It returns the name of the menuitem.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;5.boolean getState():-This method returns the value (checked or unchecked) of&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;CheckboxMenuItem object.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;6.void setState(boolean checked):-You can set the value of CheckboxMenuItem to true or false using this method.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/305516462606604883-1786757161244624993?l=sasajava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sasajava.blogspot.com/feeds/1786757161244624993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sasajava.blogspot.com/2010/07/menus-in-java-swings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/1786757161244624993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/305516462606604883/posts/default/1786757161244624993'/><link rel='alternate' type='text/html' href='http://sasajava.blogspot.com/2010/07/menus-in-java-swings.html' title='Menus In Java Swings'/><author><name>sateesh reddy katta</name><uri>http://www.blogger.com/profile/18108363837494655988</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_FdoU9nydL6w/Sd5AxhcB1TI/AAAAAAAAACU/ujg5VSTC3tA/S220/coffee_cup_logo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-305516462606604883.post-2705983015662590398</id><published>2010-07-08T04:28:00.002-07:00</published><updated>2010-07-08T04:28:46.565-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swings'/><title type='text'>How to create MenuBar Steps</title><content type='html'>&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;How to create Menu and&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;MenuBars&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;Step wise procedure&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;1.Create an object of&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;class:&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;can be attached a Frame and it will be displayed just below the title bar.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;=new&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;();&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;br style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;2.Call the method&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;setMenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;(&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;):-This method is used to attach the&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin
