<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-305516462606604883</atom:id><lastBuildDate>Sat, 29 Feb 2020 09:49:01 +0000</lastBuildDate><category>JAVA</category><category>swings</category><category>SCJP</category><category>chapter</category><category>generics</category><category>inheritance</category><category>interface</category><category>struts2</category><category>io system</category><category>jQuery</category><category>jqgrid</category><category>package</category><category>Hadoop</category><category>OBJECT</category><category>enumeration</category><category>map reduce</category><category>plugin</category><category>2010</category><category>CLASS</category><category>CURSOR</category><category>DEGREE</category><category>GATE</category><category>History</category><category>Map</category><category>OPERATOR</category><category>RADIANS</category><category>SCJP 1.4</category><category>SCJP 1.5</category><category>STRING</category><category>Wrapper Classes</category><category>ajax</category><category>ckeditor</category><category>grid</category><category>inner class</category><category>richtext</category><category>string tokenizer</category><category>super</category><category>util</category><category>widgets</category><category>ALPHABET</category><category>BINARY</category><category>CHANGE</category><category>COMPONENT</category><category>DETERMINE</category><category>FILE</category><category>GET</category><category>Game Java 176x208</category><category>Game Java 176x220</category><category>Game Java 240x320</category><category>Game Nokia</category><category>Game Sony Ericsson</category><category>HEXADECIMAL TO BINARY</category><category>JAUTORUNKILLER</category><category>JRADIOBUTTON</category><category>JSON</category><category>JSONObject</category><category>KEYS</category><category>LOVE</category><category>METHOD</category><category>MOVE</category><category>Overriding</category><category>PALINDROME</category><category>PIXEL</category><category>PLAY</category><category>RECEIVE</category><category>RECURSIVE</category><category>SCREEN</category><category>SIMPLE</category><category>SORT</category><category>TERNARY OPERATOR</category><category>USER INPUT</category><category>WAV</category><category>WHITESPACE</category><category>abstract</category><category>array</category><category>assignment</category><category>autocompleter</category><category>basic</category><category>border</category><category>casting</category><category>classpath</category><category>collection</category><category>constructor</category><category>diagrams</category><category>dojo</category><category>eamcet</category><category>exceptions</category><category>final</category><category>flow control</category><category>form validation</category><category>fundamentals</category><category>hibernate</category><category>integration</category><category>java.lang</category><category>jbutton</category><category>jlable</category><category>jmjrst</category><category>jpeg</category><category>jqueryui</category><category>jtext</category><category>modifier</category><category>multiSearch</category><category>parse</category><category>reduce</category><category>resize</category><category>results</category><category>showcase</category><category>slideshow</category><category>structure</category><category>sub class</category><category>threads</category><category>version</category><title>SASA JAVA</title><description>sasa java</description><link>http://sasajava.blogspot.com/</link><managingEditor>noreply@blogger.com (Unknown)</managingEditor><generator>Blogger</generator><openSearch:totalResults>105</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-4457199443347920708</guid><pubDate>Thu, 06 Nov 2014 13:54:00 +0000</pubDate><atom:updated>2014-11-06T05:54:11.552-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Hadoop</category><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">Map</category><category domain="http://www.blogger.com/atom/ns#">map reduce</category><title>Map Reduce: Client program initiating the process</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;h4 itxtharvested=&quot;0&quot; itxtnodeid=&quot;497&quot; style=&quot;text-align: left;&quot;&gt;&lt;u&gt;Map Reduce: Client program initiating the process&lt;/u&gt;&lt;/h4&gt;&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;497&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;554&quot;&gt;/**  &lt;/code&gt;&lt;/div&gt;&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;497&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;554&quot;&gt;* Program Starts */ &lt;/code&gt;&lt;/div&gt;&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;497&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;554&quot;&gt;package com.mapreduce.devx; &lt;/code&gt;&lt;/div&gt;&lt;pre itxtharvested=&quot;0&quot; itxtnodeid=&quot;497&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;554&quot;&gt;/**&lt;br /&gt; * Imports */&lt;br /&gt;&lt;br /&gt;import org.apache.commons.logging.Log;&lt;br /&gt;import org.apache.commons.logging.LogFactory;&lt;br /&gt;import org.apache.hadoop.conf.Configuration;&lt;br /&gt;import org.apache.hadoop.fs.Path;&lt;br /&gt;import org.apache.hadoop.io.Text;&lt;br /&gt;import org.apache.hadoop.mapreduce.Job;&lt;br /&gt;import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;&lt;br /&gt;import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;&lt;br /&gt;import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;&lt;br /&gt;import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Class */&lt;br /&gt;public class DevXDriver { &lt;br /&gt; public static void main(String[] args) throws Exception {  &lt;br /&gt; &lt;br /&gt;  // Initiate configuration &lt;br /&gt;  Configuration configx = new Configuration();&lt;br /&gt;   &lt;br /&gt;  // Add resource files&lt;br /&gt;  configx.addResource(new Path(&quot;/user/hadoop/core-site.xml&quot;));&lt;br /&gt;     configx.addResource(new Path(&quot;/user/hadoop/hdfs-site.xml&quot;));&lt;br /&gt;               &lt;br /&gt;  // Create MapReduce job &lt;br /&gt;        Job devxmapjob = new Job(configx,&quot;DevXDriver.class&quot;);&lt;br /&gt;        devxmapjob.setJarByClass(DevXDriver.class);       &lt;br /&gt;        devxmapjob.setJobName(&quot;DevX MapReduce Job&quot;);                  &lt;br /&gt;       &lt;br /&gt;     // Set output kay and value class&lt;br /&gt;  devxmapjob.setOutputKeyClass(Text.class);&lt;br /&gt;  devxmapjob.setOutputValueClass(Text.class);&lt;br /&gt;&lt;br /&gt;  // Set Map class&lt;br /&gt;  devxmapjob.setMapperClass(DevXMap.class);  &lt;br /&gt;  &lt;br /&gt;  // Set Combiner class&lt;br /&gt;  devxmapjob.setCombinerClass(DevXReducer.class);  &lt;br /&gt;  &lt;br /&gt;  // Set Reducer class&lt;br /&gt;  devxmapjob.setReducerClass(DevXReducer.class);     &lt;br /&gt;&lt;br /&gt;  // Set Map output key and value classes&lt;br /&gt;  devxmapjob.setMapOutputKeyClass(Text.class);&lt;br /&gt;  devxmapjob.setMapOutputValueClass(Text.class);&lt;br /&gt;       &lt;br /&gt;  // Set number of reducer tasks&lt;br /&gt;  devxmapjob.setNumReduceTasks(10);&lt;br /&gt;&lt;br /&gt;  // Set input and output format classes&lt;br /&gt;  devxmapjob.setInputFormatClass(TextInputFormat.class);&lt;br /&gt;  devxmapjob.setOutputFormatClass(TextOutputFormat.class);&lt;br /&gt;       &lt;br /&gt;  // Set input and output path&lt;br /&gt;  FileInputFormat.addInputPath(devxmapjob, new Path(&quot;/user/map_reduce/input/&quot;));&lt;br /&gt;  FileOutputFormat.setOutputPath(devxmapjob,new Path(&quot;/user/map_reduce/output&quot;));       &lt;br /&gt;  &lt;br /&gt;  // Start MapReduce job&lt;br /&gt;  devxmapjob.waitForCompletion(true);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2014/11/map-reduce-client-program-initiating.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-7573279385584311695</guid><pubDate>Thu, 06 Nov 2014 13:49:00 +0000</pubDate><atom:updated>2014-11-06T05:49:58.377-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Hadoop</category><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">map reduce</category><category domain="http://www.blogger.com/atom/ns#">reduce</category><title>Sample Reduce function in JAVA (Part of Map reduce)</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;u&gt;Sample Reduce function in JAVA (Part of Map reduce)&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*&amp;nbsp;Program Starts&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;pre itxtharvested=&quot;0&quot; itxtnodeid=&quot;483&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;558&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;package com.mapreduce.devx;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;* Imports &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;import java.io.BufferedReader;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.io.InputStreamReader;&lt;br /&gt;import java.net.URI;&lt;br /&gt;import java.util.RandomAccess;&lt;br /&gt;import java.util.regex.Matcher;&lt;br /&gt;import java.util.regex.Pattern;&lt;br /&gt;&lt;br /&gt;import org.apache.commons.logging.Log;&lt;br /&gt;import org.apache.commons.logging.LogFactory;&lt;br /&gt;import org.apache.hadoop.conf.Configuration;&lt;br /&gt;import org.apache.hadoop.fs.FSDataOutputStream;&lt;br /&gt;import org.apache.hadoop.fs.FileSystem;&lt;br /&gt;import org.apache.hadoop.fs.Path;&lt;br /&gt;import org.apache.hadoop.io.Text;&lt;br /&gt;import org.apache.hadoop.mapreduce.Reducer;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;/**&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;* Class &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;public class DevXReducer extends Reducer&lt;text ext=&quot;&quot;&gt; &lt;br /&gt;{   &lt;br /&gt; // Create variables for file path&lt;br /&gt;    Path positive_file_path;&lt;br /&gt;    Path negative_file_path;&lt;br /&gt;    Path output_file_path;&lt;br /&gt;    Path keyword_file_path;&lt;br /&gt;    &lt;br /&gt;    // Create variables for buffer&lt;br /&gt;    BufferedReader positive_buff_reader;&lt;br /&gt;    BufferedReader negative_buff_reader;&lt;br /&gt;    BufferedReader keyword_buff_reader; &lt;br /&gt;    &lt;br /&gt;    // Create variables for calculation&lt;br /&gt;    static Double total_record_count=new Double(&quot;0&quot;); &lt;br /&gt;   &lt;br /&gt;    static Double count_neg=new Double(&quot;0&quot;);&lt;br /&gt;    static Double count_pos=new Double(&quot;0&quot;);&lt;br /&gt;    static Double count_neu=new Double(&quot;0&quot;);&lt;br /&gt;   &lt;br /&gt;    static Double percent_neg=new Double(&quot;0&quot;);&lt;br /&gt;    static Double percent_pos=new Double(&quot;0&quot;);&lt;br /&gt;    static Double percent_neu=new Double(&quot;0&quot;);&lt;br /&gt;&lt;br /&gt;    Pattern pattrn_matcher;&lt;br /&gt;    Matcher matcher_txt;&lt;br /&gt;    static int new_row=0;&lt;br /&gt;    FSDataOutputStream out_1st,out_2nd;  &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  /**&lt;br /&gt;  * @param key&lt;br /&gt;  * @param values&lt;br /&gt;  * @param context&lt;br /&gt;  * @throws IOException&lt;br /&gt;  * @throws InterruptedException&lt;br /&gt;  */&lt;br /&gt;    public void reduce(Text key, Iterable&lt;text&gt; values,Context context) throws IOException, InterruptedException&lt;br /&gt;     {           &lt;br /&gt;     // Create configuration for reducer&lt;br /&gt;     Configuration reduce_config = new Configuration();&lt;br /&gt;     &lt;br /&gt;        // Load hadoop config files&lt;br /&gt;     reduce_config.addResource(new Path(&quot;/user/hadoop/core-site.xml&quot;));&lt;br /&gt;        reduce_config.addResource(new Path(&quot;/user/hadoop/hdfs-site.xml&quot;));&lt;br /&gt;     &lt;br /&gt;        // Create variables&lt;br /&gt;        String key_word = &quot;&quot;;&lt;br /&gt;        String check_keyword=key_word;  &lt;br /&gt;        &lt;br /&gt;     keyword_file_path=new Path(&quot;files/repository/keys.txt&quot;);&lt;br /&gt;        FileSystem file_system_read = FileSystem.get(URI.create(&quot;files/repository/keys.txt&quot;),new Configuration());&lt;br /&gt;        keyword_buff_reader=new BufferedReader(new InputStreamReader(file_system_read.open(keyword_file_path)));&lt;br /&gt;        &lt;br /&gt;        FileSystem get_filesys = FileSystem.get(reduce_config);&lt;br /&gt;  FileSystem get_filesys_posneg = FileSystem.get(reduce_config);&lt;br /&gt;        &lt;br /&gt;        Path path_output = new Path(&quot;/user/sentiment_output_file.txt&quot;);&lt;br /&gt;        Path path_output_posneg = new Path(&quot;/user/posneg_output_file.txt&quot;);&lt;br /&gt;        &lt;br /&gt;        // Get keyword&lt;br /&gt;        while(keyword_buff_reader.ready())&lt;br /&gt;        {&lt;br /&gt;         key_word=keyword_buff_reader.readLine().trim();&lt;br /&gt;        &lt;br /&gt;        } &lt;br /&gt;        &lt;br /&gt;        // Check file system&lt;br /&gt;        if (!get_filesys.exists(path_output)) {                       &lt;br /&gt;            out_1st = get_filesys.create(path_output);&lt;br /&gt;            out_2nd = get_filesys_posneg.create(path_output_posneg);&lt;br /&gt;           &lt;br /&gt;        }             &lt;br /&gt;         &lt;br /&gt;        // Check keyword matching using positive and negative dictionaries&lt;br /&gt;        if(check_keyword.equals(key.toString().toLowerCase()))&lt;br /&gt;        {      &lt;br /&gt;         for(Text new_tweets:values)&lt;br /&gt;            { &lt;br /&gt;             // Load positive word dictionary&lt;br /&gt;    positive_file_path=new Path(&quot;/user/map_reduce/pos_words.txt&quot;);&lt;br /&gt;                FileSystem filesystem_one = FileSystem.get(URI.create(&quot;files/pos_words.txt&quot;),new Configuration());&lt;br /&gt;                positive_buff_reader=new BufferedReader(new InputStreamReader(filesystem_one.open(positive_file_path)));&lt;br /&gt;              &lt;br /&gt;                // Load negative word disctinary&lt;br /&gt;                negative_file_path = new Path(&quot;/user/map_reduce/neg_words.txt&quot;);&lt;br /&gt;                FileSystem filesystem_two = FileSystem.get(URI.create(&quot;files/neg_words.txt&quot;),new Configuration());&lt;br /&gt;                negative_buff_reader =new BufferedReader(new InputStreamReader(filesystem_two.open(negative_file_path)));&lt;br /&gt;&lt;br /&gt;                ++total_record_count;&lt;br /&gt;&lt;br /&gt;                boolean first_flag=false;&lt;br /&gt;                boolean second_flag=false;&lt;br /&gt;&lt;br /&gt;                String all_tweets=new_tweets.toString();              &lt;br /&gt;                String first_regex = &quot;&quot;;&lt;br /&gt;                String second_regex = &quot;&quot;;&lt;br /&gt;&lt;br /&gt;                while(positive_buff_reader.ready())&lt;br /&gt;                {&lt;br /&gt;                    first_regex=positive_buff_reader.readLine().trim();&lt;br /&gt;                    new_row++;           &lt;br /&gt;                    pattrn_matcher = Pattern.compile(first_regex, Pattern.CASE_INSENSITIVE);&lt;br /&gt;                    matcher_txt = pattrn_matcher.matcher(all_tweets);&lt;br /&gt;                    first_flag=matcher_txt.find();&lt;br /&gt;&lt;br /&gt;                    if(first_flag)&lt;br /&gt;                    {  &lt;br /&gt;                     out_2nd.writeBytes(all_tweets);&lt;br /&gt;                        context.write(new Text(first_regex),new Text(all_tweets));                  &lt;br /&gt;                        break;&lt;br /&gt;                    }       &lt;br /&gt;                }&lt;br /&gt;                while(negative_buff_reader.ready())&lt;br /&gt;                {&lt;br /&gt;                    new_row++;                    &lt;br /&gt;                    second_regex=negative_buff_reader.readLine().trim();&lt;br /&gt;                    pattrn_matcher = Pattern.compile(second_regex, Pattern.CASE_INSENSITIVE);&lt;br /&gt;                    matcher_txt = pattrn_matcher.matcher(all_tweets);&lt;br /&gt;                    second_flag=matcher_txt.find();&lt;br /&gt;                    if(second_flag)&lt;br /&gt;                    {                     &lt;br /&gt;                     out_2nd.writeBytes(all_tweets);&lt;br /&gt;                        context.write(new Text(second_regex),new Text(all_tweets));&lt;br /&gt;                        break;&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                }&lt;br /&gt;                if(first_flag&amp;amp;second_flag)&lt;br /&gt;                {&lt;br /&gt;                    ++count_neu;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    if(first_flag)&lt;br /&gt;                    {&lt;br /&gt;                        ++count_pos;&lt;br /&gt;                    }&lt;br /&gt;                    if(second_flag)&lt;br /&gt;                    {&lt;br /&gt;                        ++count_neg;&lt;br /&gt;                    }&lt;br /&gt;                    if(first_flag==false&amp;amp;second_flag==false)&lt;br /&gt;                    {&lt;br /&gt;                        ++count_neu;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                // Close buffers&lt;br /&gt;                negative_buff_reader.close();&lt;br /&gt;                positive_buff_reader.close();&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;         &lt;br /&gt;         // Calculate percent values&lt;br /&gt;            percent_pos=count_pos/total_record_count*100;&lt;br /&gt;            percent_neg=count_neg/total_record_count*100;&lt;br /&gt;            percent_neu=count_neu/total_record_count*100;&lt;br /&gt;&lt;br /&gt;          try{           &lt;br /&gt;    // Write to the files&lt;br /&gt;             out_1st.writeBytes(&quot;\n&quot;+key_word);&lt;br /&gt;    out_1st.writeBytes(&quot;,&quot;+total_record_count);&lt;br /&gt;    out_1st.writeBytes(&quot;,&quot;+percent_neg);&lt;br /&gt;    out_1st.writeBytes(&quot;,&quot;+percent_pos);&lt;br /&gt;    out_1st.writeBytes(&quot;,&quot;+percent_neu);&lt;br /&gt;    &lt;br /&gt;    // Close file systems&lt;br /&gt;    out_1st.close();&lt;br /&gt;    get_filesys.close();&lt;br /&gt;          }catch(Exception e){&lt;br /&gt;           e.printStackTrace();&lt;br /&gt;          } &lt;br /&gt;        }        &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/text&gt;&lt;/text&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2014/11/sample-reduce-function-in-java-part-of.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-2022431714325934382</guid><pubDate>Thu, 06 Nov 2014 13:45:00 +0000</pubDate><atom:updated>2014-11-06T05:50:21.486-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Hadoop</category><category domain="http://www.blogger.com/atom/ns#">JAVA</category><category domain="http://www.blogger.com/atom/ns#">Map</category><category domain="http://www.blogger.com/atom/ns#">map reduce</category><title>Sample Map Function in JAVA (Part of Map Reduce)</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;u&gt;Map function splitting the data into chunks&lt;/u&gt;&lt;br /&gt;&lt;u&gt;&lt;/u&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*Program Starts&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;package com.mapreduce.devx;&lt;br /&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*Import Functions&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;import java.io.BufferedReader;&lt;br /&gt;import java.io.InputStreamReader;&lt;br /&gt;import java.net.URI;&lt;br /&gt;import java.util.StringTokenizer;&lt;br /&gt;import org.apache.commons.logging.Log;&lt;br /&gt;import org.apache.commons.logging.LogFactory;&lt;br /&gt;import org.apache.hadoop.conf.Configuration;&lt;br /&gt;import org.apache.hadoop.fs.FileSystem;&lt;br /&gt;import org.apache.hadoop.fs.Path;&lt;br /&gt;import org.apache.hadoop.io.LongWritable;&lt;br /&gt;import org.apache.hadoop.io.Text;&lt;br /&gt;import org.apache.hadoop.mapreduce.Mapper;&lt;br /&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*Class&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div align=&quot;center&quot; style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;public class DevXMap extends Mapper&lt;longwritable ext=&quot;&quot; text=&quot;&quot;&gt; {&lt;br /&gt; &lt;br /&gt; // Create Path, BufferedReader and Text variables&lt;br /&gt; Path file_path;&lt;br /&gt; BufferedReader buffer_reader;&lt;br /&gt; Text tweet_values = new Text();&lt;br /&gt;&amp;nbsp;/**&lt;br /&gt;  * @param key&lt;br /&gt;  * @param value&lt;br /&gt;  * @param context&lt;br /&gt;  */&lt;br /&gt; &lt;/longwritable&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;public void map(LongWritable key, Text value, Context context)&amp;nbsp; {  &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;try{&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;// Create configuration for Map&lt;br /&gt;Configuration map_config = new Configuration();&lt;br /&gt;&lt;br /&gt;// Load Hadoop core files in configuration&lt;br /&gt;map_config.addResource(new Path(&quot;/user/hadoop/core-site.xml&quot;));&lt;br /&gt;map_config.addResource(new Path(&quot;/user/hadoop/hdfs-site.xml&quot;)); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create variables&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String searchkeyword = &quot;&quot;;&lt;br /&gt;&lt;br /&gt;// Open file from the file path&lt;br /&gt;file_path=new Path(&quot;files/repository/keys.txt&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileSystem file_system = FileSystem.get(URI.create(&quot;files/repository/keys.txt&quot;),new Configuration());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;// Load buffer reader&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; buffer_reader=new BufferedReader(new InputStreamReader(file_system.open(file_path)));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(buffer_reader.ready())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { searchkeyword=buffer_reader.readLine().trim(); }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get key value&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final Text key_value = new Text(searchkeyword);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Check value and take decision&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(value == null)&lt;br /&gt;{&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;else{   &lt;br /&gt;StringTokenizer string_tokens = new StringTokenizer(value.toString(),&quot;,&quot;);&lt;br /&gt;int count = 0;&lt;br /&gt;&lt;br /&gt;while(string_tokens.hasMoreTokens()) {&lt;br /&gt;count ++;&lt;br /&gt;if(count &amp;lt;=1)&lt;br /&gt;continue;&lt;br /&gt;&lt;br /&gt;String new_tweet_value = string_tokens.nextToken().toLowerCase().trim().replaceAll(&quot;\\*&quot;,&quot;&quot;);&lt;br /&gt;&lt;br /&gt;if(new_tweet_value.contains(searchkeyword.toLowerCase().trim())) {         &lt;br /&gt;tweet_values.set(new_tweet_value);&lt;br /&gt;context.write(key_value,tweet_values);&lt;br /&gt;}   &lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;catch(Exception e){     &lt;br /&gt;e.printStackTrace();  &lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/div&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2014/11/sample-map-function-in-java.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-8975597555027341815</guid><pubDate>Thu, 08 Jul 2010 11:36:00 +0000</pubDate><atom:updated>2011-12-23T23:31:02.489-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">border</category><category domain="http://www.blogger.com/atom/ns#">swings</category><title>Border Layout</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;BorderLayout divides the container into five Geographical regions namely&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;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;&quot;&gt;North,South,East,West and Center.This is very commonly used Lyout&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;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;&quot;&gt;Manager.You can add at most one component to each region of a BorderLayout.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;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;&quot;&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=&quot;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;&quot;&gt;then add that panel to the border layout.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;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;&quot;&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=&quot;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;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;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;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SZ-_XLh1_SI/AAAAAAAAABo/85KuASBptzg/s1600-h/borderlayout.bmp&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5305169291018370338&quot; src=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SZ-_XLh1_SI/AAAAAAAAABo/85KuASBptzg/s320/borderlayout.bmp&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;Construcors:-&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;new BorderLayout();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;new BorderLayout(int hgap,int vgap);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Example&lt;/strong&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;Source Code:-&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import javax.swing.*;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import java.awt.*;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;class borderlayout extends JFrame{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public static void main(String a[]){&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;//initializing frames&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JFrame jf=new JFrame(&quot;BorderLayout&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JFrame jf1=new JFrame(&quot;BorderLayout&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;//initializing panels&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JPanel panel=new JPanel();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;//initializing buttons&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton jbn=new JButton(&quot;North&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton jbs=new JButton(&quot;South&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton jbe=new JButton(&quot;East&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton jbw=new JButton(&quot;West&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton jbc=new JButton(&quot;Central&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;//setting up layout&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.setLayout(new BorderLayout());&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.add(jbn,BorderLayout.NORTH);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.add(jbs,BorderLayout.SOUTH);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.add(jbe,BorderLayout.EAST);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.add(jbw,BorderLayout.WEST);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.add(jbc,BorderLayout.CENTER);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;//adding to frame&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;jf.getContentPane().add(panel);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;jf.setSize(250,200);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;jf.setVisible(true);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2010/07/border-layout.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-2327944381727136717</guid><pubDate>Thu, 08 Jul 2010 11:35:00 +0000</pubDate><atom:updated>2010-07-08T04:35:36.797-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>Card Layout Manager</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Costructors&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;:-&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public CardLayout(); //Constructor creates new CardLayout&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Following are the methods to switch between cards that are in stack of layout.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;1.void first(Container parent) //Display first card&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;2.void last(Container parent) //Display last card&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;3.void next(Container parent) //Display next card&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;4.void previous(Container parent) //Display previous card&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;5.void first(Container parent,String name) //Display specified card&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Example&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;code snippet:-&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;/*&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;CardLayout c1;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JButton jb 1;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;cardlayout()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame jf1=new JFrame(&quot;Card Layout demo&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JButton jb1=new JButton(&quot;Next Button&amp;gt;&amp;gt;&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JButton jb2=new JButton(&quot;Last Button&amp;gt;&amp;gt;&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;CardLayout c1=new CardLayout();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.setLayout(c1);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(&quot;button1&quot;,jb1);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(&quot;button2&quot;,jb2);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;jb1.addActionListener(this);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;jb2.addActionListener(this);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;jf1.getContentPane().add(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;jf1.setVisible(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;jf1.setSize(200,200);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c1.next(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}*/&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/card-layout-manager.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-5506679398701292855</guid><pubDate>Thu, 08 Jul 2010 11:35:00 +0000</pubDate><atom:updated>2010-07-11T19:23:47.130-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">grid</category><category domain="http://www.blogger.com/atom/ns#">swings</category><title>Grid Bag Layout</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;GridBagConstraints&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Object and specify the&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;GridBagLayout&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;manager object with the&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&amp;nbsp;setConstraint()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;method, to associate the constraint with the component.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;The&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;GridBagLayout&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;GridBagLayout&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;object and is determined by the currently set&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;GridBagConstraints&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;object,you need to create the&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;GridBagConstraints&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;object before the layout can be built.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagLayout g=new GridBagLayout();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints cons=new GridBagConstraints();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;You can assign following values to&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;GridBagConstraints&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;attributes:-&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;anchor:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.CENTER&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.NORTH&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.NORTHEAST&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.EAST&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.SOUTHEAST&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.SOUTH&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.SOUTHWEST&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.WEST&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.NORTHWEST&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;fill:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.NONE&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.HORIZONTAL&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.VERTICAL&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.BOTH&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;gridwidth,gridheight:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.REMAINDER&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints.RELATIVE&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;gridx,gridy:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;insets:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;ipadx,ipady:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;weightx,weighty:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SaK0vte5D9I/AAAAAAAAABw/qyJBA436F9g/s1600-h/gridbaglayout.bmp&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5306002042751881170&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SaK0vte5D9I/AAAAAAAAABw/qyJBA436F9g/s320/gridbaglayout.bmp&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Example&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Source code:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.event.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class GridBagWindow extends JFrame {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;boolean inAnApplet = true;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;final boolean shouldFill = true;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;final boolean shouldWeightX = true;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public GridBagWindow() {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JButton button;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Container contentPane = getContentPane();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagLayout gridbag = new GridBagLayout();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagConstraints c = new GridBagConstraints();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;contentPane.setLayout(gridbag);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;if (shouldFill) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//natural height, maximum width&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.fill = GridBagConstraints.HORIZONTAL;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;button = new JButton(&quot;Button 1&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;if (shouldWeightX) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.weightx = 0.5;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridx = 0;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridy = 0;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;contentPane.add(button);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;button = new JButton(&quot;2&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridx = 1;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridy = 0;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;contentPane.add(button);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;button = new JButton(&quot;Button 3&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridx = 2;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridy = 0;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;contentPane.add(button);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;button = new JButton(&quot;Long-Named Button 4&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.ipady = 40; //make this component tall&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.weightx = 0.0;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridwidth = 3;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridx = 0;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridy = 1;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;contentPane.add(button);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;button = new JButton(&quot;Button 5&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.ipady = 0; //reset to default&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.weighty = 1.0; //request any extra vertical space&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.anchor = GridBagConstraints.SOUTH; //bottom of space&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.insets = new Insets(10,0,0,0); //top padding&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridx = 1; //aligned with button 2&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridwidth = 2; //2 columns wide&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;c.gridy = 2; //third row&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;gridbag.setConstraints(button, c);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;contentPane.add(button);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;addWindowListener(new WindowAdapter() {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public void windowClosing(WindowEvent e) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;if (inAnApplet) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;dispose();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;} else {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;System.exit(0);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;});&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;GridBagWindow window = new GridBagWindow();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;window.inAnApplet = false;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;window.setTitle(&quot;GridBagLayout&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;window.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;window.setVisible(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/grid-bag-layout.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-8899078083111651955</guid><pubDate>Thu, 08 Jul 2010 11:34:00 +0000</pubDate><atom:updated>2010-07-08T04:34:38.356-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">jbutton</category><category domain="http://www.blogger.com/atom/ns#">swings</category><title>JButton</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;JButton&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&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=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;JButton Class&lt;/span&gt;&amp;nbsp;has following&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;constructors:-&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;JButton() // Creates a button with no text or icon&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;times new roman&#39;; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton(Action a) //Creates a button where are properties are tak&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;en from action supplied&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;JButton(Icon icon)//Creates a button with a icon&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;JButton(String text)//Creates a button with some text&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;JButton(String text ,Icon icon)//Creates button with both text and icon&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;Features of JButton:-&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;1.JButton applies event handling.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;2.JButton has a different look and feel for enabled and disabled buttons.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;3.You can set mnemonics for JButtons.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;4.TooltipText can also be set for JButtons.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;Following&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;example&lt;/span&gt;&lt;/span&gt;&amp;nbsp;shows the application of all above mentioned features:-&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;In this example there are buttons which on click disable and enable the corresponding buttons.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;The program follows:-&lt;/div&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5306299690214809090&quot; src=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/SaPDdEsE3gI/AAAAAAAAACA/-Y8gV1N9-BU/s320/buttondemo2.bmp&quot; style=&quot;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;&quot; /&gt;&lt;div style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5306299102185889890&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SaPC62HDoGI/AAAAAAAAAB4/DLwqHvIhFM8/s320/buttondemo.bmp&quot; style=&quot;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;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;import javax.swing.*;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;import java.awt.event.*;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;public class ButtonDemo extends JPanel&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;implements ActionListener {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;protected JButton but1, but2, but3;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;public ButtonDemo() {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;ImageIcon leftButtonIcon = createImageIcon(&quot;d:/image/left.gif&quot;);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;ImageIcon middleButtonIcon = createImageIcon(&quot;c:/image/middle.gif&quot;);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;ImageIcon rightButtonIcon = createImageIcon(&quot;c:/image/right.gif&quot;);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but1 = new JButton(&quot;Disable middle button&quot;, leftButtonIcon);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but1.setActionCommand(&quot;disable&quot;);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//setting up mnemonics&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but1.setMnemonic(KeyEvent.VK_D);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but2 = new JButton(&quot;Middle button&quot;, middleButtonIcon);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but2.setMnemonic(KeyEvent.VK_M);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but3 = new JButton(&quot;Enable middle button&quot;, rightButtonIcon);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//Use the default text position of CENTER, TRAILING (RIGHT).&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but3.setMnemonic(KeyEvent.VK_E);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but3.setActionCommand(&quot;enable&quot;);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//enabling the command button&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but3.setEnabled(false);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//Listeners for actions on buttons 1 and 3.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but1.addActionListener(this);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but3.addActionListener(this);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but1.setToolTipText(&quot;Click this button to disable the middle button.&quot;);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but3.setToolTipText(&quot;Click this button to enable the middle button.&quot;);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//Add Components to this container, using the default FlowLayout.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;add(but1);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;add(but2);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;add(but3);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;public void actionPerformed(ActionEvent e) {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;if (&quot;disable&quot;.equals(e.getActionCommand())) {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but2.setEnabled(false);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but1.setEnabled(false);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but3.setEnabled(true);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;} else {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but2.setEnabled(true);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but1.setEnabled(true);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;but3.setEnabled(false);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;/** Returns an ImageIcon, or null if the path was invalid. */&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;protected static ImageIcon createImageIcon(String path) {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;java.net.URL imgURL = ButtonDemo.class.getResource(path);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;if (imgURL != null) {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;return new ImageIcon(imgURL);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;} else {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;System.err.println(&quot;Couldn&#39;t find file: &quot; + path);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;return null;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;// Create the GUI.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;private static void createAndShowGUI() {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//Create and set up the JFrame.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;JFrame frame = new JFrame(&quot;ButtonDemo&quot;);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//Create and set up the content pane.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;ButtonDemo newContentPane = new ButtonDemo();&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;newContentPane.setOpaque(true); //content panes must be opaque&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;frame.setContentPane(newContentPane);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//Display the JFrame.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;frame.pack();&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;frame.setVisible(true);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;public static void main(String[] args) {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//creating and showing this application&#39;s GUI.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;javax.swing.SwingUtilities.invokeLater(new Runnable() {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;public void run() {&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;createAndShowGUI();&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;});&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2010/07/jbutton.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-7906812036719802690</guid><pubDate>Thu, 08 Jul 2010 11:34:00 +0000</pubDate><atom:updated>2010-07-08T04:34:02.557-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">jlable</category><category domain="http://www.blogger.com/atom/ns#">swings</category><title>JLabel</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabels in Swing can contain text, images or both.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel do not generate an action event though&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;it works on Mouse Events.Like MouseMotion,MouseListener etc.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;We can also add non-functional labels in our interface(GUI).&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;You can also specify the position of the text relative to the image.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Also we can align,specify border,size and many more properties.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Constructors:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel class has following Constructors&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel()&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&amp;nbsp;//&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;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;&quot;&gt;Creates&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;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;&quot;&gt;a&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;JLabel&amp;nbsp;&lt;/span&gt;without an image and with empty string title&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel(Icon icon)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&amp;nbsp;//Creates a JLabel instance with specified image as title&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel(Icon image,int horizontalAlignment)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;// Creates a JLabel object with image and alignment&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel(String text)//JLabel with some text as title&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel(String text,Icon image,int horizontalAlignment)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel(String text ,int horizontalalignment)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Example:-&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SaS_BOXNwXI/AAAAAAAAACI/1wIHd21nVWs/s1600-h/simplelabel.bmp&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5306576288705528178&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SaS_BOXNwXI/AAAAAAAAACI/1wIHd21nVWs/s400/simplelabel.bmp&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;The following exmaple is for simple label showing only text:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;public class SimpleJLabel extends JFrame{&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;public static void main(String[] args) {&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel label = new JLabel(&quot;A Simple Text Label&quot;);&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JFrame frame = new JFrame();&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;frame.getContentPane().add(label);&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;frame.pack();&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;frame.setVisible(true);&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Example:-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;The Following Example shows setting up an Icon on Label&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SaS_BNauCBI/AAAAAAAAACQ/d-z8wVVBFaU/s1600-h/labelpic.bmp&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5306576288451790866&quot; src=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SaS_BNauCBI/AAAAAAAAACQ/d-z8wVVBFaU/s400/labelpic.bmp&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;public class SimpleJLabel extends JFrame{&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;public static void main(String[] args) {&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JLabel label = new JLabel();&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;label.setIcon(new ImageIcon(&quot;e1.png&quot;));&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JFrame frame = new JFrame();&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;frame.getContentPane().add(label);&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;frame.pack();&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;frame.setVisible(true);&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;You can also set many more properties like mnemonics,tooltiptext alignment etc.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/jlabel.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-6580987408223676600</guid><pubDate>Thu, 08 Jul 2010 11:33:00 +0000</pubDate><atom:updated>2010-07-08T04:33:31.428-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">jtext</category><category domain="http://www.blogger.com/atom/ns#">swings</category><title>JTextField</title><description>&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;JTextField&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&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=&quot;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;&quot;&gt;The text field is editable. It is handy in cases&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;where a single line of input is required or a little information is neede.&lt;/div&gt;&lt;div style=&quot;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;&quot;&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=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;Constructors:-&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;JTextField has four types of constructors which are as follows&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;1.JTextField()&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;2.JTextField(String) &amp;nbsp;//Creates a TextField with initial text as String&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&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=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;4.JTextField(int) &amp;nbsp; //creates s TextField with length &amp;nbsp;of column being chars.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&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&#39;s preferred size changes whenever the text changes, which can result in unwanted layout changes.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;Example:-&lt;/span&gt;Creating a form with JTextField&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5309969687436659794&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SbDNTBvBDFI/AAAAAAAAADA/Audl15udp5o/s400/textfield.bmp&quot; style=&quot;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;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;//textfield.java&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;import javax.swing.*;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;class textfield extends JFrame{&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;public static void main(String a[]){&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&amp;nbsp;&amp;nbsp;JFrame frame=new JFrame(&quot;JTextFieldDemo&quot;);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&amp;nbsp;&amp;nbsp;JPanel panel=new JPanel();&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&amp;nbsp;&amp;nbsp;JTextField txt=new JTextField(10);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&amp;nbsp;&amp;nbsp;JTextField txtf=new JTextField(&quot;Default&quot;,20); &amp;nbsp; //with default text written and size of 20&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&amp;nbsp;&amp;nbsp;panel.add(txt);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&amp;nbsp;&amp;nbsp;panel.add(txtf);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&amp;nbsp;&amp;nbsp;frame.getContentPane().add(panel);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&amp;nbsp;&amp;nbsp;frame.setVisible(true);&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&amp;nbsp;&amp;nbsp;frame.pack();&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;We have several methods&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;for getting and setting values from and to JTextField&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;1.String getText()&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;2.void setText(String)&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;Edit methods of JTextField component&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;1.void setEditable(boolean) &amp;nbsp;//set whether the text in the JTextField is editable or not&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;2. boolean isEditable() &amp;nbsp; //returns whether the tetfield is editable or not&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;For setting and getting the width of JTextField use&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;void setColumns(int) &amp;nbsp;//specifies the width of textfield&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;int getColumns() &amp;nbsp;//obtains number of columns of the TextField&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;For selecting whole field at once use following&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;void selectAll()&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;For adding ActionListeners use following&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;void addActionListener(ActionListener)&lt;/span&gt;&amp;nbsp;&amp;nbsp;//adds action listener&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;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;&quot;&gt;void removeActionListener(ActionListener)&lt;/span&gt;&amp;nbsp;&amp;nbsp;//removes ActionListener&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2010/07/jtextfield.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-8116479288337155781</guid><pubDate>Thu, 08 Jul 2010 11:32:00 +0000</pubDate><atom:updated>2010-07-08T04:32:54.065-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>Setting ToolTip and Icon</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Adding Icons and ToolTips&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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 &quot;click here&quot; the if your pointer comes over button the a small message will appear saying &quot;click here&quot;.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;For setting ToolTip we can use setToolTipText() method of JComponent class.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;ToolTip Example:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/ScHYqyCNLlI/AAAAAAAAAFo/upDWSEksdU4/s1600-h/tooltip.jpg&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5314767264771026514&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/ScHYqyCNLlI/AAAAAAAAAFo/upDWSEksdU4/s400/tooltip.jpg&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;// tooltip.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class tooltip&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[])&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frm=new JFrame(&quot;ToolTip Demo&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JLabel labeltool=new JLabel(&quot;ToolTio DemoPlace mouse over it&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;labeltool.setToolTipText(&quot;This is ToolTip&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(labeltool);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.getContentPane().add(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.setVisible(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;SettingIcon Example:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;// settingicon.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/ScHaJ4s6iZI/AAAAAAAAAFw/dNNQDgxnHlI/s1600-h/settingicon.bmp&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5314768898648344978&quot; src=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/ScHaJ4s6iZI/AAAAAAAAAFw/dNNQDgxnHlI/s400/settingicon.bmp&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class settingicon&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[])&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frm=new JFrame(&quot;Setting Icon Demo&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JLabel label=new JLabel(new ImageIcon(&quot;BAK.png&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(label);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.getContentPane().add(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.setVisible(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/setting-tooltip-and-icon.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-2088703422762159254</guid><pubDate>Thu, 08 Jul 2010 11:32:00 +0000</pubDate><atom:updated>2010-07-08T04:32:32.329-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>Setting Mnemonics and Shortcut Keys</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Setting a Shrotcut Key(Mnemonic)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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 &#39;s&#39; then in order to activate control press Alt+s.You can set mnemonic by using setMnemonic(Char ch)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Syntax:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/ScHtjG2ifgI/AAAAAAAAAF4/0UF5f-ydZec/s1600-h/mnemonic.bmp&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5314790222664465922&quot; src=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/ScHtjG2ifgI/AAAAAAAAAF4/0UF5f-ydZec/s400/mnemonic.bmp&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;component.setMnemonic(Char ch);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Exapmle:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;In the Screen shot the mnemonic is set as &#39;M&#39;.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;So this button can be activated by pressing Alt+M.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;// memonic.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class mnemonic&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[])&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frm=new JFrame(&quot;Mnemonic Demo&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JButton Button=new JButton(&quot;Setting Mnemonic&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Button.setMnemonic(&#39;M&#39;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(Button);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.getContentPane().add(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.setVisible(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/setting-mnemonics-and-shortcut-keys.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-7782280350381798484</guid><pubDate>Thu, 08 Jul 2010 11:32:00 +0000</pubDate><atom:updated>2010-07-08T04:32:12.420-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>DropDown Menu or Choice menu</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;DropDown Menu or The Choice class&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Constructor:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;// Choice();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;creating an object of Choice class&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;e.g. Choice choice=new Choice();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Adding Items:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Items in the list of menu are added by using addItem(String Item) method.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;e.g. choice.addItem(&quot;Option 1&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SeLQESa1x2I/AAAAAAAAAH0/7S5_jCEPVvQ/s1600-h/choice.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5324046481587816290&quot; src=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SeLQESa1x2I/AAAAAAAAAH0/7S5_jCEPVvQ/s400/choice.JPG&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Example:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//choice.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class choice&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[])&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Frame frm=new Frame(&quot;Choice menu demo&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Panel panel=new Panel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Choice choice=new Choice();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.add(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;choice.addItem(&quot;Option 1&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;choice.addItem(&quot;Option 2&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;choice.addItem(&quot;Option 3&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;choice.addItem(&quot;Option 4&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(new Label(&quot;This is DropDown MENU&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(choice);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.show();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.setBounds(100,100,250,200);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Useful Methods of Choice Class:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SeMNU_EgpuI/AAAAAAAAAH8/z59N8yuaMPE/s1600-h/choice+table.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5324113838660953826&quot; src=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SeMNU_EgpuI/AAAAAAAAAH8/z59N8yuaMPE/s400/choice+table.JPG&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2010/07/dropdown-menu-or-choice-menu.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-2956583129363588625</guid><pubDate>Thu, 08 Jul 2010 11:31:00 +0000</pubDate><atom:updated>2010-07-08T04:31:22.169-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>How to create and use Check Boxes</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Constructors:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;There are five constructors of CheckBox&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;1.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Checkbox()&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;--&amp;gt; Creates a check box with an empty string for its label.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;2.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Checkbox(String label, boolean state)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;--&amp;gt; Creates a check box with the specified label and sets the specified state.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;3.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Checkbox(String label)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;--&amp;gt; Creates a check box with the specified label.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;4.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Checkbox(String label, boolean state, CheckboxGroup group)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;5.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Checkbox(String label, CheckboxGroup group, boolean state)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Example:-This simple swing example illustrates how checkboxes are added.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//test.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SeWjgg6moGI/AAAAAAAAAIM/hc9H308v1F0/s1600-h/checkbox.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5324841913422356578&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SeWjgg6moGI/AAAAAAAAAIM/hc9H308v1F0/s400/checkbox.JPG&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class test{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String[] args){&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frame = new JFrame(&quot;Check Box Frame&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JCheckBox chkop1 = new JCheckBox(&quot;option 1&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JCheckBox chkop2 = new JCheckBox(&quot;option 2&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JCheckBox chkop3 = new JCheckBox(&quot;option 3&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(chkop1);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(chkop2);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(chkop3);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.getContentPane().add(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.setVisible(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Selecting Checkboxes:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;In this example the checkboxes are default selected using setSelected(boolean state) method of JCheckBox class.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//test1.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SeWk4GevwmI/AAAAAAAAAIU/7LbnBDE-gmk/s1600-h/setselected+in+checkbox.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5324843418154680930&quot; src=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SeWk4GevwmI/AAAAAAAAAIU/7LbnBDE-gmk/s400/setselected+in+checkbox.JPG&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class test{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String[] args){&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frame = new JFrame(&quot;Check Box Frame&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JCheckBox chkop1 = new JCheckBox(&quot;option 1&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;chkop1.setSelected(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JCheckBox chkop2 = new JCheckBox(&quot;option 2&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;chkop2.setSelected(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JCheckBox chkop3 = new JCheckBox(&quot;option 3&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(chkop1);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(chkop2);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(chkop3);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.getContentPane().add(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.setVisible(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Other useful methods:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;setLabel()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;:-Sets Label as provided string to this CheckBox.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;getLabel()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;:-Returns Label of CheckBox.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;addItemListener()&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;:-Only ItemListeners can be added to CheckBox control for event handling purposes.&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/how-to-create-and-use-check-boxes.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-6768485989457621175</guid><pubDate>Thu, 08 Jul 2010 11:30:00 +0000</pubDate><atom:updated>2010-07-08T04:30:58.349-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>How to Use CheckBoxGroup</title><description>&lt;div class=&quot;post-body&quot; id=&quot;post-8321995201923508123&quot; style=&quot;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;&quot;&gt;&lt;div style=&quot;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;&quot;&gt;CheckboxGroup class is used to group togather the Checkboxes,from which only one can be selected at a time.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;That is exactly one Checkbox in that goup will be &quot;on&quot; else remain &quot;false&quot;.By clicking on Checkbox we may &quot;on&quot; or &quot;off&quot; the desired Checkbox.This control is mostly used in making selection ,where exactly one selection is needed form given choices.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;more on Checkboxes Visit Checkbox Tutorial&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;Constructor:-&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;CheckboxGroup() ---&amp;gt; Creates a new instance of CheckboxGroup.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;Important Methods:-&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;void getSelectedCheckbox() ----&amp;gt; Gets the current choice from this check box group.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;void setSelectedCheckbox(Checkbox cb) ----&amp;gt; Turn &quot;on&quot; the specified CheckBox.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;How to Use CheckboxGroup:-&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SeylVszijNI/AAAAAAAAAJI/G9TR4UfkmpI/s1600-h/checkboxgroup.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5326814251495623890&quot; src=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SeylVszijNI/AAAAAAAAAJI/G9TR4UfkmpI/s400/checkboxgroup.JPG&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;Example:-&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;// test.java&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import javax.swing.*;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import java.awt.*;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public class test{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public static void main(String[] args){&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JFrame frame = new JFrame(&quot;Check Box Frame&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;CheckboxGroup cb=new CheckboxGroup();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Checkbox chkop1 = new Checkbox(&quot;option1&quot;,false,cb);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Checkbox chkop2 = new Checkbox(&quot;option2&quot;,false,cb);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Checkbox chkop3 = new Checkbox(&quot;option3&quot;,true,cb);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JPanel panel=new JPanel();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.add(chkop1);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.add(chkop2);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.add(chkop3);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frame.getContentPane().add(panel);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frame.pack();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frame.setVisible(true);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;post-footer&quot; style=&quot;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;&quot;&gt;&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2010/07/how-to-use-checkboxgroup.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-1676164091189440010</guid><pubDate>Thu, 08 Jul 2010 11:30:00 +0000</pubDate><atom:updated>2010-07-08T04:30:35.731-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>Using JTextField and JTextArea</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;TextFields are used to take input from user also it can be used to display results.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;The various constructors and methods are defined in the previous JTextField tutorials.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Values from a TextField is extracted using String&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;getText()&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;and set using&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;void&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;setText(String txt).&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;The user can select a portion from the JTextField and JTextArea using&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;String&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;getSelectedText()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;void select(int start_index,int end_index)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;String getSelectedText()&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;retrurns the String portion selected by the user from the textfield.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;setEditable(boolean value)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;to true else set false.If you want to get value of editable TextField use&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;boolean isEditable()&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;void&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;setEchoChar(Char ch)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;character you specified in &#39;ch&#39; will be shown when some charater is typed.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;If you want to get the Charcter specified the use&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;char&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;getEchoChar()&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Example :-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;getting selected value from a text field and displaying it to other and use of Password field.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;// textfield.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/SflslLsG5TI/AAAAAAAAAKw/ZgtgJHrLVzQ/s1600-h/textfield.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5330411020018443570&quot; src=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/SflslLsG5TI/AAAAAAAAAKw/ZgtgJHrLVzQ/s320/textfield.JPG&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.event.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class textfield extends JFrame implements ActionListener&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frame;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JTextField txtname,txtdisplay;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;TextField txtpass;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JButton button;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public textfield()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame=new JFrame(&quot;Text Field usage demo&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;txtname=new JTextField(25);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;txtpass=new TextField(25);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;txtpass.setEchoChar(&#39;#&#39;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;txtdisplay =new JTextField(25);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JButton button=new JButton(&quot;Display selected&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;button.addActionListener(this);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.setLayout(new GridLayout(3,2));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(new JLabel(&quot;Name :&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(txtname);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(new JLabel(&quot;Password :&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(txtpass);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(txtdisplay);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(button);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.getContentPane().add(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.show();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;txtdisplay.setText(&quot;Name :&quot;+txtname.getSelectedText()+&quot; Pass :&quot;+txtpass.getText());&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[])&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;new textfield();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Example:-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;getting selected value from a text area and displaying selected in textfield.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;// textarea.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SflslIekWVI/AAAAAAAAAKo/ntr13RsE1lA/s1600-h/textarea.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5330411019156347218&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SflslIekWVI/AAAAAAAAAKo/ntr13RsE1lA/s320/textarea.JPG&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.event.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class textarea extends JFrame implements ActionListener&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frame;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JTextField txtname,txtdisplay;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;TextField txtpass;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JTextArea area;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JButton button;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public textarea()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame=new JFrame(&quot;Text Area usage demo&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;txtdisplay =new JTextField(25);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;area = new JTextArea(&quot;vaibhav pandey has made this programme&quot;,5,5);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JButton button=new JButton(&quot;Display selected&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;button.addActionListener(this);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(area);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(txtdisplay);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(button);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.getContentPane().add(panel);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.show();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;txtdisplay.setText(&quot;Selected String :&quot;+area.getSelectedText());&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[])&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;new textarea();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}.&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/using-jtextfield-and-jtextarea.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-6378107350709037141</guid><pubDate>Thu, 08 Jul 2010 11:30:00 +0000</pubDate><atom:updated>2010-07-08T04:30:09.096-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><category domain="http://www.blogger.com/atom/ns#">util</category><title>Loading Image on JFrame using JFileChooser</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JFileChooser&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;is a very handy utility in java Swings to choose any particular file of an extension.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Example (Source code ):-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//imageloading.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//Program developed by Vaibhav Pandey&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.image.BufferedImage;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.io.File;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.io.IOException;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.sql.SQLException;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.util.logging.Level;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.util.logging.Logger;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.imageio.ImageIO;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.ImageIcon;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.JFileChooser;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.JFrame;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.JLabel;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.JOptionPane;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class imageloading extends JFrame&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;BufferedImage mImage;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;String name,name1;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public imageloading()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frm=new JFrame(&quot;image loading test&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;String source=filechoose();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;File inputFile = new File(source);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;try {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;mImage = ImageIO.read(inputFile);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;} catch (IOException ex) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//Logger.getLogger(index.class.getName()).log(Level.SEVERE, null, ex);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JLabel lb=new JLabel(new ImageIcon(mImage));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.getContentPane().add(lb);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.show();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.pack();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;String filechoose()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFileChooser chooser = new JFileChooser();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;chooser.setCurrentDirectory(new File(&quot;.&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;chooser.setFileFilter(new javax.swing.filechooser.FileFilter() {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public boolean accept(File f) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;name = f.getName().toLowerCase();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;return name.endsWith(&quot;.gif&quot;) || name.endsWith(&quot;.jpg&quot;)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;|| name.endsWith(&quot;.jpeg&quot;) || f.isDirectory();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public String getDescription() {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;return &quot;Image files&quot;;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;});&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;int r = chooser.showOpenDialog(this);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;if (r == JFileChooser.APPROVE_OPTION) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;name1 = chooser.getSelectedFile().getAbsolutePath();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;StringBuffer sb=new StringBuffer();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;sb.append(name1);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;int l=sb.length();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;for(int i=0;i&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;{&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;if(sb.charAt(i)==&#39;\\&#39;)&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;{&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;sb.insert(i, &quot;\\&quot;);i++;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;return name1;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;public static void main(String a[])&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;{&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;new imageloading();&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;}&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;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;&quot;&gt;Output&amp;nbsp;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;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;&quot;&gt;Windows:-&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Following first widow shows the&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;JFileChooser&lt;/span&gt;() instance opened and asking to&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;l;i++) style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;/l;i++)&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SgHRChtKiiI/AAAAAAAAALc/oWdWiGiylPA/s1600-h/imageloading1.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5332773275121125922&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SgHRChtKiiI/AAAAAAAAALc/oWdWiGiylPA/s400/imageloading1.JPG&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SgHRauFntjI/AAAAAAAAALk/2jHKVIymYtg/s1600-h/imageloading2.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5332773690761786930&quot; src=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SgHRauFntjI/AAAAAAAAALk/2jHKVIymYtg/s320/imageloading2.JPG&quot; style=&quot;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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Elaboration:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;In the given code we have used the&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;ImageIO&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;ImageIcon&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;to display it on the frame.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JFileChooser&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;() is used to choose the files of desired extension here&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;FileFilter()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;method is used to filter the files on the basis of extensions .Here we have considered only .jpeg and .gif images.Since the &#39;/&#39; is treated as a escape sequence in&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a class=&quot;kLink&quot; href=&quot;http://www.javasync.com/search/label/Java%20Swings#&quot; id=&quot;KonaLink1&quot; style=&quot;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;&quot; target=&quot;undefined&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;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;&quot;&gt;Java&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;thus in when we are fetching path name in variable &#39;name1&#39; using method &#39;J&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;FileChoose.getSelectedFile().getAbsolutePath()&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&#39; ,in order to omit the escape sequence we embed &#39;//&#39; in the path when we have some path selected.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;We have used &#39;JFileChooser.APPROVE_OPTION&#39; 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;</description><link>http://sasajava.blogspot.com/2010/07/loading-image-on-jframe-using.html</link><author>noreply@blogger.com (Unknown)</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></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-1786757161244624993</guid><pubDate>Thu, 08 Jul 2010 11:29:00 +0000</pubDate><atom:updated>2010-07-08T04:29:35.123-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>Menus In Java Swings</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Menu&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;CheckboxMenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;First look at the constructors involved in creation of a menubar application.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;1. MenuBar:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;MenuBar is the highest class in this application and it will contain all the menu&#39;s inside it.It has only default constructor.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//MenuBar () only default constructor&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;2.Menu:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;The constructors for Menu is as following.Menu&#39;s object will hold menu item&#39;s in them.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//Menu()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//Menu(String optionName)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//Menu(String optionName,boolean Removable)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;3.MenuItem:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;The Individual menuitems are of type MenuItem .These controls are to be placed on Menu object.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//MenuItem()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//MenuItem(String itemName)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//MenuItem(String itemName,MenuShortcut key)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;4.CheckboxMenuItem:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//CheckboxMenuItem()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//CheckboxMenuItem(String itemName)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//CheckboxMenuItem(String itemName,boolean on)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Important Methods:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;There are methods with various functionality lets see&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&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=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;3.void setLabel(String newName):-This method changes the name of a menuitem.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;4.String getLabel():-It returns the name of the menuitem.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;5.boolean getState():-This method returns the value (checked or unchecked) of&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;CheckboxMenuItem object.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;6.void setState(boolean checked):-You can set the value of CheckboxMenuItem to true or false using this method.&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/menus-in-java-swings.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-2705983015662590398</guid><pubDate>Thu, 08 Jul 2010 11:28:00 +0000</pubDate><atom:updated>2010-07-08T04:28:46.565-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>How to create MenuBar Steps</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;How to create Menu and&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_0&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBars&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Step wise procedure&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;1.Create an object of&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_1&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;class:&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_2&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;can be attached a Frame and it will be displayed just below the title bar.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_3&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_4&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;=new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_5&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;2.Call the method&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_6&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;setMenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_7&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;):-This method is used to attach the&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_8&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;to a Frame.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_9&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;setMenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_10&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;3.Create objects of the Menu class for each menu you want to add on menu bar.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Menu file=new Menu(&quot;File&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Menu edit=new Menu(&quot;Edit&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Menu help=new Menu(&quot;Help&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;4.Call add() method of&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_11&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;class to add each menu object to the menu.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_12&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.add(file);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SiDmXLCAtDI/AAAAAAAAAMc/qI-EUjA3AJg/s1600-h/menu+initial.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5341522443834012722&quot; src=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SiDmXLCAtDI/AAAAAAAAAMc/qI-EUjA3AJg/s400/menu+initial.JPG&quot; style=&quot;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: 237px; 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: 246px;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_13&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.add(edit);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_14&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.add(help);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;5.Create object of&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_15&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;or&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_16&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;CheckboxMenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;class for each sub menu item.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_17&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;save =new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_18&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;Save&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_19&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_20&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;newf&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;=new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_21&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;New&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_22&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;open =new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_23&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;Open&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_24&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;CheckboxMenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_25&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;cbm&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;=new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_26&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;CheckboxMenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;check&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;6.Call add() method of Menu class to add each menu item to its appropriate menu.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;file.add(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_27&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;newf&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;file.add(open);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;file.add(save);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Complete Example :-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SiDmXcm0ikI/AAAAAAAAAMk/908wpOleSS8/s1600-h/menu+selected.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5341522448551807554&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SiDmXcm0ikI/AAAAAAAAAMk/908wpOleSS8/s400/menu+selected.JPG&quot; style=&quot;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: 262px; 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: 248px;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-corrected&quot; id=&quot;SPELLING_ERROR_28&quot; style=&quot;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;&quot;&gt;Source&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&amp;nbsp;Code:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_29&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MyMenubar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_30&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MyMenubar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[])&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Frame frame=new Frame(&quot;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_31&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Demo&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_32&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_33&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;=new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_34&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_35&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;setMenuBar&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_36&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Menu file=new Menu(&quot;File&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Menu edit=new Menu(&quot;Edit&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Menu help=new Menu(&quot;Help&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Menu options=new Menu(&quot;Options&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_37&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.add(file);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_38&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.add(edit);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_39&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;mb&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.add(help);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_40&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;save =new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_41&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;Save&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_42&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_43&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;newf&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;=new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_44&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;New&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_45&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;open =new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_46&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;Open&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_47&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;CheckboxMenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_48&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;cbm&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;=new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_49&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;CheckboxMenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;check&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;file.add(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_50&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;newf&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;file.add(open);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SiDmXA4m4WI/AAAAAAAAAMU/4YJbNB2bGlo/s1600-h/checkboxmenuitem.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5341522441110217058&quot; src=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SiDmXA4m4WI/AAAAAAAAAMU/4YJbNB2bGlo/s400/checkboxmenuitem.JPG&quot; style=&quot;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: 239px; 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: 243px;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;file.add(save);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;file.add(options);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;options.add(new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_51&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;Font&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;options.add(new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_52&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;Size&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;options.add(new&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_53&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;MenuItem&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(&quot;Color&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;edit.add(&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_54&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;cbm&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_55&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;cbm&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_56&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;setState&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_57&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;cbm&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_58&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;setEnabled&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(false);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;open.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_59&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;setEnabled&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(false);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_60&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;setVisible&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_61&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;setSize&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;(300,300);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/how-to-create-menubar-steps.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_1CvsF-MJpr4/SiDmXLCAtDI/AAAAAAAAAMc/qI-EUjA3AJg/s72-c/menu+initial.JPG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-169406080597526320</guid><pubDate>Thu, 08 Jul 2010 11:28:00 +0000</pubDate><atom:updated>2010-07-08T04:28:05.254-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><category domain="http://www.blogger.com/atom/ns#">util</category><title>How to create pop-up menus in Java</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Pop-up menus are the menus that are displayed when a user clicks the right mouse button.They are sometimes also known as short-cut menus.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Short cut menus are very handy in cases where some functionality you want to provide like adding a help menu to all controls on right click.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Step for creating Pop-up menus:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;1.Create an object of the JPopupMenu class.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;2.Create object of the Menu class for each menu you want to add on the menu bar.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;3.Call the add() method of the JPopupMenu class to add each menu object to the pop-up menu.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;4.Create objects of the JMenuItem or CheckboxMenuItem class for each item that you want to in the menu.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;5.Call the add() method of the Menu class to add each item to its appropriate menu.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/Sjt2xd4ItPI/AAAAAAAAAM4/lCpHS4KUmso/s1600-h/popup.JPG&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5348999574638343410&quot; src=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/Sjt2xd4ItPI/AAAAAAAAAM4/lCpHS4KUmso/s400/popup.JPG&quot; style=&quot;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: 208px; 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: 287px;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Example Source code:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//PopUpColorMenu.java&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.event.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class PopUpColorMenu&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Component selectedComponent;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public PopUpColorMenu( ) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frame = new JFrame(&quot;PopUpColorMenu v1.0&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;final JPopupMenu colorMenu = new JPopupMenu(&quot;Color&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;colorMenu.add(makeMenuItem(&quot;Red&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;colorMenu.add(makeMenuItem(&quot;Green&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;colorMenu.add(makeMenuItem(&quot;Blue&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;MouseListener mouseListener = new MouseAdapter( ) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public void mousePressed(MouseEvent e) { checkPopup(e); }&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public void mouseClicked(MouseEvent e) { checkPopup(e); }&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public void mouseReleased(MouseEvent e) { checkPopup(e); }&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;private void checkPopup(MouseEvent e) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;if (e.isPopupTrigger( )) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;selectedComponent = e.getComponent( );&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;colorMenu.show(e.getComponent(), e.getX( ), e.getY( ));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.getContentPane( ).addMouseListener(mouseListener);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.setSize(200,50);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frame.setVisible(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;private JMenuItem makeMenuItem(String label) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JMenuItem item = new JMenuItem(label);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;return item;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String[] args) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;new PopUpColorMenu( );&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/how-to-create-pop-up-menus-in-java.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_1CvsF-MJpr4/Sjt2xd4ItPI/AAAAAAAAAM4/lCpHS4KUmso/s72-c/popup.JPG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-7889293819824499215</guid><pubDate>Thu, 08 Jul 2010 11:27:00 +0000</pubDate><atom:updated>2010-07-08T04:27:27.792-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>Adding Border in Swing Application componenets</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;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;&quot;&gt;The&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;Border&lt;/span&gt;&amp;nbsp;class is in&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;javax.swing.border&lt;/span&gt;&amp;nbsp;package.Make sure you have imported the package before using&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;borders&lt;/span&gt;&amp;nbsp;in your application.You can add&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;borders&lt;/span&gt;&amp;nbsp;to components by using&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;setBorder()&lt;/span&gt;&amp;nbsp;method.This method has been declared in JComponent class and is available for all the components.Method&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;getBorder()&lt;/span&gt;&amp;nbsp;gives the name of border for the component.&lt;span style=&quot;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;&quot;&gt;Borders&lt;/span&gt;&amp;nbsp;add look and feel in your components.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;BorderFactory&lt;/span&gt;&amp;nbsp;class is used to create borders for a component.&lt;span style=&quot;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;&quot;&gt;Border&lt;/span&gt;&lt;span style=&quot;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;&quot;&gt;Factory&lt;/span&gt;&amp;nbsp;class has been declared in&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;javax.swing&lt;/span&gt;package and contains method for creating various types of borders.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;You can use following borders:-&lt;/span&gt;&lt;/div&gt;&lt;ul style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 12px; line-height: 1.6em; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 12px; padding-left: 30px; padding-right: 0px; padding-top: 12px; text-align: justify;&quot;&gt;&lt;li style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 8px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Line Border&lt;/li&gt;&lt;li style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 8px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Etched Border&lt;/li&gt;&lt;li style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 8px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Bevel Border&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;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;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Example for Line Border:-&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import java.awt.*;&lt;a href=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/SlQnGQjqZRI/AAAAAAAAANY/X1fX0B6Xmqg/s1600-h/line+border.jpg&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5355948845327607058&quot; src=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/SlQnGQjqZRI/AAAAAAAAANY/X1fX0B6Xmqg/s400/line+border.jpg&quot; style=&quot;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: 101px; 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: 201px;&quot; /&gt;&lt;/a&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import javax.swing.*;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import javax.swing.border.*;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import javax.swing.BorderFactory.*;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public class bordertest extends JFrame{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public bordertest(){&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JFrame frm=new JFrame(&quot;Border Test&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton button=new JButton(&quot;Line Border&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Border line=BorderFactory.createLineBorder(new Color(0,0,0),3);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;button.setBorder(line);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frm.getContentPane().add(button);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frm.show();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frm.setSize(200,100);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public static void main(String a[]){&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;new bordertest();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;createLineBorder()&lt;/span&gt;&amp;nbsp;method is used to create a black line border that is three pixels wide.The&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;setBorder()&amp;nbsp;&lt;/span&gt;method is used to set the line border for the button.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;Etched Border:-&lt;/span&gt;Replace the above code by following code from line 6.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;/*&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton button=new JButton(&quot;Etched Border&quot;);&lt;a href=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SlQnGj2ODWI/AAAAAAAAANg/pNRIWMx71Pc/s1600-h/etched+border.jpg&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5355948850505715042&quot; src=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SlQnGj2ODWI/AAAAAAAAANg/pNRIWMx71Pc/s400/etched+border.jpg&quot; style=&quot;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: 100px; 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: 201px;&quot; /&gt;&lt;/a&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Border etched=BorderFactory.createEtchedBorder();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;button.setBorder(etched);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;*/&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;createEtchedBorder()&amp;nbsp;&lt;/span&gt;method is used to create Etched Border.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;Bevel Border:-&lt;/span&gt;Bevel Border are of two types raised and lowered.You need to specify in the method&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;createBevelBorder()&amp;nbsp;&lt;/span&gt;which border you want.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/SlQnGwyUJ9I/AAAAAAAAANo/_p44yXEQ_Qo/s1600-h/bevel+lowered.jpg&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5355948853978998738&quot; src=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/SlQnGwyUJ9I/AAAAAAAAANo/_p44yXEQ_Qo/s400/bevel+lowered.jpg&quot; style=&quot;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: 100px; 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: 201px;&quot; /&gt;&lt;/a&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;Bevel Border Lowered:-&lt;/span&gt;Replace the line Border code by following code from line 6.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;/*&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton button=new JButton(&quot;Bevel Border&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Border bevellower=BorderFactory.createBevelBorder(BevelBorder.LOWERED);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;button.setBorder(bevellower);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;*/&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SlQnHJ68W4I/AAAAAAAAANw/iCznlU-w530/s1600-h/bevel+raised+border.jpg&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5355948860726074242&quot; src=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SlQnHJ68W4I/AAAAAAAAANw/iCznlU-w530/s400/bevel+raised+border.jpg&quot; style=&quot;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: 100px; 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: 201px;&quot; /&gt;&lt;/a&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;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;&quot;&gt;Bevel Border Raised:-&lt;/span&gt;Replace the line Border code by following code from line 6.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;/*&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton button=new JButton(&quot;Bevel Border&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Border bevelraised=BorderFactory.createBevelBorder(BevelBorder.RAISED);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;button.setBorder(bevelraised);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;*/&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Note:-Remove Comments from all the code before use.&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2010/07/adding-border-in-swing-application.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_1CvsF-MJpr4/SlQnGQjqZRI/AAAAAAAAANY/X1fX0B6Xmqg/s72-c/line+border.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-2251146587020527180</guid><pubDate>Thu, 08 Jul 2010 11:26:00 +0000</pubDate><atom:updated>2010-07-08T04:26:56.702-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>Using Tabbed Panes in Java Swings</title><description>&lt;div style=&quot;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;&quot;&gt;Tabbed panes are just like property sheets in windows environment.Using tabbed pane you can create multiple panels that are visible in a single area.A Tabbed pane consist of series of Tabs.These tabs are present on the basis of categories of information or&amp;nbsp;&lt;a class=&quot;kLink&quot; href=&quot;http://www.javasync.com/search/label/Java%20Swings#&quot; id=&quot;KonaLink0&quot; style=&quot;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;&quot; target=&quot;undefined&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;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;&quot;&gt;application&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;they contain.A tabbed pane enables you to display information in a small area in a more effective manner.The JTabbedPane class of javax.swing package is used to create Tabbed panes.Tabbed panes are effective way to use the window area.Tabbed Panes looks like following:-&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SlW6I1_xCxI/AAAAAAAAAN4/9qYKrlKXBes/s1600-h/tabbedpane.jpg&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5356391992923327250&quot; src=&quot;http://4.bp.blogspot.com/_1CvsF-MJpr4/SlW6I1_xCxI/AAAAAAAAAN4/9qYKrlKXBes/s400/tabbedpane.jpg&quot; style=&quot;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: 200px; 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: 201px;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SlW6JHHhYFI/AAAAAAAAAOA/ZxgVH01s_us/s1600-h/tabbedpane1.jpg&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5356391997519257682&quot; src=&quot;http://1.bp.blogspot.com/_1CvsF-MJpr4/SlW6JHHhYFI/AAAAAAAAAOA/ZxgVH01s_us/s400/tabbedpane1.jpg&quot; style=&quot;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: 200px; 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;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Tabbed Pane source code:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class Tabbedpane extends JFrame{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[]){&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//creating a container JFrame&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frm=new JFrame(&quot;Tabbed Pane&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//Creating Tabbedpane&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JTabbedPane jtpn=new JTabbedPane();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel color=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//adding panel to a tabbed pane&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;jtpn.addTab(&quot;Color&quot;,null,color,&quot;Color info&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;color.add(new JLabel(&quot;The color is not set yet&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel sound=new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//adding panel to a tabbed pane&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;jtpn.addTab(&quot;Sound&quot;,null,sound,&quot;Sound info&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;sound.add(new JLabel(&quot;The sound is off&quot;));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;//adding component to the container&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.getContentPane().add(jtpn);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.setBounds(200,200,200,200);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.show();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JTabbedPane class is used to ceate JTabbedPane oblect.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;For adding a JPanel to a JTabbedPane method named addTab() is used.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Four parameters of addTab() method are:-&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;1.Label for Tab.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;2.Image(if any otherwise null).&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;3.Component to be added to the Tabbed pane.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;4.ToolTip for the tab.&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/using-tabbed-panes-in-java-swings.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_1CvsF-MJpr4/SlW6I1_xCxI/AAAAAAAAAN4/9qYKrlKXBes/s72-c/tabbedpane.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-5487206670929066072</guid><pubDate>Thu, 08 Jul 2010 11:26:00 +0000</pubDate><atom:updated>2010-07-08T04:26:22.213-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>How to Set Icons on Swing Buttons</title><description>&lt;div style=&quot;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;&quot;&gt;Swing Buttons provides many exclusive features that are not found in the Button class defined in the AWT package.Swing Buttons are the subclass of AbstractButton class,which extends JComponent.You can always associate an icon of your choice with a Swing Button.The Icons are set as program runs or set when some event is fired like button pressed.AbstractButton class contains many methods that allow you to control the behaviour of buttons,check boxes and Radio Buttons.There is the way you can set the icon on the swing button and it is through the JButton constructor.&lt;/div&gt;&lt;div style=&quot;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;&quot;&gt;&lt;div style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;Despite of being set by constructor we can change the Icon of our Button whenever some action is fired or some condition is met.We can define different Icons when button :-&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;1.is disabled&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;2.is pressed&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;3.is selected(for radio buttons etc)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;4.gets mouse focus&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton class is responsible for creation of all types of push buttons whether with icons or with text or both.The constructor used to create Button with Icon is&lt;/div&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;div style=&quot;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: center;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JButton(Icon i)&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;div style=&quot;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: left;&quot;&gt;But if you also want to add Text with Icon then the constructor will be&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;div style=&quot;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: center;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;JButton(Str&lt;/span&gt;&lt;span style=&quot;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;&quot;&gt;ing s ,Icon i)&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;div style=&quot;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: left;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;div style=&quot;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;&quot;&gt;In case you forgot to add text and you want to add text to the button whenever you want then use following method with JButton object.&lt;/div&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;div style=&quot;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: center;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;setText(S&lt;/span&gt;&lt;span style=&quot;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;&quot;&gt;tring str)&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;div style=&quot;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: left;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;div style=&quot;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;&quot;&gt;The following example will help in understanding how to set Icons and how you can change them according to your need.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import javax.swing.*;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import java.awt.event.*;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;import javax.swing.AbstractButton;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public class ButtonImage extends JFrame implements ActionListener&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JButton button;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public ButtonImage()&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JFrame frm = new JFrame(&quot;Icon on Button&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;JPanel panel = new JPanel();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;color: red; 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;&quot;&gt;ImageIcon imageicon = new ImageIcon(&quot;d:\\Anmtd_Feed.gif&quot;);&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;ImageIcon im = new ImageIcon(&quot;d:\\snap.jpg&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;ImageIcon img = new ImageIcon(&quot;e:\\softwares\\ICON gallery\\Icons-1\\128 x 128\\apple1 (1).ico&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;button = new JButton(imageicon);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;button.setText(&quot;The Feed Icon&quot;);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;panel.add(button);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;button.addActionListener(this);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;color: red; 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;&quot;&gt;button.setDisabledIcon(im);&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;span style=&quot;color: red; 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;&quot;&gt;button.setRolloverIcon(img);&lt;/span&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frm.getContentPane().add(panel);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frm.setVisible(true);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;frm.setBounds(100,100,250,150);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public void actionPerformed(ActionEvent ae)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;if (ae.getSource()==button)&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;button.setEnabled(false);&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;public static void main(String a[])&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;{&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;new ButtonImage();&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;}&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;This is first output Frame.In example it is shown that how we can change the button image when the button is disabled or whenever mouse moves over it.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;The method&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;setDisabledIcon(Icon i)&lt;/span&gt;&amp;nbsp;and&amp;nbsp;&lt;span style=&quot;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;&quot;&gt;setRolloverIcon(Icon i)&amp;nbsp;&lt;/span&gt;changes icons when the button is disabled or Hovered by Mouse respectively.ImageIcon is just a class which implements the Icon interface thus we are passing here ImageIcon as it is more convenient to use and most of all it implements Icon interface.&lt;/div&gt;&lt;span style=&quot;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;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SxV_kS3C7AI/AAAAAAAAASE/KvKu4EnHkS8/s1600/icons+on+button.jpg&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5410370788870253570&quot; src=&quot;http://3.bp.blogspot.com/_1CvsF-MJpr4/SxV_kS3C7AI/AAAAAAAAASE/KvKu4EnHkS8/s320/icons+on+button.jpg&quot; style=&quot;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: 155px; 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: 249px;&quot; /&gt;&lt;/a&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;div style=&quot;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;&quot;&gt;You can check on your own just change the Icon or Image paths then when the button is pressed the button is disabled and the image is changed once the button is disabled then there is no way you can change the icon of the button.That is why move mouse over the button first to test and then press the button.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2010/07/how-to-set-icons-on-swing-buttons.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_1CvsF-MJpr4/SxV_kS3C7AI/AAAAAAAAASE/KvKu4EnHkS8/s72-c/icons+on+button.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-4946407386862793472</guid><pubDate>Thu, 08 Jul 2010 11:25:00 +0000</pubDate><atom:updated>2010-07-08T04:25:45.125-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">swings</category><title>How to use Swing Scroll Panes</title><description>&lt;div style=&quot;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: left;&quot;&gt;A Scroll Pane is a component like JFrame or JPanel which is used to add other components but Scroll Pane has a Scroll Bar Associated with it which is a unique characteristic of this component Container.Scroll Panes are implemented in swing by JScrollPane class ,which extends JComponent class.Scroll Bar is either Vertical or Horizontal and they are used in Scroll Panes as needed.Like if you want to display the Scroll Bars all the time then you may use them always and also you might choose them to show up when container overflows.&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Constructors used to create the Scroll Pane in Swings are :-&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #3333ff; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;JScrollPane(Component cmp)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #3333ff; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;JScrollPane(int vert, int horiz)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #3333ff; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;JScrollPane(Component cmp, int vert, int horiz)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Remember:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;A window can not be added to a Scroll Pane like JFrame cannot be added to a JScrollPane,but JPanel and other similar containers can be used which are not windows.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;In above constructors cmp is the component to be added on the ScrollPane.vert and horiz are the integer constants that are defined when the horizontal or vertical ScrollBars are shown in the ScrollPane.These constants are defined in ScrollPaneConstants interface.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Some example constants are :-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #3333ff; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;1.VERTICAL_SCROLLBAR_ALWAYS (Always shows up vertical scrollbar)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #3333ff; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;2.VERTICAL_SCROLLBAR_AS_NEEDED(Shows&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #3333ff; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&amp;nbsp;up vertical Scrollbar when needed)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #3333ff; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;3.HORIZONTAL_SCROLLBAR_ALWAYS (Always shows up horizontal scrollbar)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #3333ff; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;4.HORIZONTAL_SCROLLBAR_AS_NEEDED(Shows up horizontal Scrollbar when needed)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Lets take a look at following example which lets you learn how to create and use JScrollPanes in your applications.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import java.awt.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;import javax.swing.*;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class Scrollpanedemo extends JFrame&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public Scrollpanedemo()&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JFrame frm = new JFrame(&quot;Scroll Pane demo&quot;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JPanel panel = new JPanel();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.setLayout(new GridLayout(20,5));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;for(int i=0;i&amp;lt;100;i++)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;panel.add(new JButton(&quot;Button no. &quot; + (i+1)));&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;JScrollPane jsp = new JScrollPane(panel,v,h);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.getContentPane().add(jsp);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.setBounds(400,200,380,310);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;frm.setVisible(true);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[])&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;new Scrollpanedemo();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;In the above example we create a frame and add a scrollpane over it.Then we create a panel which contains all the components and add it to the scrollpane.We have used the AS_NEEDED constants since we want to show that when our scrollpane overflows then the Scroll Bars shows up.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/SxajU9ZyPAI/AAAAAAAAASM/AqSFa2qWkYw/s1600-h/scroll+pane+demo.jpg&quot; style=&quot;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;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5410691582807653378&quot; src=&quot;http://2.bp.blogspot.com/_1CvsF-MJpr4/SxajU9ZyPAI/AAAAAAAAASM/AqSFa2qWkYw/s400/scroll+pane+demo.jpg&quot; style=&quot;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: 309px; 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: 376px;&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://sasajava.blogspot.com/2010/07/how-to-use-swing-scroll-panes.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_1CvsF-MJpr4/SxajU9ZyPAI/AAAAAAAAASM/AqSFa2qWkYw/s72-c/scroll+pane+demo.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-7444880649016094493</guid><pubDate>Thu, 08 Jul 2010 11:24:00 +0000</pubDate><atom:updated>2010-07-08T04:24:43.446-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">OPERATOR</category><title>The &quot; ? &quot; Operator</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Java includes a special Three-way(Ternary) operator that can replace certain types of if-then-else statements.These statements include assignment when certain conditions are fulfilled.This operator is &quot; ? &quot;.The working of &quot; ? &quot; operator is similar as in C,C++ and C#.The &quot; ? &quot; operator at first look might seem confusing but it is extremely useful in particular conditions when mastered.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;General Syntax :-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;expression 1 ? expression 2 : expression 3&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;Here expression 1 can be any expression that evaluates to a Boolean value.If expression 1 is true then expression 2 is evaluated else expression 3 is evaluated.Both the expressions expression 1 and expression 2 must have a return type,they can never be void.Make it more clear by understanding below example.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Example:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public class optest&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;public static void main(String a[])&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;int ratio=0,num=20,denom=10;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;/* The &quot; ? &quot; operator assignes 0 if condition denom==0 is true else it assigns num/denom to ratio if condituion is false*/&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;ratio=denom==0?0:num/denom;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;System.out.println(&quot;The ratio is &quot;+ratio);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Output:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;The ratio is 2&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;span style=&quot;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;&quot;&gt;Explanation:-&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;When&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&lt;a class=&quot;kLink&quot; href=&quot;http://www.javasync.com/#&quot; id=&quot;KonaLink0&quot; style=&quot;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;&quot; target=&quot;undefined&quot;&gt;&lt;span style=&quot;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;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;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;&quot;&gt;Java&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4c4c4c; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px;&quot;&gt;evaluates this assignment expression ,it first looks at the expression to the left of the question mark.If denom equals to zero then expression 2 between ? and : is evaluated else last expression is evaluated.The resultant is then assigned to the ratio variable used in expression 1.&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/operator.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-305516462606604883.post-4306720501160670942</guid><pubDate>Thu, 08 Jul 2010 11:21:00 +0000</pubDate><atom:updated>2010-07-08T04:22:34.560-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Game Java 176x208</category><category domain="http://www.blogger.com/atom/ns#">Game Java 176x220</category><category domain="http://www.blogger.com/atom/ns#">Game Java 240x320</category><category domain="http://www.blogger.com/atom/ns#">Game Nokia</category><category domain="http://www.blogger.com/atom/ns#">Game Sony Ericsson</category><title>Java Game Aladdin</title><description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;Have an adventure with Aladdin and his Princess Jasmin, with the&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://draft.blogger.com/post-edit.g?blogID=305516462606604883&amp;amp;postID=4306720501160670942&quot; id=&quot;AdBriteInlineAd_help&quot; name=&quot;AdBriteInlineAd_help&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://files.adbrite.com/mb/images/green-double-underline-006600.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; color: #006600; cursor: pointer; margin-bottom: -2px; padding-bottom: 2px; text-decoration: none;&quot; target=&quot;_top&quot;&gt;help&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;of Genie.... Game based on the legendary&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://draft.blogger.com/post-edit.g?blogID=305516462606604883&amp;amp;postID=4306720501160670942&quot; id=&quot;AdBriteInlineAd_Disney&quot; name=&quot;AdBriteInlineAd_Disney&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://files.adbrite.com/mb/images/green-double-underline-006600.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; color: #006600; cursor: pointer; margin-bottom: -2px; padding-bottom: 2px; text-decoration: none;&quot; target=&quot;_top&quot;&gt;Disney&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://draft.blogger.com/post-edit.g?blogID=305516462606604883&amp;amp;postID=4306720501160670942&quot; id=&quot;AdBriteInlineAd_movie&quot; name=&quot;AdBriteInlineAd_movie&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: initial; background-image: url(http://files.adbrite.com/mb/images/green-double-underline-006600.gif); background-origin: initial; background-position: 50% 100%; background-repeat: repeat no-repeat; color: #006600; cursor: pointer; margin-bottom: -2px; padding-bottom: 2px; text-decoration: none;&quot; target=&quot;_top&quot;&gt;movie&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;of the same name.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif; font-size: small; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;a href=&quot;http://downloadlinkapplikasiponsel.blogspot.com/2010/07/aladdin.html&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #6aa84f;&quot;&gt;Download Java Game Aladdin&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</description><link>http://sasajava.blogspot.com/2010/07/java-game-aladdin.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item></channel></rss>