<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5834495443794667662</id><updated>2012-01-26T22:07:54.951+08:00</updated><category term='EzIcon'/><category term='child'/><category term='point'/><category term='package'/><category term='borderlayout'/><category term='hex'/><category term='free'/><category term='command prompt'/><category term='robot'/><category term='hash'/><category term='removed'/><category term='on'/><category term='buttongroup'/><category term='fullscreen'/><category term='jpg'/><category term='api'/><category term='pause'/><category term='cd tray'/><category term='put'/><category term='gridlayout'/><category term='tooltiptext'/><category term='array'/><category term='prime'/><category term='jtextfield'/><category term='joptionpane'/><category term='set'/><category term='mouse'/><category term='timer'/><category term='copy'/><category term='---KaliRagavendran---'/><category term='radian'/><category term='gradient'/><category term='line'/><category term='jpanel'/><category term='sort'/><category term='while'/><category term='gif'/><category term='contain'/><category term='type'/><category term='jlayer'/><category term='java'/><category term='lock'/><category term='selected'/><category term='field'/><category term='capital'/><category term='title'/><category term='caret'/><category term='memory'/><category term='maximum'/><category term='mutable'/><category term='jpasswordfield'/><category term='amount'/><category term='letter'/><category term='rotate'/><category term='primitive'/><category term='scroll bar'/><category term='output'/><category term='palindrome'/><category term='echo'/><category term='substring'/><category term='text'/><category term='metal'/><category term='bit depth'/><category term='pixel'/><category term='radians'/><category term='selection'/><category term='shutdown'/><category term='circle'/><category term='mp3'/><category term='combo box'/><category term='character'/><category term='visible'/><category term='error'/><category term='label'/><category term='jcheckbox'/><category term='loop'/><category term='list'/><category term='jlist'/><category term='drive'/><category term='add'/><category term='folder'/><category term='recursive'/><category term='import'/><category term='transparent'/><category term='detect'/><category term='application'/><category term='resized'/><category term='png'/><category term='length'/><category term='splash'/><category term='grid'/><category term='interface'/><category term='programmer'/><category term='rectangle'/><category term='sound'/><category term='superclass'/><category term='start'/><category term='java memory heap'/><category term='compare'/><category term='computer'/><category term='uppercase'/><category term='draw'/><category term='ternary operator'/><category term='image'/><category term='code'/><category term='menu'/><category term='index of'/><category term='square'/><category term='current'/><category term='message box'/><category term='screen'/><category term='scale'/><category term='flowlayout'/><category term='number'/><category term='validate'/><category term='program'/><category term='refresh'/><category term='size'/><category term='button'/><category term='degree'/><category term='thread'/><category term='tip'/><category term='replace'/><category term='click'/><category term='print'/><category term='clone'/><category term='jradiobutton'/><category term='added'/><category term='slider'/><category term='decompiler'/><category term='container'/><category term='jframe'/><category term='wav'/><category term='source code'/><category term='exception'/><category term='hexadecimal to binary'/><category term='read only'/><category term='moved'/><category term='remove jframe title bar'/><category term='management'/><category term='digit'/><category term='oval'/><category term='calendar'/><category term='square root'/><category term='clear'/><category term='display'/><category term='italic'/><category term='swing'/><category term='hotel'/><category term='word'/><category term='method'/><category term='word wrap'/><category term='date'/><category term='triangle'/><category term='jar'/><category term='jtextarea'/><category term='binary'/><category term='windows 7'/><category term='jwindow'/><category term='location'/><category term='windows xp'/><category term='cursor'/><category term='programmers'/><category term='window'/><category term='maximize'/><category term='keyboard'/><category term='---Santosh Rai---'/><category term='group'/><category term='integer'/><category term='get'/><category term='alphabet'/><category term='jtogglebutton'/><category term='file chooser'/><category term='stop'/><category term='select'/><category term='ignore'/><category term='floating'/><category term='heap'/><category term='jpeg'/><category term='object'/><category term='second'/><category term='receive'/><category term='jslider'/><category term='move'/><category term='radio button'/><category term='component'/><category term='awt'/><category term='bar'/><category term='color'/><category term='symbol'/><category term='boxlayout'/><category term='components'/><category term='release'/><category term='user input'/><category term='tick'/><category term='terminate'/><category term='hover'/><category term='remove'/><category term='++i'/><category term='modal'/><category term='invisible'/><category term='whitespace'/><category term='center'/><category term='jlabel'/><category term='minute'/><category term='converter'/><category term='borderless'/><category term='look and feel'/><category term='full'/><category term='change'/><category term='directory'/><category term='magnifier'/><category term='press'/><category term='hour'/><category term='string'/><category term='download'/><category term='for'/><category term='lowercase'/><category term='text field'/><category term='class'/><category term='hide'/><category term='open'/><category term='check box'/><category term='layout'/><category term='background'/><category term='gridbaglayout'/><category term='file'/><category term='default'/><category term='total'/><category term='jcombobox'/><category term='sentence'/><category term='i++'/><category term='database'/><category term='hold'/><category term='jbutton'/><category term='key'/><category term='element'/><category term='platform'/><category term='char'/><category term='determine'/><category term='counter'/><category term='convert'/><category term='synchronized'/><category term='simple'/><category term='jvm'/><category term='font'/><category term='menu bar'/><category term='jfilechooser'/><category term='rate'/><category term='time'/><category term='uimanager'/><category term='bold'/><category term='close'/><category term='mode'/><category term='combination'/><category term='rgb'/><category term='running'/><category term='omit'/><category term='clock'/><category term='runtime'/><category term='play'/><category term='icon'/><category term='search'/><category term='exit'/><category term='pathname'/><category term='PHI'/><category term='handling'/><category term='digital'/><category term='text area'/><category term='data'/><category term='JAutorunKiller'/><category term='password'/><title type='text'>JAVA2EVERYONE</title><subtitle type='html'>Share your java knowledge here !!!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default?start-index=101&amp;max-results=100'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>364</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-958167097492463509</id><published>2011-01-30T06:52:00.001+08:00</published><updated>2011-01-30T07:13:39.904+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='converter'/><category scheme='http://www.blogger.com/atom/ns#' term='wav'/><category scheme='http://www.blogger.com/atom/ns#' term='mp3'/><category scheme='http://www.blogger.com/atom/ns#' term='convert'/><title type='text'>Create Java MP3 To Wav Converter</title><content type='html'>&lt;iframe title="YouTube video player" class="youtube-player" type="text/html" width="560" height="345" src="http://www.youtube.com/embed/_wIvXsuF-DE" frameborder="0" allowFullScreen&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : MainClass.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;script src="http://pastebin.com/embed_js.php?i=qHjM6TEh"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SwingWorker.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;script src="http://pastebin.com/embed_js.php?i=Q2tPqWdJ"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-958167097492463509?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/958167097492463509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2011/01/create-java-mp3-to-wav-converter.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/958167097492463509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/958167097492463509'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2011/01/create-java-mp3-to-wav-converter.html' title='Create Java MP3 To Wav Converter'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/_wIvXsuF-DE/default.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8623328889668950027</id><published>2010-12-23T16:08:00.000+08:00</published><updated>2010-12-23T16:08:29.323+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='check box'/><category scheme='http://www.blogger.com/atom/ns#' term='jcheckbox'/><category scheme='http://www.blogger.com/atom/ns#' term='click'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><title type='text'>Select all JCheckBox in one click</title><content type='html'>Watch video below :&lt;br /&gt;&lt;object width="560" height="340"&gt;&lt;param name="movie" value="http://www.youtube.com/v/33OXVvzqVf4?fs=1&amp;amp;hl=en_US&amp;amp;color1=0x2b405b&amp;amp;color2=0x6b8ab6"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/33OXVvzqVf4?fs=1&amp;amp;hl=en_US&amp;amp;color1=0x2b405b&amp;amp;color2=0x6b8ab6" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JCheckBoxMultipleSelectInOneClick.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;import javax.swing.JCheckBox;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;&lt;br /&gt;import java.awt.GridLayout;&lt;br /&gt;&lt;br /&gt;import java.awt.event.ActionListener;&lt;br /&gt;import java.awt.event.ActionEvent;&lt;br /&gt;&lt;br /&gt;public class JCheckBoxMultipleSelectInOneClick extends JFrame implements ActionListener&lt;br /&gt;{&lt;br /&gt; //Create JCheckBox object&lt;br /&gt; JCheckBox a=new JCheckBox("Select All");&lt;br /&gt; JCheckBox b=new JCheckBox("Car");&lt;br /&gt; JCheckBox c=new JCheckBox("Lorry");&lt;br /&gt; JCheckBox d=new JCheckBox("Motorcycle");&lt;br /&gt; &lt;br /&gt; //Constructor for JCheckBoxMultipleSelectInOneClick class&lt;br /&gt; public JCheckBoxMultipleSelectInOneClick()&lt;br /&gt; {&lt;br /&gt;  //Set JFrame title&lt;br /&gt;  super("Select All JCheckBox In One Click");&lt;br /&gt;  &lt;br /&gt;  //Set JFrame layout&lt;br /&gt;  setLayout(new GridLayout(4,1));&lt;br /&gt;  &lt;br /&gt;  //Add action listener to JCheckBox a&lt;br /&gt;  a.addActionListener(this);&lt;br /&gt;  &lt;br /&gt;  //Add JCheckBox into JFrame&lt;br /&gt;  add(a);&lt;br /&gt;  add(b);&lt;br /&gt;  add(c);&lt;br /&gt;  add(d);&lt;br /&gt;  &lt;br /&gt;  //Set JFrame's default close operation when click on close window button&lt;br /&gt;  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;  &lt;br /&gt;  //Set JFrame size&lt;br /&gt;  setSize(400,400);&lt;br /&gt;  &lt;br /&gt;  //Make JFrame locate at the center of screen&lt;br /&gt;  setLocationRelativeTo(null);&lt;br /&gt;  &lt;br /&gt;  //Make JFrame visible to see&lt;br /&gt;  setVisible(true);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; //Override actionPerformed method in ActionListener interface&lt;br /&gt; public void actionPerformed(ActionEvent e)&lt;br /&gt; {&lt;br /&gt;  if(e.getSource()==a)&lt;br /&gt;  {&lt;br /&gt;   //Set all JCheckBox to select when JCheckBox a is select  &lt;br /&gt;   if(a.isSelected()==true)&lt;br /&gt;   {&lt;br /&gt;    b.setSelected(true);&lt;br /&gt;    c.setSelected(true);&lt;br /&gt;    d.setSelected(true);&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   //Set all JCheckBox to unselect when JCheckBox a is select &lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;    b.setSelected(false);&lt;br /&gt;    c.setSelected(false);&lt;br /&gt;    d.setSelected(false);&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; //Main method where this program start&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  JCheckBoxMultipleSelectInOneClick myFirstObject = new JCheckBoxMultipleSelectInOneClick();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8623328889668950027?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8623328889668950027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2010/12/select-all-jcheckbox-in-one-click.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8623328889668950027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8623328889668950027'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2010/12/select-all-jcheckbox-in-one-click.html' title='Select all JCheckBox in one click'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5785034129691057077</id><published>2010-12-21T18:58:00.001+08:00</published><updated>2010-12-21T20:53:46.143+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='play'/><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><category scheme='http://www.blogger.com/atom/ns#' term='jlayer'/><category scheme='http://www.blogger.com/atom/ns#' term='mp3'/><title type='text'>A Java Program To Play A MP3 File Using JLayer</title><content type='html'>Watch video tutorial below :&lt;br /&gt;&lt;object width="560" height="340"&gt;&lt;param name="movie" value="http://www.youtube.com/v/f-7cgX_I220?fs=1&amp;amp;hl=en_US&amp;amp;color1=0x006699&amp;amp;color2=0x54abd6"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/f-7cgX_I220?fs=1&amp;amp;hl=en_US&amp;amp;color1=0x006699&amp;amp;color2=0x54abd6" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : TestPlay.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre class="Java" name="code"&gt;import javazoom.jl.player.Player;&lt;br /&gt;import java.io.FileInputStream;&lt;br /&gt;&lt;br /&gt;public class TestPlay&lt;br /&gt;{&lt;br /&gt;    public static void main(String[]args)&lt;br /&gt;    {&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            FileInputStream fis=new FileInputStream("C:\\Documents and Settings\\UserXP\\Desktop\\01-flo_rida_(feat_david_guetta)-clab_cant_handle_me.mp3");&lt;br /&gt;            Player playMp3=new Player(fis);&lt;br /&gt;&lt;br /&gt;            playMp3.play();&lt;br /&gt;        }&lt;br /&gt;        catch(Exception e)&lt;br /&gt;        {&lt;br /&gt;            System.out.println(e);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5785034129691057077?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5785034129691057077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2010/12/java-program-to-play-mp3-file-using.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5785034129691057077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5785034129691057077'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2010/12/java-program-to-play-mp3-file-using.html' title='A Java Program To Play A MP3 File Using JLayer'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5219892381366912400</id><published>2010-09-14T21:59:00.000+08:00</published><updated>2010-09-14T21:59:49.194+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows 7'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='folder'/><category scheme='http://www.blogger.com/atom/ns#' term='directory'/><category scheme='http://www.blogger.com/atom/ns#' term='open'/><title type='text'>Open folder or directory in Windows 7 using java</title><content type='html'>Complete source code below will show you, how to open folder through java in Windows 7.&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : OpenFolderInJava.java&lt;br /&gt;Thank you to &lt;a href="http://project-einstein.com/u/ankur/"&gt;Ankur Pandya&lt;/a&gt; for this source codes.&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;/// file OpenFolderInJava.java ////&lt;br /&gt;&lt;br /&gt;import java.util.*;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.awt.Desktop;&lt;br /&gt;&lt;br /&gt;class OpenFolderInJava{&lt;br /&gt;&lt;br /&gt;public static void main(String[] arg){&lt;br /&gt;String path = "."; // path to the directory to be opened&lt;br /&gt;File file = new File("C:\\");&lt;br /&gt;Desktop desktop = null;&lt;br /&gt;// Before more Desktop API is used, first check&lt;br /&gt;// whether the API is supported by this particular&lt;br /&gt;// virtual machine (VM) on this particular host.&lt;br /&gt;if (Desktop.isDesktopSupported()) {&lt;br /&gt;desktop = Desktop.getDesktop();&lt;br /&gt;}&lt;br /&gt;try {&lt;br /&gt;desktop.open(file);&lt;br /&gt;}&lt;br /&gt;catch (IOException e){&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/// end of file ///&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE&lt;br /&gt;************************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5219892381366912400?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5219892381366912400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2010/09/open-folder-or-directory-in-windows-7.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5219892381366912400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5219892381366912400'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2010/09/open-folder-or-directory-in-windows-7.html' title='Open folder or directory in Windows 7 using java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-7296064787113219200</id><published>2010-09-10T11:47:00.001+08:00</published><updated>2010-09-10T12:22:41.001+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='letter'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='play'/><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><category scheme='http://www.blogger.com/atom/ns#' term='on'/><category scheme='http://www.blogger.com/atom/ns#' term='click'/><title type='text'>Java Play Sound When Click On Letter</title><content type='html'>&lt;object width="400" height="258"&gt;&lt;param name="movie" value="http://www.youtube.com/v/zs1ZZpRo16M?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x5d1719&amp;amp;color2=0xcd311b&amp;amp;border=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/zs1ZZpRo16M?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x5d1719&amp;amp;color2=0xcd311b&amp;amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="258"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;a href="http://www.mediafire.com/file/ee8thgr09joitea/Play%20Sound%20When%20Click%20On%20Letter.rar"&gt;Click here to download complete file from file sharing website.&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-7296064787113219200?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7296064787113219200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7296064787113219200'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2010/09/java-play-sound-when-click-on-letter.html' title='Java Play Sound When Click On Letter'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8798872135805441691</id><published>2010-04-02T12:07:00.002+08:00</published><updated>2010-04-02T12:12:48.003+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='data'/><category scheme='http://www.blogger.com/atom/ns#' term='---Santosh Rai---'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>How To Retrieve Data Into Database</title><content type='html'>&lt;div&gt;Contributor : Santosh Rai&lt;/div&gt;&lt;div&gt;Program Description : How To Retrieve Data Into Database&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;a href="http://www.ziddu.com/download/9263142/RetriveData.zip.html"&gt;Click Here To Download File For This Java Program&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8798872135805441691?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8798872135805441691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2010/04/how-to-retrieve-data-into-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8798872135805441691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8798872135805441691'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2010/04/how-to-retrieve-data-into-database.html' title='How To Retrieve Data Into Database'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-1172541006077217295</id><published>2010-03-31T00:45:00.002+08:00</published><updated>2010-03-31T00:49:08.273+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='---KaliRagavendran---'/><title type='text'>Java Address Book</title><content type='html'>Contributor : KaliRagavendran&lt;div&gt;Program Description : Small Address Book&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;a href="http://www.ziddu.com/download/9229224/Kali.zip.html"&gt;Click Here To Download File For This Java Program&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-1172541006077217295?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/1172541006077217295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2010/03/java-address-book.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1172541006077217295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1172541006077217295'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2010/03/java-address-book.html' title='Java Address Book'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-2071932615866382859</id><published>2010-03-28T01:18:00.003+08:00</published><updated>2010-03-28T01:46:11.844+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='program'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='hotel'/><category scheme='http://www.blogger.com/atom/ns#' term='management'/><category scheme='http://www.blogger.com/atom/ns#' term='PHI'/><title type='text'>Java Hotel Management Program (Philippine)</title><content type='html'>*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : TTKH.java&lt;br /&gt;BY : Phi&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;/**&lt;br /&gt; * @(#)TTKH.java&lt;br /&gt; *&lt;br /&gt; * TTKH application&lt;br /&gt; *&lt;br /&gt; * @author &lt;br /&gt; * @version 1.00 2010/3/21&lt;br /&gt; */&lt;br /&gt;import javax.swing.*;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class TTKH {&lt;br /&gt;     &lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;     try {&lt;br /&gt;     // Set System L&amp;F&lt;br /&gt;        UIManager.setLookAndFeel(&lt;br /&gt;            UIManager.getSystemLookAndFeelClassName());&lt;br /&gt;    } &lt;br /&gt;    catch (UnsupportedLookAndFeelException e) {&lt;br /&gt;       // handle exception&lt;br /&gt;    }&lt;br /&gt;    catch (ClassNotFoundException e) {&lt;br /&gt;       // handle exception&lt;br /&gt;    }&lt;br /&gt;    catch (InstantiationException e) {&lt;br /&gt;       // handle exception&lt;br /&gt;    }&lt;br /&gt;    catch (IllegalAccessException e) {&lt;br /&gt;       // handle exception&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    //=----------------------------------------------------&lt;br /&gt;     &lt;br /&gt;     // TODO, add your application code&lt;br /&gt;     JFrame frame = new JFrame();&lt;br /&gt;     &lt;br /&gt;     &lt;br /&gt;     JPanel panel = new JPanel();&lt;br /&gt;     JPanel khungchitiet = new JPanel();&lt;br /&gt;     //JPanel p1 = new JPanel();&lt;br /&gt;     &lt;br /&gt;     //JPanel p2 = new JPanel();&lt;br /&gt;     //p2.setLayout(new FlowLayout());&lt;br /&gt;     JPanel khungtimkiem = new JPanel();&lt;br /&gt;     GridLayout g2 = new GridLayout(2,2);&lt;br /&gt;     khungtimkiem.setLayout(new GridLayout(5,2,10,10));&lt;br /&gt;     GridLayout g1 = new GridLayout(1,1);&lt;br /&gt;     khungchitiet.setLayout(new GridLayout(7,2,10,10));&lt;br /&gt;     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;     &lt;br /&gt;    // frame.setLocationByPlatform(true);&lt;br /&gt;     &lt;br /&gt;     frame.setSize(680,470); &lt;br /&gt;     &lt;br /&gt;      &lt;br /&gt;     // Giao dien&lt;br /&gt;      &lt;br /&gt;     JLabel ldemuc = new JLabel("Thong Tin Khach Hang"); &lt;br /&gt;     ldemuc.setFont(new Font("Tahoma", Font.BOLD, 25));&lt;br /&gt;     ldemuc.setLayout(new FlowLayout());&lt;br /&gt;     panel.add(ldemuc);&lt;br /&gt;     &lt;br /&gt;      &lt;br /&gt;     &lt;br /&gt;     // Khung Chi tiet&lt;br /&gt;     JLabel ltenKH = new JLabel("Ten KH");&lt;br /&gt;     JTextField ttenKH = new JTextField("Nguyen Van A",1);&lt;br /&gt;     JLabel lngaynhan = new JLabel("Ngay Nhan Phong");&lt;br /&gt;     JTextField tngaynhan = new JTextField("12/05/2009",1);&lt;br /&gt;     JLabel lngaysinh = new JLabel("Ngay Sinh");&lt;br /&gt;     JTextField tngaysinh = new JTextField("11/09/1986",1);&lt;br /&gt;     JLabel lngaytra = new JLabel("Ngay Tra Phong") ;&lt;br /&gt;     JTextField tngaytra = new JTextField("22/05/2009",1);&lt;br /&gt;     JLabel lgioitinh = new JLabel("Gioi Tinh");&lt;br /&gt;     JTextField tgioitinh = new JTextField("Nam",1);&lt;br /&gt;     JLabel lsodt = new JLabel("So Dien Thoai");&lt;br /&gt;     JTextField tsodt = new JTextField("0912345677",1);&lt;br /&gt;     JLabel lloaiphong = new JLabel("Loai Phong");&lt;br /&gt;     JTextField tloaiphong = new JTextField("Vip",1);&lt;br /&gt;     JLabel lcmnd = new JLabel("So CMND");&lt;br /&gt;     JTextField tcmnd = new JTextField("036365888",1);&lt;br /&gt;     JLabel lmaKH = new JLabel("Ma KH");&lt;br /&gt;     JTextField tmaKH = new JTextField("001",1);&lt;br /&gt;     JLabel lemail = new JLabel("Email");&lt;br /&gt;     JTextField temail = new JTextField("nguoidep@gmail.com",1);&lt;br /&gt;     JLabel lspace = new JLabel("--------------");&lt;br /&gt;     JLabel lspace1 = new JLabel(" ");&lt;br /&gt;     JLabel lspace2 = new JLabel("");&lt;br /&gt;     JLabel lspace3 = new JLabel("--------------");&lt;br /&gt;     JLabel lspace4 = new JLabel(" ");&lt;br /&gt;     JLabel lspace5 = new JLabel(" ");&lt;br /&gt;     JLabel lchitiet = new JLabel("Chi Tiet Khach Hang") ;&lt;br /&gt;     lchitiet.setFont(new Font("Tahoma", Font.BOLD, 15));&lt;br /&gt;     JLabel ltimkiem = new JLabel("Tim Kiem Nhanh") ;&lt;br /&gt;     ltimkiem.setFont(new Font("Tahoma", Font.BOLD, 15));&lt;br /&gt;     &lt;br /&gt;        &lt;br /&gt;      &lt;br /&gt;     khungchitiet.add(lchitiet);  &lt;br /&gt;     khungchitiet.add(lspace);&lt;br /&gt;     khungchitiet.add(lspace1); &lt;br /&gt;     khungchitiet.add(lspace2);&lt;br /&gt;     //khungchitiet.add(lspace3); &lt;br /&gt;     khungchitiet.add(lmaKH);&lt;br /&gt;     khungchitiet.add(tmaKH);&lt;br /&gt;     khungchitiet.add(lngaynhan);&lt;br /&gt;     khungchitiet.add(tngaynhan);&lt;br /&gt;     khungchitiet.add(ltenKH);&lt;br /&gt;     khungchitiet.add(ttenKH);&lt;br /&gt;     khungchitiet.add(lngaytra);&lt;br /&gt;     khungchitiet.add(tngaytra);&lt;br /&gt;     khungchitiet.add(lgioitinh);&lt;br /&gt;     khungchitiet.add(tgioitinh);&lt;br /&gt;     khungchitiet.add(lsodt);&lt;br /&gt;     khungchitiet.add(tsodt);&lt;br /&gt;     khungchitiet.add(lngaysinh);&lt;br /&gt;     khungchitiet.add(tngaysinh);&lt;br /&gt;     khungchitiet.add(lloaiphong);&lt;br /&gt;     khungchitiet.add(tloaiphong);&lt;br /&gt;     khungchitiet.add(lcmnd);&lt;br /&gt;     khungchitiet.add(tcmnd);&lt;br /&gt;     khungchitiet.add(lemail);&lt;br /&gt;     khungchitiet.add(temail); &lt;br /&gt;     khungchitiet.add(ltimkiem);&lt;br /&gt;     khungchitiet.add(lspace3);&lt;br /&gt;     khungchitiet.add(lspace4);&lt;br /&gt;     khungchitiet.add(lspace5); &lt;br /&gt;            &lt;br /&gt;          &lt;br /&gt;     &lt;br /&gt;                  &lt;br /&gt;     // phan tim kiem  &lt;br /&gt;     &lt;br /&gt;     JLabel lmaKH2 = new JLabel("Ma KH");&lt;br /&gt;     lmaKH2.setForeground(Color.red);&lt;br /&gt;     JTextField tmaKH2 = new JTextField("Nhap ma khach hang...");&lt;br /&gt;     Choice c1 = new Choice();&lt;br /&gt;     c1.addItem("Vip");&lt;br /&gt;     c1.addItem("Phong Gia dinh"); &lt;br /&gt;     c1.addItem("Phong Quat");&lt;br /&gt;     c1.addItem("Phong May lanh");&lt;br /&gt;     //JLabel lgioitinh2 = new JLabel("Gioi tinh");&lt;br /&gt;     //JRadioButton rnam = new JRadioButton("Nam",true);&lt;br /&gt;     //JRadioButton rnu = new JRadioButton("Nu",false); &lt;br /&gt;     JLabel lngaynhan2 = new JLabel("Ngay Nhan");&lt;br /&gt;     lngaynhan2.setForeground(Color.red);&lt;br /&gt;     JTextField tngaynhan2 = new JTextField("Nhap ngay nhan dd/mm/yyyy");&lt;br /&gt;     JLabel lcmnd2 = new JLabel("So CMND");&lt;br /&gt;     JTextField tcmnd2 = new JTextField("Nhap so");&lt;br /&gt;     JLabel lngaytra2 = new JLabel("Ngay Tra");&lt;br /&gt;     lngaytra2.setForeground(Color.red);&lt;br /&gt;     JTextField tngaytra2 = new JTextField("Nhap ngay tra dd/mm/yyyy");&lt;br /&gt;     JLabel ltenKH2 = new JLabel("Ten KH");&lt;br /&gt;     JTextField ttenKH2 = new JTextField("Nhap ten KH");&lt;br /&gt;     JLabel ls1 = new JLabel(" ");&lt;br /&gt;     JLabel ls2 = new JLabel(" ");&lt;br /&gt;     JLabel ls3 = new JLabel(" ");&lt;br /&gt;     JLabel ls4 = new JLabel(" ");&lt;br /&gt;     JLabel ls5 = new JLabel(" ");&lt;br /&gt;     JLabel ls6 = new JLabel(" ");&lt;br /&gt;     JButton b1 = new JButton("Lam Moi");&lt;br /&gt;      JButton b2 = new JButton("Tim");&lt;br /&gt;     JButton b3 = new JButton("Thoat");&lt;br /&gt;     //JLabel ls5 = new JLabel(" ");&lt;br /&gt;     JLabel loaiphong = new JLabel("Loai Phong");&lt;br /&gt;     khungtimkiem.add(lmaKH2);&lt;br /&gt;     khungtimkiem.add(tmaKH2);&lt;br /&gt;     khungtimkiem.add(lngaynhan2);&lt;br /&gt;     khungtimkiem.add(tngaynhan2);&lt;br /&gt;     khungtimkiem.add(ltenKH2);&lt;br /&gt;     khungtimkiem.add(ttenKH2);&lt;br /&gt;     khungtimkiem.add(lngaytra2);&lt;br /&gt;     khungtimkiem.add(tngaytra2);&lt;br /&gt;     khungtimkiem.add(lcmnd2);&lt;br /&gt;     khungtimkiem.add(tcmnd2);&lt;br /&gt;     khungtimkiem.add(ls1);&lt;br /&gt;     khungtimkiem.add(ls2);&lt;br /&gt;     khungtimkiem.add(loaiphong);&lt;br /&gt;     khungtimkiem.add(c1);&lt;br /&gt;     khungtimkiem.add(ls3);&lt;br /&gt;     khungtimkiem.add(b2);&lt;br /&gt;     khungtimkiem.add(ls5);&lt;br /&gt;     khungtimkiem.add(ls6);&lt;br /&gt;     khungtimkiem.add(b1);&lt;br /&gt;     khungtimkiem.add(b3);&lt;br /&gt;     &lt;br /&gt;          &lt;br /&gt;     frame.setLayout(new BorderLayout());&lt;br /&gt;     frame.add(panel, BorderLayout.NORTH);&lt;br /&gt;     //frame.add(p1, BorderLayout.LINE_START);&lt;br /&gt;     frame.add(khungchitiet, BorderLayout.WEST);&lt;br /&gt;     //frame.add(p2, BorderLayout.WEST);&lt;br /&gt;     //frame.add(p2, BorderLayout.LINE_END);&lt;br /&gt;     frame.add(khungtimkiem, BorderLayout.SOUTH);&lt;br /&gt;     frame.setVisible(true);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-2071932615866382859?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/2071932615866382859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2010/03/java-hotel-management-program.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2071932615866382859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2071932615866382859'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2010/03/java-hotel-management-program.html' title='Java Hotel Management Program (Philippine)'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5971477557532860467</id><published>2009-07-16T23:18:00.005+08:00</published><updated>2010-03-12T20:04:30.080+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='radians'/><category scheme='http://www.blogger.com/atom/ns#' term='degree'/><title type='text'>Java radians to degree</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(51, 255, 255);" href="http://www.ziddu.com/download/8935546/RadiansToDegree.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download File For This Tutorial&lt;/span&gt;::&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : RadiansToDegree.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class RadiansToDegree&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;//radians value&lt;br /&gt;double radians=1.5707963267948966;&lt;br /&gt;&lt;br /&gt;//Get degree value for radians value equal to 1.5707963267948966&lt;br /&gt;double degree=Math.toDegrees(radians);&lt;br /&gt;&lt;br /&gt;System.out.println(degree);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5971477557532860467?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5971477557532860467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/07/java-radians-to-degree.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5971477557532860467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5971477557532860467'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/07/java-radians-to-degree.html' title='Java radians to degree'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5651622270728445420</id><published>2009-07-16T23:01:00.006+08:00</published><updated>2010-03-12T20:16:16.577+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='radians'/><category scheme='http://www.blogger.com/atom/ns#' term='degree'/><title type='text'>Java degree to radians</title><content type='html'>&lt;div style="text-align: center; color: rgb(102, 255, 255);"&gt;&lt;a href="http://www.ziddu.com/download/8935726/DegreeToRadians.zip.html"&gt;&lt;span style="font-weight: bold; color: rgb(102, 255, 255);"&gt;::Click Here To Download File For This Tutorial::&lt;/span&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : DegreeToRadians.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class DegreeToRadians&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;//90 degree&lt;br /&gt;double degree=90;&lt;br /&gt;&lt;br /&gt;//Get radians value for 90 degree&lt;br /&gt;double radians=Math.toRadians(degree);&lt;br /&gt;&lt;br /&gt;System.out.println(radians);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5651622270728445420?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5651622270728445420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/07/java-degree-to-radians.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5651622270728445420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5651622270728445420'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/07/java-degree-to-radians.html' title='Java degree to radians'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8382210156080601781</id><published>2009-06-22T22:26:00.003+08:00</published><updated>2010-03-12T20:21:57.812+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EzIcon'/><title type='text'>EzIcon</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8935835/EzIcon.rar.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download EzIcon::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;You can use this small tool to convert windows icon file (&lt;span style="font-weight: bold;"&gt;.ico&lt;/span&gt;) to 5 other images format like below&lt;br /&gt;&lt;br /&gt;&lt;b&gt;.tga&lt;br /&gt;.bmp&lt;br /&gt;.jpeg&lt;br /&gt;.png&lt;br /&gt;.psd&lt;/b&gt;&lt;br /&gt;&lt;a href="http://www.4shared.com/file/87754955/1ff3b494/EzIcon.html" target="_blank"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8382210156080601781?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8382210156080601781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/06/ezicon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8382210156080601781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8382210156080601781'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/06/ezicon.html' title='EzIcon'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6159261482212293525</id><published>2009-06-22T22:09:00.003+08:00</published><updated>2009-06-22T22:36:10.070+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JAutorunKiller'/><title type='text'>JAutorunKiller</title><content type='html'>You can use this small tool to remove autorun file(autorun.inf) that usually use by computer viruses to start their program from removable drive. This is not mean autorun file is a malicious file. Autorun file is always use in compact disc when disc creator want executable file in the compact disc execute when user click on cd drive icon.Click link below to download :&lt;br /&gt;&lt;a href="http://www.4shared.com/file/113409278/9a5b6957/JAutorunKiller.html" target="_blank"&gt;JAutorunKiller.jar&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6159261482212293525?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6159261482212293525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/06/jautorunkiller.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6159261482212293525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6159261482212293525'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/06/jautorunkiller.html' title='JAutorunKiller'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8642361560997523594</id><published>2009-04-28T21:59:00.006+08:00</published><updated>2010-03-11T20:36:24.276+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='free'/><category scheme='http://www.blogger.com/atom/ns#' term='decompiler'/><title type='text'>Free java decompiler</title><content type='html'>This is one of &lt;b&gt;java decompiler&lt;/b&gt; that can be use to &lt;b&gt;get java source file (file with .java as it's file extension) from any java class file (file with .class as it's file extension)&lt;/b&gt;. Class file is a result after compiling process success without any syntax error.&lt;br /&gt;&lt;br /&gt;Click link below to download&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;1. JD-GUI&lt;br /&gt;&lt;/div&gt;&lt;p align="center"&gt;&lt;a href="http://www.softpedia.com/get/Programming/Debuggers-Decompilers-Dissasemblers/JD-GUI.shtml"&gt;&lt;img src="http://www.softpedia.com/images/softpedia_download_small.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;2. Cavaj Java Decompiler&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="http://www.softpedia.com/get/Programming/Other-Programming-Files/Cavaj-Java-Decompiler.shtml"&gt;&lt;img src="http://www.softpedia.com/images/softpedia_download_small.gif" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;3. JCavaj Java Decompiler&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="http://www.softpedia.com/get/Programming/Other-Programming-Files/JCavaj-Java-Decompiler.shtml"&gt;&lt;img src="http://www.softpedia.com/images/softpedia_download_small.gif" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8642361560997523594?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8642361560997523594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/free-java-decompiler.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8642361560997523594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8642361560997523594'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/free-java-decompiler.html' title='Free java decompiler'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5414841916187982309</id><published>2009-04-22T01:08:00.004+08:00</published><updated>2010-03-12T20:55:25.078+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='alphabet'/><category scheme='http://www.blogger.com/atom/ns#' term='binary'/><title type='text'>Java get binary value from alphabet</title><content type='html'>Today, i have learned about how to get binary value from alphabet. You can try compile and execute java program below to get all binary value for A-Z and a-z.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8936286/JavaGetBinaryFromLetter.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download File For This Tutorial::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaGetBinaryFromLetter.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class JavaGetBinaryFromLetter&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; String a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";&lt;br /&gt;&lt;br /&gt; for(int i=0;i&amp;lt;a.length();i++)&lt;br /&gt; {&lt;br /&gt;  char b=a.charAt(i);&lt;br /&gt;  int temp=(int)b;&lt;br /&gt;  String c=Integer.toBinaryString(temp);&lt;br /&gt;  System.out.println("BINARY VALUE FOR LETTER "+b+" IS : "+c);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5414841916187982309?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5414841916187982309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-get-binary-value-from-alphabet.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5414841916187982309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5414841916187982309'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-get-binary-value-from-alphabet.html' title='Java get binary value from alphabet'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-9038227817857895014</id><published>2009-04-18T01:58:00.004+08:00</published><updated>2010-03-12T21:06:10.671+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='ternary operator'/><title type='text'>Java ternary operator</title><content type='html'>Today i have learned about ternary operator in java. Before this, when i found it in java code, i will ask myself what it is and what we call it...now i will share with you what i understand about ternary operator.Now, see java code below&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8936325/JavaTernaryOperator.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaTernaryOperator.java&lt;br /&gt;************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class JavaTernaryOperator&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;int a=0;&lt;br /&gt;int b=4;&lt;br /&gt;int c=5;&lt;br /&gt;&lt;br /&gt;//THIS IS EXAMPLE OF TERNARY OPERATOR&lt;br /&gt;a=(b&amp;gt;c?b:c);&lt;br /&gt;&lt;br /&gt;System.out.println(a);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;************************************************************&lt;br /&gt;&lt;br /&gt;In the java code above, example of ternary operator is &lt;b&gt;a=(b&amp;gt;c?b:c);&lt;/b&gt;.So, what it mean ?&lt;br /&gt;&lt;br /&gt;This is the answer :&lt;br /&gt;&lt;b&gt;Value a is equal to b if b larger than c or value a is equal to c if b smaller than c.So, java code above has same meaning with java code below.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8936383/JavaTernaryOperator.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source  Code::&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class JavaTernaryOperator&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;int a=0;&lt;br /&gt;int b=4;&lt;br /&gt;int c=5;&lt;br /&gt;&lt;br /&gt;if(b&amp;gt;c)&lt;br /&gt;{&lt;br /&gt; a=b;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt; a=c;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;System.out.println(a);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, you can choose which one you want to use when write your java program. It seem when we use ternary operator we can make our program more shorter.&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-9038227817857895014?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/9038227817857895014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-ternary-operator.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/9038227817857895014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/9038227817857895014'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-ternary-operator.html' title='Java ternary operator'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5007072101594696898</id><published>2009-04-15T01:17:00.004+08:00</published><updated>2010-03-12T21:13:33.979+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='hexadecimal to binary'/><title type='text'>Java hexadecimal to binary</title><content type='html'>Complete source code below is a simple java program that can be use to get binary value from hexadecimal value.&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaHexToBin.java&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8936468/JavaHexToBin.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class JavaHexToBin&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; String[]hex={"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"};&lt;br /&gt; String[]binary={"0000","0001","0010","0011","0100","0101","0110","0111","1000","1001","1010","1011","1100","1101","1110","1111"};&lt;br /&gt;&lt;br /&gt; Scanner s=new Scanner(System.in);&lt;br /&gt; System.out.print("Put hex value : ");&lt;br /&gt; String userInput=s.next();&lt;br /&gt; String result="";&lt;br /&gt; for(int i=0;i&amp;lt;userInput.length();i++)&lt;br /&gt; {&lt;br /&gt;  char temp=userInput.charAt(i);&lt;br /&gt;  String temp2=""+temp+"";&lt;br /&gt;  for(int j=0;j&amp;lt;hex.length;j++)&lt;br /&gt;  {&lt;br /&gt;   if(temp2.equalsIgnoreCase(hex[j]))&lt;br /&gt;   {&lt;br /&gt;    result=result+binary[j];&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; System.out.println("IT'S BINARY IS : "+result);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;******************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5007072101594696898?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5007072101594696898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-hexadecimal-to-binary.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5007072101594696898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5007072101594696898'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-hexadecimal-to-binary.html' title='Java hexadecimal to binary'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3621164929214783700</id><published>2009-04-14T21:19:00.005+08:00</published><updated>2010-03-12T21:23:55.807+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pixel'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='determine'/><title type='text'>Java determine pixel was clicked or not</title><content type='html'>Complete source code below just a simple java program that will determine if you was clicked or not on 8 black dots. If you was clicked , program will inform you that the dot was clicked.I hope you can see all 8 black dots that i mean because it is too small and try click on it to see what happen.&lt;br /&gt;&lt;br /&gt;***************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaDeterminePixelClicked.java&lt;br /&gt;***************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8936541/JavaDeterminePixelClicked.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;import java.awt.*;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;&lt;br /&gt;public class JavaDeterminePixelClicked extends Canvas implements MouseListener&lt;br /&gt;{&lt;br /&gt; boolean [] con={ false,false,false,false,false,false,false,false };&lt;br /&gt; int[][]coor=new int[8][2];&lt;br /&gt; Robot r;&lt;br /&gt; &lt;br /&gt; public JavaDeterminePixelClicked()&lt;br /&gt; {&lt;br /&gt;  addMouseListener(this);&lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;   r=new Robot();&lt;br /&gt;  }&lt;br /&gt;  catch(Exception exception)&lt;br /&gt;  {&lt;br /&gt;   exception.printStackTrace();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  JFrame a=new JFrame("&gt;&gt;&gt;&gt;&gt;TRY CLICK AT BLACK DOT&lt;&lt;&lt;&lt;&lt;");&lt;br /&gt;  a.getContentPane().add(this,BorderLayout.CENTER);&lt;br /&gt;  a.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );&lt;br /&gt;  a.setSize(500,500);&lt;br /&gt;  a.setLocationRelativeTo(null);&lt;br /&gt;  a.setVisible(true);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void paint(Graphics g)&lt;br /&gt; {&lt;br /&gt;  setBackground( new Color (255,255,255) );&lt;br /&gt;  super.paint(g);&lt;br /&gt;  g.setColor( new Color (0,0,0) );&lt;br /&gt;  g.drawLine(30,30,30,30);&lt;br /&gt;  g.drawLine(40,40,40,40);&lt;br /&gt;  g.drawLine(50,50,50,50);&lt;br /&gt;  g.drawLine(60,60,60,60);&lt;br /&gt;  g.drawLine(70,70,70,70);&lt;br /&gt;  g.drawLine(80,80,80,80);&lt;br /&gt;  g.drawLine(90,90,90,90);&lt;br /&gt;  g.drawLine(100,100,100,100);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void mouseClicked(MouseEvent event)&lt;br /&gt; {&lt;br /&gt;  Color temp=r.getPixelColor(event.getLocationOnScreen().x,event.getLocationOnScreen().y);&lt;br /&gt;  if(temp.getRed()==0&amp;&amp;temp.getGreen()==0&amp;&amp;temp.getBlue()==0)&lt;br /&gt;  {&lt;br /&gt;   int upperLeftX=getLocationOnScreen().x;&lt;br /&gt;   int upperLeftY=getLocationOnScreen().y;&lt;br /&gt;   int currentX=event.getLocationOnScreen().x;&lt;br /&gt;   int currentY=event.getLocationOnScreen().y;&lt;br /&gt;   if(currentX-upperLeftX==30&amp;&amp;currentY-upperLeftY==30)&lt;br /&gt;   {&lt;br /&gt;    if(con[0]==false)&lt;br /&gt;    {&lt;br /&gt;     con[0]=true;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     JOptionPane.showMessageDialog(null,"This point was clicked");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   if(currentX-upperLeftX==40&amp;&amp;currentY-upperLeftY==40)&lt;br /&gt;   {&lt;br /&gt;    if(con[1]==false)&lt;br /&gt;    {&lt;br /&gt;     con[1]=true;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     JOptionPane.showMessageDialog(null,"This point was clicked");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   if(currentX-upperLeftX==50&amp;&amp;currentY-upperLeftY==50)&lt;br /&gt;   {&lt;br /&gt;    if(con[2]==false)&lt;br /&gt;    {&lt;br /&gt;     con[2]=true;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     JOptionPane.showMessageDialog(null,"This point was clicked");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   if(currentX-upperLeftX==60&amp;&amp;currentY-upperLeftY==60)&lt;br /&gt;   {&lt;br /&gt;    if(con[3]==false)&lt;br /&gt;    {&lt;br /&gt;     con[3]=true;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     JOptionPane.showMessageDialog(null,"This point was clicked");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   if(currentX-upperLeftX==70&amp;&amp;currentY-upperLeftY==70)&lt;br /&gt;   {&lt;br /&gt;    if(con[4]==false)&lt;br /&gt;    {&lt;br /&gt;     con[4]=true;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     JOptionPane.showMessageDialog(null,"This point was clicked");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   if(currentX-upperLeftX==80&amp;&amp;currentY-upperLeftY==80)&lt;br /&gt;   {&lt;br /&gt;    if(con[5]==false)&lt;br /&gt;    {&lt;br /&gt;     con[5]=true;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     JOptionPane.showMessageDialog(null,"This point was clicked");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   if(currentX-upperLeftX==90&amp;&amp;currentY-upperLeftY==90)&lt;br /&gt;   {&lt;br /&gt;    if(con[6]==false)&lt;br /&gt;    {&lt;br /&gt;     con[6]=true;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     JOptionPane.showMessageDialog(null,"This point was clicked");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   if(currentX-upperLeftX==100&amp;&amp;currentY-upperLeftY==100)&lt;br /&gt;   {&lt;br /&gt;    if(con[7]==false)&lt;br /&gt;    {&lt;br /&gt;     con[7]=true;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     JOptionPane.showMessageDialog(null,"This point was clicked");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void mouseEntered(MouseEvent event)&lt;br /&gt; {&lt;br /&gt;  //NOTHING&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void mouseExited(MouseEvent event)&lt;br /&gt; {&lt;br /&gt;  //NOTHING&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void mousePressed(MouseEvent event)&lt;br /&gt; {&lt;br /&gt;  //NOTHING&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void mouseReleased(MouseEvent event)&lt;br /&gt; {&lt;br /&gt;  //NOTHING&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  JavaDeterminePixelClicked jdpc = new JavaDeterminePixelClicked ();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;***************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***************************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3621164929214783700?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3621164929214783700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-determine-pixel-was-clicked-or-not.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3621164929214783700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3621164929214783700'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-determine-pixel-was-clicked-or-not.html' title='Java determine pixel was clicked or not'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-7411860904568914531</id><published>2009-04-13T23:03:00.003+08:00</published><updated>2010-03-12T22:01:13.070+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='degree'/><category scheme='http://www.blogger.com/atom/ns#' term='radian'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Java get degree from radian</title><content type='html'>Complete source code below just a simple java program that we can use to get degree value from radian value.&lt;br /&gt;&lt;br /&gt;*****************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : GetDegreeFromRadian.java&lt;br /&gt;*****************************************************************&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8937077/GetDegreeFromRadian.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class GetDegreeFromRadian&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //CHANGE RADIAN VALUE TO WHAT VALUE THAT YOU WANT&lt;br /&gt; double radian=1.00;&lt;br /&gt;&lt;br /&gt; //PRINT ANGLE VALUE THAT WE GET FROM RADIAN&lt;br /&gt; System.out.println( "IT'S ANGLE IS : " + radian* (180/Math.PI) );&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*****************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*****************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-7411860904568914531?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/7411860904568914531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-get-degree-from-radian.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7411860904568914531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7411860904568914531'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-get-degree-from-radian.html' title='Java get degree from radian'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-7698546785257949996</id><published>2009-04-11T21:21:00.004+08:00</published><updated>2010-03-12T22:05:27.707+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='user input'/><category scheme='http://www.blogger.com/atom/ns#' term='sort'/><category scheme='http://www.blogger.com/atom/ns#' term='receive'/><title type='text'>Java receive user input and sort it in ascending order</title><content type='html'>Complete source code below is a simple java program that will receive user input and after that sort it in ascending order before display it's result.&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : AscendingString.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8937145/AscendingString.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class AscendingString&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; Scanner s=new Scanner(System.in);&lt;br /&gt; String[]a=new String[5];&lt;br /&gt; for(int i=0;i&amp;lt;5;i++)&lt;br /&gt; {&lt;br /&gt;  System.out.println(i+1+".Put your String");&lt;br /&gt;  String temp=s.nextLine();&lt;br /&gt;  a[i]=temp;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; System.out.println("**********");&lt;br /&gt; System.out.println("RESULT");&lt;br /&gt; System.out.println("**********");&lt;br /&gt;&lt;br /&gt; for(int i=0;i&amp;lt;5;i++)&lt;br /&gt; {&lt;br /&gt;  for(int j=0;j&amp;lt;5;j++)&lt;br /&gt;  {&lt;br /&gt;   String temp=a[i];&lt;br /&gt;   String tempB=a[j];&lt;br /&gt;   if(temp.compareTo(tempB)&amp;lt;0)&lt;br /&gt;   {&lt;br /&gt;    a[i]=tempB;&lt;br /&gt;    a[j]=temp;&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; for(int i=0;i&amp;lt;5;i++)&lt;br /&gt; {&lt;br /&gt;  System.out.println(a[i]);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-7698546785257949996?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/7698546785257949996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-receive-user-input-and-sort-it-in.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7698546785257949996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7698546785257949996'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-receive-user-input-and-sort-it-in.html' title='Java receive user input and sort it in ascending order'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3339354380815880985</id><published>2009-04-11T14:44:00.007+08:00</published><updated>2010-03-12T23:47:02.393+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='recursive'/><category scheme='http://www.blogger.com/atom/ns#' term='method'/><title type='text'>Java recursive method</title><content type='html'>Sometime we need to solve a problem using the same way. For example you need to build a program that will print number from 1 until number that input by a user. First program will print number without using recursive technique and second program we will use recursive technique to print number from 1 until number that input by a user.You should see how a recursive method will do the same thing until problem solve.&lt;br /&gt;&lt;br /&gt;FIRST PROGRAM :&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8938463/Test.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class Test&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;Scanner s=new Scanner(System.in);&lt;br /&gt;System.out.println("Put a number");&lt;br /&gt;int a=s.nextInt();&lt;br /&gt;&lt;br /&gt;System.out.println("IT'S RESULT");&lt;br /&gt;System.out.println("***************");&lt;br /&gt;&lt;br /&gt;for(int i=1;i&amp;lt;=a;i++)&lt;br /&gt;{&lt;br /&gt;System.out.println(i);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;SECOND PROGRAM :&lt;br /&gt;print method in PrintNumber class is example of recursive method.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8938583/Test.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class Test&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;Scanner s=new Scanner(System.in);&lt;br /&gt;System.out.println("Put a number");&lt;br /&gt;int myNumber=s.nextInt();&lt;br /&gt;PrintNumber pn=new PrintNumber();&lt;br /&gt;System.out.println("IT'S RESULT");&lt;br /&gt;System.out.println("***************");&lt;br /&gt;pn.print(myNumber);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class PrintNumber&lt;br /&gt;{&lt;br /&gt;public void print(int a)&lt;br /&gt;{&lt;br /&gt;if(a==1)&lt;br /&gt;{&lt;br /&gt;System.out.println(a);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;int temp=a-1;&lt;br /&gt;print(temp);&lt;br /&gt;System.out.println(a);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For example if you put 2 into second program, when it enter print method in PrintNumber class, firstly program will check if the number is 1 or not. If not, the number will be minus with 1 before it send it's result to print method again. In this case it will send 1 to print method. So System.out.println(a) for a=2 will stop for a while until a=1. Now after it send 1 to print method, condition for a==1 will be true. 1 will be print, and System.out.println(a) for a=2 will continue again by print 2.&lt;br /&gt;&lt;br /&gt;I hope it will help.&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3339354380815880985?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3339354380815880985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-recursive-method.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3339354380815880985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3339354380815880985'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-recursive-method.html' title='Java recursive method'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8194026656258424024</id><published>2009-04-09T01:32:00.005+08:00</published><updated>2010-03-13T00:00:50.727+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><category scheme='http://www.blogger.com/atom/ns#' term='joptionpane'/><title type='text'>Set JOptionPane background color</title><content type='html'>After i make some review over internet and java forum lastly i understand how to change JOptionPane background color.You can try compile and execute simple code below and see it's result.&lt;br /&gt;&lt;br /&gt;***************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJOptionPaneBackgroundColor.java&lt;br /&gt;***************************************************************&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8938741/SetJOptionPaneBackgroundColor.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;import javax.swing.UIManager;&lt;br /&gt;&lt;br /&gt;import javax.swing.plaf.ColorUIResource;&lt;br /&gt;&lt;br /&gt;public class SetJOptionPaneBackgroundColor&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;UIManager uim=new UIManager();&lt;br /&gt;uim.put("OptionPane.background",new ColorUIResource(255,0,0));&lt;br /&gt;uim.put("Panel.background",new ColorUIResource(255,0,0));&lt;br /&gt;&lt;br /&gt;JOptionPane.showMessageDialog(null,"Hello world","HELLO WORLD",JOptionPane.INFORMATION_MESSAGE);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;***************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8194026656258424024?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8194026656258424024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/set-joptionpane-background-color.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8194026656258424024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8194026656258424024'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/set-joptionpane-background-color.html' title='Set JOptionPane background color'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3461521241624840472</id><published>2009-04-06T08:27:00.004+08:00</published><updated>2010-03-13T00:06:18.511+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='whitespace'/><category scheme='http://www.blogger.com/atom/ns#' term='string'/><title type='text'>Java count all white space in String</title><content type='html'>Yesterday, before i go to sleep i tried to answer a simple question from a site. The question is about how to count all white space from String that input by a user. After a few time i failed, i found code below :&lt;br /&gt;&lt;br /&gt;*********************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : CountAllWhitespaceInString.java&lt;br /&gt;*********************************************************&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8938834/CountAllWhitespaceInString.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class CountAllWhitespaceInString&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; boolean a=true;&lt;br /&gt; Scanner sc=new Scanner(System.in);&lt;br /&gt;&lt;br /&gt; while(a)&lt;br /&gt; {&lt;br /&gt;  System.out.println("Type EXIT to exit");&lt;br /&gt;  String b=sc.nextLine();&lt;br /&gt;  int whitespaceNumber=0;&lt;br /&gt; &lt;br /&gt;  if(!b.equalsIgnoreCase("exit"))&lt;br /&gt;  {&lt;br /&gt;   try&lt;br /&gt;   {&lt;br /&gt;    for(int i=0;i&amp;lt;=b.length()-1;i++)&lt;br /&gt;    {&lt;br /&gt;     char temp=b.charAt(i);&lt;br /&gt;     if(temp==' ')&lt;br /&gt;     {&lt;br /&gt;      whitespaceNumber++;&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;    System.out.println("Whitespace number is : "+whitespaceNumber);&lt;br /&gt;   }&lt;br /&gt;   catch(Exception exception)&lt;br /&gt;   {&lt;br /&gt;    System.out.println("DON'T DO THAT");&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   a=false;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3461521241624840472?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3461521241624840472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-count-all-white-space-in-string.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3461521241624840472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3461521241624840472'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-count-all-white-space-in-string.html' title='Java count all white space in String'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4297206852202085964</id><published>2009-04-05T22:48:00.005+08:00</published><updated>2010-03-13T00:14:43.746+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='palindrome'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><category scheme='http://www.blogger.com/atom/ns#' term='string'/><title type='text'>Java reverse String and simplest palindrome checker</title><content type='html'>Today, i have learn something new and it's totally simple. Sometime when don't know about that, we will use our way that take a time to complete a simple task. What i learn today is, how to reverse String. The easiest way to reverse a String for example from "i love you" to "uoy evol i" is using method reverse() in StringBuffer class. It is also very useful especially when you want to create a &lt;b&gt;palindrome checker program&lt;/b&gt;. Your program will be the shortest palindrome checker program in the world i think, hehehehe. I have also created a new one before, but it quit long. You can review it by &lt;a href="http://java2everyone.blogspot.com/2009/03/java-palindrome-checker.html"&gt;click here&lt;/a&gt;. Now we will go to coding part. I will create two simple programs. Firstly to reverse "i love you" to "uoy evol i". Secondly i will create my shortest palindrome checker program that i ever made. Don't waste our time by hear what i said.&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ReverseString.java&lt;br /&gt;*************************************************************&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8938870/ReverseString.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class ReverseString&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;String a="i love you";&lt;br /&gt;StringBuffer b=new StringBuffer(a);&lt;br /&gt;&lt;br /&gt;System.out.println(b.reverse());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;LIKE USUAL, JUST COMPILE AND EXECUTE IT&lt;br /&gt;*************************************************************&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : MySimplestPalindromeChecker.java&lt;br /&gt;*************************************************************&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8938903/MySimplestPalindromeChecker.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;&lt;br /&gt;public class MySimplestPalindromeChecker&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;String a=JOptionPane.showInputDialog(null,"What word that you want to check ?","Palindrome Checker",JOptionPane.QUESTION_MESSAGE);&lt;br /&gt;&lt;br /&gt;if(a!=null)&lt;br /&gt;{&lt;br /&gt;String b=a;&lt;br /&gt;StringBuffer c=new StringBuffer(b);&lt;br /&gt;if(a.equals(c.reverse().toString()))&lt;br /&gt;{&lt;br /&gt; JOptionPane.showMessageDialog(null,"THIS IS A PALINDROME WORD");&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt; JOptionPane.showMessageDialog(null,"THIS IS NOT A PALINDROME WORD");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4297206852202085964?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4297206852202085964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-reverse-string-and-simplest.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4297206852202085964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4297206852202085964'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/java-reverse-string-and-simplest.html' title='Java reverse String and simplest palindrome checker'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4298336276202014437</id><published>2009-04-05T03:18:00.004+08:00</published><updated>2009-04-05T03:44:19.358+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='symbol'/><category scheme='http://www.blogger.com/atom/ns#' term='square root'/><title type='text'>Square root symbol in java</title><content type='html'>After i spend a day to find how to print square root symbol in java through command prompt, someone tell me from java forum if our command prompt did not have a glyph for the square root character, this job will undone. But when i try use it in JOptionPane's message box it perform well. &lt;br /&gt;&lt;br /&gt;In java "\u221A" is refer to square root symbol. It is Unicode.You can try to visit link below for more details :&lt;br /&gt;&lt;a href="http://www.fileformat.info/info/unicode/char/221a/index.htm"&gt;Click here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you want to print square root symbol through your command prompt, you can try something like this. I hope your command prompt can support for this thing.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class Test2&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  System.out.println("\u221A");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you want to put it in JOptionPane's message box (this is perform well in my computer), you can try this :&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;&lt;br /&gt;public class Test2&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  JOptionPane.showMessageDialog(null,"\u221A");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4298336276202014437?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4298336276202014437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/04/square-root-symbol-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4298336276202014437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4298336276202014437'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/04/square-root-symbol-in-java.html' title='Square root symbol in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-889408140600731027</id><published>2009-03-31T22:30:00.006+08:00</published><updated>2010-03-13T00:29:28.103+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='rgb'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><category scheme='http://www.blogger.com/atom/ns#' term='hex'/><title type='text'>Java simple rgb to hex converter</title><content type='html'>Complete source code below is a small java program that convert rgb value to hex value. Now i will share with you how to get hex value from rgb value. Before i go far, let we see a description about hex value structure.&lt;br /&gt;&lt;br /&gt;&lt;table width="400" border="5"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;VALUE THAT YOU GET AFTER DIVIDE OR MULTIPLY&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;0&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;1&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;2&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;3&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;4&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;5&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;6&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;7&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;8&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;9&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;10&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;11&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;12&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;13&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;14&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;15&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;HEX VALUE&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;9&lt;/td&gt;&lt;td&gt;A&lt;/td&gt;&lt;td&gt;B&lt;/td&gt;&lt;td&gt;C&lt;/td&gt;&lt;td&gt;D&lt;/td&gt;&lt;td&gt;E&lt;/td&gt;&lt;td&gt;F&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div&gt;TABLE A&lt;br /&gt;&lt;br /&gt;For example :&lt;br /&gt;FFFFFF is a hex value for white and it's rgb value is 255 255 255.First FF is value for red, second FF is value for green and last FF is for blue.So it mean, first 255 in rgb is equal to first FF in hex value.Now i will show you, how to get FF from 255.For this tutorial i show you only for red part. You can try other last two part for green and blue. Now take 255 and devide it with 16. You should get 15.9375. Take value before floating point. In this case we get 15. Look at TABLE A at above. 15 is equal to F. Now you get first F.For second F, take value after floating point and multiply it with 16. In this case you should multiply 0.9375 with 16. It's result is equal to 15 and it also hold F.Now you get hex value for red part.I hope you can understand what i tried to say.&lt;br /&gt;&lt;br /&gt;********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : RGBtoHEX.java&lt;br /&gt;********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8939082/RGBtoHEX.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JPanel;&lt;br /&gt;import javax.swing.JTextField;&lt;br /&gt;import javax.swing.JButton;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;import javax.swing.JLabel;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;&lt;br /&gt;import java.awt.GridLayout;&lt;br /&gt;import java.awt.Color;&lt;br /&gt;&lt;br /&gt;import java.awt.event.ActionEvent;&lt;br /&gt;import java.awt.event.ActionListener;&lt;br /&gt;&lt;br /&gt;public class RGBtoHEX implements ActionListener&lt;br /&gt;{&lt;br /&gt;JTextField r=new JTextField(10);&lt;br /&gt;JTextField g=new JTextField(10);&lt;br /&gt;JTextField b=new JTextField(10);&lt;br /&gt;&lt;br /&gt;JLabel rLabel=new JLabel("R",JLabel.CENTER);&lt;br /&gt;JLabel gLabel=new JLabel("G",JLabel.CENTER);&lt;br /&gt;JLabel bLabel=new JLabel("B",JLabel.CENTER);&lt;br /&gt;&lt;br /&gt;JPanel panelTextField=new JPanel();&lt;br /&gt;JPanel panelLabel=new JPanel();&lt;br /&gt;&lt;br /&gt;JButton button=new JButton("Calculate Now !");&lt;br /&gt;&lt;br /&gt;JTextField result=new JTextField(30);&lt;br /&gt;&lt;br /&gt;public RGBtoHEX()&lt;br /&gt;{&lt;br /&gt;button.addActionListener(this);&lt;br /&gt;&lt;br /&gt;r.setHorizontalAlignment(JTextField.CENTER);&lt;br /&gt;g.setHorizontalAlignment(JTextField.CENTER);&lt;br /&gt;b.setHorizontalAlignment(JTextField.CENTER);&lt;br /&gt;&lt;br /&gt;result.setHorizontalAlignment(JTextField.CENTER);&lt;br /&gt;result.setBackground(new Color(255,255,255));&lt;br /&gt;result.setEditable(false);&lt;br /&gt;&lt;br /&gt;panelLabel.setLayout(new GridLayout(1,3));&lt;br /&gt;panelLabel.add(rLabel);&lt;br /&gt;panelLabel.add(gLabel);&lt;br /&gt;panelLabel.add(bLabel);&lt;br /&gt;&lt;br /&gt;panelTextField.setLayout(new GridLayout(1,3));&lt;br /&gt;panelTextField.add(r);&lt;br /&gt;panelTextField.add(g);&lt;br /&gt;panelTextField.add(b);&lt;br /&gt;&lt;br /&gt;JFrame myMainWindow=new JFrame("RGB to HEX");&lt;br /&gt;myMainWindow.getContentPane().setLayout(new GridLayout(4,1));&lt;br /&gt;myMainWindow.getContentPane().add(panelLabel);&lt;br /&gt;myMainWindow.getContentPane().add(panelTextField);&lt;br /&gt;myMainWindow.getContentPane().add(button);&lt;br /&gt;myMainWindow.getContentPane().add(result);&lt;br /&gt;&lt;br /&gt;myMainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;myMainWindow.setSize(300,130);&lt;br /&gt;myMainWindow.setLocationRelativeTo(null);&lt;br /&gt;myMainWindow.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void actionPerformed(ActionEvent event)&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;String hexValue="#";&lt;br /&gt;r.setEditable(false);&lt;br /&gt;g.setEditable(false);&lt;br /&gt;b.setEditable(false);&lt;br /&gt;&lt;br /&gt;double red=Double.parseDouble(r.getText());&lt;br /&gt;double green=Double.parseDouble(g.getText());&lt;br /&gt;double blue=Double.parseDouble(b.getText());&lt;br /&gt;&lt;br /&gt;for(int i=1;i&amp;lt;=3;i++)&lt;br /&gt;{&lt;br /&gt;double temp=0;&lt;br /&gt;&lt;br /&gt;if(i==1)&lt;br /&gt;{&lt;br /&gt; temp=red;&lt;br /&gt;}&lt;br /&gt;else if(i==2)&lt;br /&gt;{&lt;br /&gt; temp=green;&lt;br /&gt;}&lt;br /&gt;else if(i==3)&lt;br /&gt;{&lt;br /&gt; temp=blue;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;double devideResult=temp/16;&lt;br /&gt;&lt;br /&gt;String stringDevideResult=Double.toString(devideResult);&lt;br /&gt;&lt;br /&gt;int pointIndexInString=stringDevideResult.indexOf(".");&lt;br /&gt;&lt;br /&gt;String firstValue=stringDevideResult.substring(0,pointIndexInString);&lt;br /&gt;&lt;br /&gt;double multiplySixteen=(devideResult-(Double.parseDouble(firstValue)))*16;&lt;br /&gt;&lt;br /&gt;String stringMultiplySixteen=Double.toString(multiplySixteen);&lt;br /&gt;&lt;br /&gt;pointIndexInString=stringMultiplySixteen.indexOf(".");&lt;br /&gt;&lt;br /&gt;String secondValue=stringMultiplySixteen.substring(0,pointIndexInString);&lt;br /&gt;&lt;br /&gt;if(firstValue.equalsIgnoreCase("10"))&lt;br /&gt;{&lt;br /&gt; firstValue="A";&lt;br /&gt;}&lt;br /&gt;if(firstValue.equalsIgnoreCase("11"))&lt;br /&gt;{&lt;br /&gt; firstValue="B";&lt;br /&gt;}&lt;br /&gt;if(firstValue.equalsIgnoreCase("12"))&lt;br /&gt;{&lt;br /&gt; firstValue="C";&lt;br /&gt;}&lt;br /&gt;if(firstValue.equalsIgnoreCase("13"))&lt;br /&gt;{&lt;br /&gt; firstValue="D";&lt;br /&gt;}&lt;br /&gt;if(firstValue.equalsIgnoreCase("14"))&lt;br /&gt;{&lt;br /&gt; firstValue="E";&lt;br /&gt;}&lt;br /&gt;if(firstValue.equalsIgnoreCase("15"))&lt;br /&gt;{&lt;br /&gt; firstValue="F";&lt;br /&gt;}&lt;br /&gt;if(secondValue.equalsIgnoreCase("10"))&lt;br /&gt;{&lt;br /&gt; secondValue="A";&lt;br /&gt;}&lt;br /&gt;if(secondValue.equalsIgnoreCase("11"))&lt;br /&gt;{&lt;br /&gt; secondValue="B";&lt;br /&gt;}&lt;br /&gt;if(secondValue.equalsIgnoreCase("12"))&lt;br /&gt;{&lt;br /&gt; secondValue="C";&lt;br /&gt;}&lt;br /&gt;if(secondValue.equalsIgnoreCase("13"))&lt;br /&gt;{&lt;br /&gt; secondValue="D";&lt;br /&gt;}&lt;br /&gt;if(secondValue.equalsIgnoreCase("14"))&lt;br /&gt;{&lt;br /&gt; secondValue="E";&lt;br /&gt;}&lt;br /&gt;if(secondValue.equalsIgnoreCase("15"))&lt;br /&gt;{&lt;br /&gt; secondValue="F";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;hexValue=hexValue+firstValue+secondValue;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;result.setText(hexValue);&lt;br /&gt;r.setEditable(true);&lt;br /&gt;g.setEditable(true);&lt;br /&gt;b.setEditable(true);&lt;br /&gt;}&lt;br /&gt;catch(Exception exception)&lt;br /&gt;{&lt;br /&gt;JOptionPane.showMessageDialog(null,"Program error and it will terminate","ERROR",JOptionPane.ERROR_MESSAGE);&lt;br /&gt;System.exit(0);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;RGBtoHEX converter=new RGBtoHEX();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;********************************************************************&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-889408140600731027?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/889408140600731027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-simple-rgb-to-hex-converter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/889408140600731027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/889408140600731027'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-simple-rgb-to-hex-converter.html' title='Java simple rgb to hex converter'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4399804941061594628</id><published>2009-03-31T02:04:00.006+08:00</published><updated>2010-03-13T01:01:09.519+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='image'/><category scheme='http://www.blogger.com/atom/ns#' term='tooltiptext'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><category scheme='http://www.blogger.com/atom/ns#' term='magnifier'/><title type='text'>Java simple image magnifier tooltip</title><content type='html'>&lt;table&gt;&lt;br /&gt;Sometime when we play with images...i mean here a lot of images, like we let user choose an image from 500 images in a JFrame and all images show at the same time without any scrollbar, it can give user a little problem if the image too small. So, how can user make a good choice. This give me some idea to built my own image tooltip. This is a simple tooltip. It will enlarge image when someone hover mouse cursor on it.Image below is a result from program below.&lt;br /&gt;&lt;/table&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_f2uGmZtYbGs/SdETpiZlN0I/AAAAAAAABww/SVe95bsFFGU/s1600-h/ImageToolTipResult.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 250px;" src="http://3.bp.blogspot.com/_f2uGmZtYbGs/SdETpiZlN0I/AAAAAAAABww/SVe95bsFFGU/s400/ImageToolTipResult.jpg" alt="" id="BLOGGER_PHOTO_ID_5319054239230932802" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;table&gt;&lt;br /&gt;&lt;br /&gt;Before you compile and execute it, you should download all images below. After that place them at same location with this java source file.&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_f2uGmZtYbGs/SdEW2_78deI/AAAAAAAABxI/NKqiXu6e7nE/s1600-h/Love_Music_by_jovincent.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://3.bp.blogspot.com/_f2uGmZtYbGs/SdEW2_78deI/AAAAAAAABxI/NKqiXu6e7nE/s400/Love_Music_by_jovincent.jpg" alt="" id="BLOGGER_PHOTO_ID_5319057769032873442" border="0" /&gt;&lt;/a&gt;Love_Music_by_jovincent.jpg&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_f2uGmZtYbGs/SdEW20SVdOI/AAAAAAAABxA/idZg-dn14YM/s1600-h/Leafs_1_by_NerghaL.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://4.bp.blogspot.com/_f2uGmZtYbGs/SdEW20SVdOI/AAAAAAAABxA/idZg-dn14YM/s400/Leafs_1_by_NerghaL.jpg" alt="" id="BLOGGER_PHOTO_ID_5319057765905560802" border="0" /&gt;&lt;/a&gt;Leafs_1_by_NerghaL.jpg&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_f2uGmZtYbGs/SdEW2aEMIXI/AAAAAAAABw4/TlXjrBnE6wg/s1600-h/Hancock-1611.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_f2uGmZtYbGs/SdEW2aEMIXI/AAAAAAAABw4/TlXjrBnE6wg/s400/Hancock-1611.jpg" alt="" id="BLOGGER_PHOTO_ID_5319057758866907506" border="0" /&gt;&lt;/a&gt;Hancock-1611.jpg&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_f2uGmZtYbGs/SdEX3diKMYI/AAAAAAAABxY/FsO95zQRH58/s1600-h/matrix.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://3.bp.blogspot.com/_f2uGmZtYbGs/SdEX3diKMYI/AAAAAAAABxY/FsO95zQRH58/s400/matrix.jpg" alt="" id="BLOGGER_PHOTO_ID_5319058876489412994" border="0" /&gt;&lt;/a&gt;matrix.jpg&lt;br /&gt;&lt;/div&gt;&lt;table&gt;&lt;br /&gt;********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ImageToolTip.java&lt;br /&gt;********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8939458/ImageToolTip.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download File For This Tutorial::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;table&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JPanel;&lt;br /&gt;import javax.swing.ImageIcon;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;&lt;br /&gt;import java.awt.GridLayout;&lt;br /&gt;import java.awt.Graphics;&lt;br /&gt;&lt;br /&gt;import java.awt.event.MouseListener;&lt;br /&gt;import java.awt.event.MouseEvent;&lt;br /&gt;&lt;br /&gt;public class ImageToolTip&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; PanelImage imageA=new PanelImage("matrix.jpg");&lt;br /&gt;&lt;br /&gt; PanelImage imageB=new PanelImage("Hancock-1611.jpg");&lt;br /&gt;&lt;br /&gt; PanelImage imageC=new PanelImage("Leafs_1_by_NerghaL.jpg");&lt;br /&gt;&lt;br /&gt; PanelImage imageD=new PanelImage("Love_Music_by_jovincent.jpg");&lt;br /&gt;&lt;br /&gt; JFrame myMainWindow=new JFrame("Image Tool Tip");&lt;br /&gt; myMainWindow.setResizable(false);&lt;br /&gt; myMainWindow.getContentPane().setLayout(new GridLayout(2,2));&lt;br /&gt; myMainWindow.getContentPane().add(imageA);&lt;br /&gt; myMainWindow.getContentPane().add(imageB);&lt;br /&gt; myMainWindow.getContentPane().add(imageC);&lt;br /&gt; myMainWindow.getContentPane().add(imageD);&lt;br /&gt;&lt;br /&gt; myMainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; myMainWindow.setSize(100,100);&lt;br /&gt; myMainWindow.setLocationRelativeTo(null);&lt;br /&gt; myMainWindow.setVisible(true);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class PanelImage extends JPanel implements MouseListener&lt;br /&gt;{&lt;br /&gt;ImageIcon temp;&lt;br /&gt;ImageMagnifier im;&lt;br /&gt;&lt;br /&gt;public PanelImage(String a)&lt;br /&gt;{&lt;br /&gt; addMouseListener(this);&lt;br /&gt; temp=new ImageIcon(a);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void paint(Graphics g)&lt;br /&gt;{&lt;br /&gt; super.paint(g);&lt;br /&gt; g.drawImage(temp.getImage(),0,0,getSize().width,getSize().height,this);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void mouseClicked(MouseEvent event)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void mouseEntered(MouseEvent event)&lt;br /&gt;{&lt;br /&gt; im=new ImageMagnifier(temp,getSize().width,getSize().height,event.getXOnScreen(),event.getYOnScreen());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void mouseExited(MouseEvent event)&lt;br /&gt;{&lt;br /&gt; im.dispose();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void mousePressed(MouseEvent event)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void mouseReleased(MouseEvent event)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class ImageMagnifier extends JFrame&lt;br /&gt;{&lt;br /&gt;ImageIcon temp;&lt;br /&gt;&lt;br /&gt;public ImageMagnifier(ImageIcon imageFile,int width,int height,int x,int y)&lt;br /&gt;{&lt;br /&gt; setUndecorated(true);&lt;br /&gt; temp=imageFile;&lt;br /&gt; setLocation(x,y);&lt;br /&gt; setSize(width*9,height*9);&lt;br /&gt; setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void paint(Graphics g)&lt;br /&gt;{&lt;br /&gt; super.paint(g);&lt;br /&gt; g.drawImage(temp.getImage(),0,0,getSize().width,getSize().height,this);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;********************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4399804941061594628?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4399804941061594628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-simple-image-magnifier-tooltip.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4399804941061594628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4399804941061594628'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-simple-image-magnifier-tooltip.html' title='Java simple image magnifier tooltip'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_f2uGmZtYbGs/SdETpiZlN0I/AAAAAAAABww/SVe95bsFFGU/s72-c/ImageToolTipResult.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-2990994890232786959</id><published>2009-03-30T00:38:00.004+08:00</published><updated>2010-03-13T01:04:52.139+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='print'/><title type='text'>Java print pi value</title><content type='html'>&lt;table&gt;&lt;br /&gt;Simple java program below will print pi value in command prompt.&lt;br /&gt;&lt;br /&gt;****************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : PrintPiValue.java&lt;br /&gt;****************************************************************&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;div style="text-align: center;"&gt;&lt;a style="color: rgb(102, 255, 255);" href="http://www.ziddu.com/download/8939500/PrintPiValue.zip.html"&gt;&lt;span style="font-weight: bold;"&gt;::Click Here To Download This Java Source Code::&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;table&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class PrintPiValue&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; System.out.println("PI value is : "+Math.PI);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;****************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;****************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-2990994890232786959?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/2990994890232786959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-print-pi-value.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2990994890232786959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2990994890232786959'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-print-pi-value.html' title='Java print pi value'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4765633645468794168</id><published>2009-03-29T02:02:00.003+08:00</published><updated>2009-03-29T02:47:06.978+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='file'/><title type='text'>Java write text file</title><content type='html'>&lt;table&gt;&lt;br /&gt;Program below will ask user to enter their name and some description about them. After that it will write into a text file named MyTextFile.txt with .txt file's extension. You can try with other file format like .doc(Microsoft Word) or .rtf or others that you know to store text file. It's not mean if we write to text file, we must use a file with .txt as it's extension. &lt;br /&gt;&lt;br /&gt;Description that i get from Wikipedia about text file is :&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;A text file (sometimes spelled "textfile": an old alternate name is "flatfile") is a kind of computer file that is structured as a sequence of lines.&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;So, it's mean a text file can hold any file's extension. Not only for .txt.&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : WriteTextFile.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.PrintWriter;&lt;br /&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;import java.awt.Desktop;&lt;br /&gt;&lt;br /&gt;public class WriteTextFile&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  Scanner scanUserInput=new Scanner(System.in);&lt;br /&gt;  &lt;br /&gt;  File targetedFile=new File("MyTextFile.txt");&lt;br /&gt;  &lt;br /&gt;  System.out.println("What is your name ?");&lt;br /&gt;  String name=scanUserInput.nextLine();&lt;br /&gt;  &lt;br /&gt;  System.out.println("Put some description about yourself");&lt;br /&gt;  System.out.println("-----------------------------------");&lt;br /&gt;  String description=scanUserInput.nextLine();&lt;br /&gt;  &lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;   PrintWriter pw=new PrintWriter(targetedFile);&lt;br /&gt;  &lt;br /&gt;   pw.println("******************");&lt;br /&gt;   pw.println(name + "'s"+" profile");&lt;br /&gt;   pw.println("******************");&lt;br /&gt;   pw.println("Name : "+name);&lt;br /&gt;   pw.println();&lt;br /&gt;   pw.println("Description : "+description);&lt;br /&gt;  &lt;br /&gt;   pw.flush();&lt;br /&gt;   pw.close();&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;   Desktop.getDesktop().open(targetedFile);&lt;br /&gt;  }&lt;br /&gt;  catch(Exception exception)&lt;br /&gt;  {&lt;br /&gt;   System.out.println("Problem in file processing");&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4765633645468794168?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4765633645468794168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-write-text-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4765633645468794168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4765633645468794168'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-write-text-file.html' title='Java write text file'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-1818296664484876328</id><published>2009-03-28T08:31:00.002+08:00</published><updated>2009-03-28T08:38:49.985+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='prime'/><category scheme='http://www.blogger.com/atom/ns#' term='determine'/><category scheme='http://www.blogger.com/atom/ns#' term='number'/><title type='text'>Java determine prime number</title><content type='html'>&lt;table&gt;&lt;br /&gt;Complete source code below will show you, how to create a simple java program that will determine an input number is a prime number or not. This program will run through command prompt.&lt;br /&gt;&lt;br /&gt;********************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaDeterminePrimeNumber.java&lt;br /&gt;********************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class JavaDeterminePrimeNumber&lt;br /&gt;{&lt;br /&gt; public boolean isPrime(int a)&lt;br /&gt; {&lt;br /&gt;  boolean temp=true;&lt;br /&gt;  if(a==1)&lt;br /&gt;  {&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt;  for(int i=2;i&amp;lt;=a;i++)&lt;br /&gt;  {&lt;br /&gt;   if(i!=1&amp;&amp;i!=a)&lt;br /&gt;   {&lt;br /&gt;    int tempResult=a%i;&lt;br /&gt;    if(tempResult==0)&lt;br /&gt;    {&lt;br /&gt;     temp=false;&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  return temp;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  JavaDeterminePrimeNumber myTest=new JavaDeterminePrimeNumber();&lt;br /&gt;  Scanner s=new Scanner(System.in);&lt;br /&gt;  System.out.println("Enter an int value");&lt;br /&gt;  int response = s.nextInt();&lt;br /&gt;  boolean result=myTest.isPrime(response);&lt;br /&gt;  &lt;br /&gt;  if(result==true)&lt;br /&gt;  {&lt;br /&gt;   System.out.println("This is a prime number");&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   System.out.println("This is not a prime number");&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;********************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;********************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-1818296664484876328?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/1818296664484876328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-determine-prime-number.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1818296664484876328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1818296664484876328'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-determine-prime-number.html' title='Java determine prime number'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6845598358321827380</id><published>2009-03-28T03:04:00.002+08:00</published><updated>2009-03-28T03:24:37.214+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='calendar'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><title type='text'>Java simple calendar</title><content type='html'>&lt;table&gt;&lt;br /&gt;Complete source code below will show you, how to create simple calendar in java. This program will prompts the user to enter the year and first day of the year, and display the calendar table for the year on the console.&lt;br /&gt;&lt;br /&gt;*************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaSimpleCalendar.java&lt;br /&gt;*************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Calendar;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class JavaSimpleCalendar&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  Scanner s=new Scanner(System.in);&lt;br /&gt;  &lt;br /&gt;  System.out.print("YEAR : ");&lt;br /&gt;  int year=s.nextInt();&lt;br /&gt;  &lt;br /&gt;  System.out.println();&lt;br /&gt;  &lt;br /&gt;  System.out.println("FIRST DAY OF THE YEAR");&lt;br /&gt;  System.out.println("1 for MONDAY");&lt;br /&gt;  System.out.println("2 for TUESDAY");&lt;br /&gt;  System.out.println("3 for WEDNESDAY");&lt;br /&gt;  System.out.println("4 for THURSDAY");&lt;br /&gt;  System.out.println("5 for FRIDAY");&lt;br /&gt;  System.out.println("6 for SATURDAY");&lt;br /&gt;  System.out.println("7 for SUNDAY");&lt;br /&gt;  System.out.print("FIRST DAY : ");&lt;br /&gt;  int firstDay=s.nextInt();&lt;br /&gt;  &lt;br /&gt;  System.out.println();&lt;br /&gt;  &lt;br /&gt;  boolean leapYear=false;&lt;br /&gt;  if(year%4==0)&lt;br /&gt;  {&lt;br /&gt;   leapYear=true;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  for(int i=1;i&amp;lt;=12;i++)&lt;br /&gt;  {&lt;br /&gt;   System.out.println("***********************");&lt;br /&gt;   System.out.println("MONTH : "+i);&lt;br /&gt;   System.out.println("***********************");&lt;br /&gt;   &lt;br /&gt;   if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)&lt;br /&gt;   {&lt;br /&gt;    System.out.println("M  T  W  TH F  S  SU");&lt;br /&gt;    boolean firstRound=true;&lt;br /&gt;    for(int j=1;j&amp;lt;=31;j++)&lt;br /&gt;    {&lt;br /&gt;     String temp=Integer.toString(j);&lt;br /&gt;     if(temp.length()==1)&lt;br /&gt;     {&lt;br /&gt;      System.out.print(" ");&lt;br /&gt;     }&lt;br /&gt;     if(firstDay==1)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=1;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==2)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=3;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==3)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=6;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==4)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=9;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==5)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=12;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==6)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=15;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==7)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=18;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.println(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.println(j+" ");&lt;br /&gt;      }&lt;br /&gt;      firstDay=0;&lt;br /&gt;      firstRound=false;&lt;br /&gt;     }&lt;br /&gt;     firstDay++;&lt;br /&gt;    }&lt;br /&gt;    System.out.println("\n");&lt;br /&gt;   }&lt;br /&gt;   else if(i==2)&lt;br /&gt;   {&lt;br /&gt;    if(leapYear==true)&lt;br /&gt;    {&lt;br /&gt;     System.out.println("M  T  W  TH F  S  SU");&lt;br /&gt;     boolean firstRound=true;&lt;br /&gt;     for(int j=1;j&amp;lt;=29;j++)&lt;br /&gt;     {&lt;br /&gt;      String temp=Integer.toString(j);&lt;br /&gt;      if(temp.length()==1)&lt;br /&gt;      {&lt;br /&gt;       System.out.print(" ");&lt;br /&gt;      }&lt;br /&gt;      if(firstDay==1)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=1;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==2)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=3;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==3)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=6;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==4)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=9;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==5)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=12;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==6)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=15;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==7)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=18;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.println(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.println(j+" ");&lt;br /&gt;       }&lt;br /&gt;       firstDay=0;&lt;br /&gt;       firstRound=false;&lt;br /&gt;      }&lt;br /&gt;      firstDay++;&lt;br /&gt;     }&lt;br /&gt;     System.out.println("\n");&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     System.out.println("M  T  W  TH F  S  SU");&lt;br /&gt;     boolean firstRound=true;&lt;br /&gt;     for(int j=1;j&amp;lt;=28;j++)&lt;br /&gt;     {&lt;br /&gt;      String temp=Integer.toString(j);&lt;br /&gt;      if(temp.length()==1)&lt;br /&gt;      {&lt;br /&gt;       System.out.print(" ");&lt;br /&gt;      }&lt;br /&gt;      if(firstDay==1)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=1;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==2)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=3;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==3)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=6;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==4)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=9;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==5)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=12;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==6)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=15;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.print(j+" ");&lt;br /&gt;       }&lt;br /&gt;      }&lt;br /&gt;      else if(firstDay==7)&lt;br /&gt;      {&lt;br /&gt;       if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;       {&lt;br /&gt;        for(int k=1;k&amp;lt;=18;k++)&lt;br /&gt;        {&lt;br /&gt;         System.out.print("-");&lt;br /&gt;        }&lt;br /&gt;        System.out.println(j+" ");&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;        System.out.println(j+" ");&lt;br /&gt;       }&lt;br /&gt;       firstDay=0;&lt;br /&gt;       firstRound=false;&lt;br /&gt;      }&lt;br /&gt;      firstDay++;&lt;br /&gt;     }&lt;br /&gt;     System.out.println("\n");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;    System.out.println("M  T  W  TH F  S  SU");&lt;br /&gt;    boolean firstRound=true;&lt;br /&gt;    for(int j=1;j&amp;lt;=30;j++)&lt;br /&gt;    {&lt;br /&gt;     String temp=Integer.toString(j);&lt;br /&gt;     if(temp.length()==1)&lt;br /&gt;     {&lt;br /&gt;      System.out.print(" ");&lt;br /&gt;     }&lt;br /&gt;     if(firstDay==1)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=1;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==2)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=3;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==3)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=6;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==4)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=9;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==5)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=12;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==6)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=15;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.print(j+" ");&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;     else if(firstDay==7)&lt;br /&gt;     {&lt;br /&gt;      if(firstRound==true&amp;amp;&amp;amp;j==1)&lt;br /&gt;      {&lt;br /&gt;       for(int k=1;k&amp;lt;=18;k++)&lt;br /&gt;       {&lt;br /&gt;        System.out.print("-");&lt;br /&gt;       }&lt;br /&gt;       System.out.println(j+" ");&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;       System.out.println(j+" ");&lt;br /&gt;      }&lt;br /&gt;      firstDay=0;&lt;br /&gt;      firstRound=false;&lt;br /&gt;     }&lt;br /&gt;     firstDay++;&lt;br /&gt;    }&lt;br /&gt;    System.out.println("\n");&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*************************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6845598358321827380?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6845598358321827380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-simple-calendar.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6845598358321827380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6845598358321827380'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-simple-calendar.html' title='Java simple calendar'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-1767501520464594684</id><published>2009-03-27T01:44:00.003+08:00</published><updated>2009-03-27T02:00:18.282+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='image'/><category scheme='http://www.blogger.com/atom/ns#' term='scale'/><title type='text'>Java scale image</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_f2uGmZtYbGs/ScvCGGUd8MI/AAAAAAAABwo/yn0EHOUZHzU/s1600-h/Sephiroth_by_Wen_JR.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 272px;" src="http://3.bp.blogspot.com/_f2uGmZtYbGs/ScvCGGUd8MI/AAAAAAAABwo/yn0EHOUZHzU/s400/Sephiroth_by_Wen_JR.jpg" alt="" id="BLOGGER_PHOTO_ID_5317557195072467138" border="0" /&gt;&lt;/a&gt;Sephiroth_by_Wen_JR.jpg&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;table&gt;&lt;br /&gt;Complete source code below will show you, how to scale an image in java using AffineTransform class. It will scale base on x and y axis.&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ScaleImage.java&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.awt.Image;&lt;br /&gt;import java.awt.Graphics;&lt;br /&gt;import java.awt.Graphics2D;&lt;br /&gt;import java.awt.Toolkit;&lt;br /&gt;import java.awt.BorderLayout;&lt;br /&gt;import java.awt.Dimension;&lt;br /&gt;&lt;br /&gt;import java.awt.event.ActionEvent;&lt;br /&gt;import java.awt.event.ActionListener;&lt;br /&gt;&lt;br /&gt;import java.awt.geom.AffineTransform;&lt;br /&gt;&lt;br /&gt;import javax.swing.JScrollPane;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;import javax.swing.JLabel;&lt;br /&gt;import javax.swing.JButton;&lt;br /&gt;import javax.swing.JTextField;&lt;br /&gt;import javax.swing.JPanel;&lt;br /&gt;import javax.swing.ImageIcon;&lt;br /&gt;&lt;br /&gt;public class ScaleImage extends JPanel implements ActionListener&lt;br /&gt;{&lt;br /&gt; JScrollPane scrollBar;&lt;br /&gt; JPanel panelB;&lt;br /&gt; JButton button;&lt;br /&gt; JTextField textFieldX;&lt;br /&gt; JTextField textFieldY;&lt;br /&gt; JFrame myWindow;&lt;br /&gt; ImageIcon ii;&lt;br /&gt; &lt;br /&gt; AffineTransform at=new AffineTransform();&lt;br /&gt; &lt;br /&gt; Image myImage;&lt;br /&gt; &lt;br /&gt; double x=0.3;&lt;br /&gt; double y=0.3;&lt;br /&gt; &lt;br /&gt; public ScaleImage()&lt;br /&gt; {&lt;br /&gt;  //CHANGE Sephiroth_by_Wen_JR.jpg TO IMAGE THAT YOU WANT&lt;br /&gt;  myImage=Toolkit.getDefaultToolkit().getImage("Sephiroth_by_Wen_JR.jpg");&lt;br /&gt;    &lt;br /&gt;  ii=new ImageIcon(myImage);&lt;br /&gt;  &lt;br /&gt;  JLabel labelX=new JLabel("X : ");&lt;br /&gt;  JLabel labelY=new JLabel("Y : ");&lt;br /&gt;  textFieldX=new JTextField("0.3",10);&lt;br /&gt;  textFieldY=new JTextField("0.3",10);&lt;br /&gt;  button=new JButton("Refresh");&lt;br /&gt;  &lt;br /&gt;  button.addActionListener(this);&lt;br /&gt;  &lt;br /&gt;  panelB=new JPanel();&lt;br /&gt;  panelB.add(labelX);&lt;br /&gt;  panelB.add(textFieldX);&lt;br /&gt;  panelB.add(labelY);&lt;br /&gt;  panelB.add(textFieldY);&lt;br /&gt;  panelB.add(button);&lt;br /&gt;  &lt;br /&gt;  setPreferredSize(new Dimension((int)(ii.getIconWidth()*x),(int)(ii.getIconHeight()*y)));&lt;br /&gt;  scrollBar=new JScrollPane(this);&lt;br /&gt;  &lt;br /&gt;  myWindow=new JFrame("Scale image");&lt;br /&gt;  myWindow.getContentPane().setLayout(new BorderLayout());  &lt;br /&gt;  myWindow.getContentPane().add(scrollBar,BorderLayout.CENTER);&lt;br /&gt;  myWindow.getContentPane().add(panelB,BorderLayout.SOUTH); &lt;br /&gt;  myWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;  myWindow.setSize(500,500);&lt;br /&gt;  myWindow.setLocationRelativeTo(null);&lt;br /&gt;  myWindow.setVisible(true);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void actionPerformed(ActionEvent e)&lt;br /&gt; {&lt;br /&gt;  if(e.getSource()==button)&lt;br /&gt;  {&lt;br /&gt;   x=Double.parseDouble(textFieldX.getText());&lt;br /&gt;   y=Double.parseDouble(textFieldY.getText());&lt;br /&gt;   &lt;br /&gt;   setPreferredSize(new Dimension((int)(ii.getIconWidth()*x),(int)(ii.getIconHeight()*y)));&lt;br /&gt;   &lt;br /&gt;   myWindow.repaint();&lt;br /&gt;   scrollBar.revalidate();&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void paint(Graphics g)&lt;br /&gt; {&lt;br /&gt;   at.setToScale(x,y);&lt;br /&gt;   Graphics2D g2d=(Graphics2D)g;&lt;br /&gt;   g2d.drawImage(myImage,at,this);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  ScaleImage si=new ScaleImage();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE&lt;br /&gt;&lt;b&gt;&lt;i&gt;Note : Make sure Sephiroth_by_Wen_JR.jpg locate at same location with this source file&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-1767501520464594684?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/1767501520464594684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-scale-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1767501520464594684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1767501520464594684'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-scale-image.html' title='Java scale image'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_f2uGmZtYbGs/ScvCGGUd8MI/AAAAAAAABwo/yn0EHOUZHzU/s72-c/Sephiroth_by_Wen_JR.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-1973987535088325410</id><published>2009-03-26T20:24:00.002+08:00</published><updated>2009-03-26T20:57:55.917+08:00</updated><title type='text'>Create exception handling</title><content type='html'>&lt;table&gt;&lt;br /&gt;In this post, i want to share with you about how to create our own exception handling. Sometime when we build our program, we want it to handle certain mistake or exception that not exist in java predefined exception class.For example we want to control user from put negative integer value. Complete source code below will show you, how you can create an exception class that avoid user from put negative integer value.&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : NegativeIntegerException.java&lt;br /&gt;*************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class NegativeIntegerException extends RuntimeException&lt;br /&gt;{&lt;br /&gt; public void checkNumber(int a)&lt;br /&gt; {&lt;br /&gt;  if(a&amp;lt;0)&lt;br /&gt;  {&lt;br /&gt;   throw new NegativeIntegerException();&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  Scanner scanUserInput=new Scanner(System.in);&lt;br /&gt;  NegativeIntegerException nie=new NegativeIntegerException();&lt;br /&gt;  boolean b=true;&lt;br /&gt;  while(b)&lt;br /&gt;  {&lt;br /&gt;   System.out.println("Put an integer");&lt;br /&gt;   System.out.println("Put 0 EXIT");&lt;br /&gt;   int c=scanUserInput.nextInt();&lt;br /&gt;   if(c==0)&lt;br /&gt;   {&lt;br /&gt;    b=false;&lt;br /&gt;   }&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;     nie.checkNumber(c);&lt;br /&gt;     System.out.println("YOUR NUMBER IS : "+c);&lt;br /&gt;    }&lt;br /&gt;    catch(NegativeIntegerException exception)&lt;br /&gt;    {&lt;br /&gt;     System.out.println("&amp;lt;&amp;lt;PLEASE PUT ONLY POSITIVE INTEGER!!!&amp;gt;&amp;gt;");&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-1973987535088325410?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/1973987535088325410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/create-exception-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1973987535088325410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1973987535088325410'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/create-exception-handling.html' title='Create exception handling'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-18950784567709114</id><published>2009-03-26T00:44:00.003+08:00</published><updated>2009-03-26T01:51:56.242+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='handling'/><category scheme='http://www.blogger.com/atom/ns#' term='exception'/><title type='text'>Java exception handling</title><content type='html'>&lt;table&gt;&lt;br /&gt;Now, i want to share with you about exception handling in java. Okay, this is only for introduction to exception handling. Firstly, what is exception?&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;Exception - a person or thing that is excepted or that does not follow a rule.&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;So, if we talk about exception handling in java program, it mean we want to handle any mistake that we can handle during compile time or runtime. &lt;br /&gt;&lt;br /&gt;For example :&lt;br /&gt;-User put String into input field that only handle integer value.&lt;br /&gt;-Out of memory.&lt;br /&gt;-Array index that over than it's (length-1) or negative value. We also called it as ArrayIndexOutOfBoundsException &lt;br /&gt;&lt;br /&gt;Why, i said "we want to handle any mistake that we can handle"?The answer is, there exist error that we can't handle.&lt;br /&gt;&lt;br /&gt;For example :&lt;br /&gt;-Blue screen of death(BSOD)&lt;br /&gt;-Computer suddenly crash&lt;br /&gt;-Black out&lt;br /&gt;-Or someone switch off your computer&lt;br /&gt;&lt;br /&gt;Ok, i hope you understand what i mean until this line. Why we need exception handling ? The answer is, we want to make sure our program is robust. It will try to handle any mistake that the user make. &lt;br /&gt;&lt;br /&gt;Now, we will see two sample java programs. Both of them will ask user to input their age.After that, it will print it's value. This program only terminate when user put 0. Like we know, age is integer value. It can't be floating point number or String except your program need the user to put it in String. It is make not sense if when you ask someone for their age, and after that it answer like this "MY AGE IS 19.28". First program will has no exception handling. It will print some description about exception that occur and after that the program will end without follow program flow when the user put String value or others. But, in second program, it totally different. It will tell user that the input is wrong. After that, it will ask again until user put 0 to exit.Let we see both of them.Before i forget, if you put negative integer value, this program will work fine because it also integer. I will discuss later, about how to handle this in how to create our own exception handling.&lt;br /&gt;&lt;br /&gt;FIRST PROGRAM :&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class Test&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  while(true)&lt;br /&gt;  {&lt;br /&gt;   Scanner scanUserInput=new Scanner(System.in);&lt;br /&gt;   System.out.println("Put 0 to exit");&lt;br /&gt;   System.out.println("What is your age ?");&lt;br /&gt;   int a=scanUserInput.nextInt();&lt;br /&gt;   if(a==0)&lt;br /&gt;   {&lt;br /&gt;    System.exit(0);&lt;br /&gt;   }&lt;br /&gt;   System.out.println("YOUR AGE IS : "+a);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;SECOND PROGRAM :&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;import java.util.InputMismatchException;&lt;br /&gt;&lt;br /&gt;public class Test&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  while(true)&lt;br /&gt;  {&lt;br /&gt;   try&lt;br /&gt;   {&lt;br /&gt;    Scanner scanUserInput=new Scanner(System.in);&lt;br /&gt;    System.out.println("Put 0 to exit");&lt;br /&gt;    System.out.println("What is your age ?");&lt;br /&gt;    int a=scanUserInput.nextInt();&lt;br /&gt;    if(a==0)&lt;br /&gt;    {&lt;br /&gt;     System.exit(0);&lt;br /&gt;    }&lt;br /&gt;    System.out.println("YOUR AGE IS : "+a);&lt;br /&gt;   }&lt;br /&gt;   catch(InputMismatchException exception)&lt;br /&gt;   {&lt;br /&gt;    System.out.println("Hey, don't play with me!");&lt;br /&gt;    System.out.println("PLEASE PUT ONLY INTEGER VALUE");&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-18950784567709114?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/18950784567709114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-exception-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/18950784567709114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/18950784567709114'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-exception-handling.html' title='Java exception handling'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5098492798059855009</id><published>2009-03-24T00:01:00.003+08:00</published><updated>2009-03-26T01:51:30.787+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='modal'/><category scheme='http://www.blogger.com/atom/ns#' term='window'/><title type='text'>Java modal window</title><content type='html'>&lt;table&gt;&lt;br /&gt;Hi everyone, today i want to share with you about &lt;b&gt;MODAL WINDOW&lt;/b&gt;.How it's look like? Before i show you example of MODAL WINDOW, let we look for it's little description :&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;If a window is modal, no other window can be active while the modal window is displayed.&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Simple example is message box from JOptionPane. When a message box is showing, you can't work with other window until you press OK or others button on the message box.&lt;br /&gt;This message box is a simple example of MODAL WINDOW.&lt;br /&gt;&lt;br /&gt;You can try compile java code below to see how it's look like.&lt;br /&gt;&lt;br /&gt;***********************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ModalWindow.java&lt;br /&gt;***********************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;&lt;br /&gt;public class ModalWindow&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  JFrame myWindow=new JFrame("My Window");&lt;br /&gt;  &lt;br /&gt;  myWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;  myWindow.setSize(400,400);&lt;br /&gt;  myWindow.setVisible(true);&lt;br /&gt;  &lt;br /&gt;  JOptionPane.showMessageDialog(null,"Hello");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;***********************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***********************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5098492798059855009?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5098492798059855009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-modal-window.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5098492798059855009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5098492798059855009'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-modal-window.html' title='Java modal window'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5721639407654216182</id><published>2009-03-23T01:58:00.003+08:00</published><updated>2009-03-23T02:28:02.345+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='integer'/><category scheme='http://www.blogger.com/atom/ns#' term='user input'/><category scheme='http://www.blogger.com/atom/ns#' term='validate'/><title type='text'>Java validate integer user input</title><content type='html'>&lt;table&gt;&lt;br /&gt;Sometime, when we play with user input, we want to validate the input value is specific to certain data type. For example, you have a simple java program that query for user's age. Like we know age is in integer data type. So how to handle if a user put his age something like this, "fifty" or 50.34. This is impossible right? But if the user want to test the robustness of your system from error handling view, this is not impossible.Now i want to share with you, how you can handle this in a simple java program that run through command prompt.&lt;b&gt;The basic idea is, if a user put other than integer value, our program will throw an exception. So, we will put our code that tell user what he/she do is wrong in the exception block&lt;/b&gt;.In other tutorial, i will share with you how to create your own exception handling.&lt;br /&gt;&lt;br /&gt;***************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ValidateIntegerInput.java&lt;br /&gt;***************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;import java.util.InputMismatchException;&lt;br /&gt;&lt;br /&gt;public class ValidateIntegerInput&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  boolean benchmark=true;&lt;br /&gt;  while(benchmark)&lt;br /&gt;  {&lt;br /&gt;   Scanner a=new Scanner(System.in);&lt;br /&gt;  &lt;br /&gt;   try&lt;br /&gt;   {&lt;br /&gt;    System.out.println("Put 0 to exit");&lt;br /&gt;    System.out.println("What is your age?");&lt;br /&gt;   &lt;br /&gt;    //nextInt will throw InputMismatchException&lt;br /&gt;    //if the next token does not match the Integer  &lt;br /&gt;    //regular expression, or is out of range &lt;br /&gt;    int b=a.nextInt();&lt;br /&gt;    if(b==0)&lt;br /&gt;    {&lt;br /&gt;     benchmark=false;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;     System.out.println("Your age is : "+b);&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;   catch(InputMismatchException exception)&lt;br /&gt;   {&lt;br /&gt;    //Print "This is not an integer"&lt;br /&gt;    //when user put other than integer&lt;br /&gt;    System.out.println("Please put integer value");&lt;br /&gt;   }&lt;br /&gt;   catch(Exception exception)&lt;br /&gt;   {&lt;br /&gt;    exception.printStackTrace();&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;***************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5721639407654216182?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5721639407654216182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-validate-integer-user-input.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5721639407654216182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5721639407654216182'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-validate-integer-user-input.html' title='Java validate integer user input'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3009230036822920784</id><published>2009-03-21T16:06:00.002+08:00</published><updated>2009-03-21T16:24:55.109+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='pathname'/><category scheme='http://www.blogger.com/atom/ns#' term='drive'/><title type='text'>Java determine drive pathname</title><content type='html'>&lt;table&gt;&lt;br /&gt;Complete source code below will show you how to determine a pathname is a pathname for drive or not.&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : PathnameIsDrive.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;import javax.swing.filechooser.FileSystemView;&lt;br /&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;&lt;br /&gt;public class PathnameIsDrive&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  //Create file instance from pathname&lt;br /&gt;  //Try change to pathname that match any drive in your computer&lt;br /&gt;  //For example C:\\ for C drive.&lt;br /&gt;  File myFile=new File("C:\\");&lt;br /&gt;  &lt;br /&gt;  //Check whether the given pathname is drive or not&lt;br /&gt;  if(FileSystemView.getFileSystemView().isDrive(myFile))&lt;br /&gt;  {&lt;br /&gt;   System.out.println("This is a drive");&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   System.out.println("This is not a drive");&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3009230036822920784?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3009230036822920784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-determine-drive-pathname.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3009230036822920784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3009230036822920784'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-determine-drive-pathname.html' title='Java determine drive pathname'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-246110448280772856</id><published>2009-03-21T02:02:00.002+08:00</published><updated>2009-03-21T02:34:45.120+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='pathname'/><category scheme='http://www.blogger.com/atom/ns#' term='file'/><title type='text'>Java and pathname</title><content type='html'>Before i go through about file's operation, i want to share with you about "pathname" keyword. In java there has lot of methods  play with pathname.&lt;br /&gt;&lt;br /&gt;For example :&lt;br /&gt;When we want to create a file instance like below&lt;br /&gt;******************************************&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;File myFile=new File("c:\\mytext.txt");&lt;/span&gt;&lt;br /&gt;******************************************&lt;br /&gt;&lt;br /&gt;"c:\\mytext.txt" is a pathname for mytext.txt that locate in c drive.Origin for c:\\mytext.txt is c:\mytext.txt.We use two backslash to prevent syntax error when we compile it.&lt;br /&gt;&lt;br /&gt;So, what is &lt;span style="font-weight: bold; font-style: italic;"&gt;pathname&lt;/span&gt; ?&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A pathname is a &lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt;string that describes what directory the file is in, as well as the name of the file&lt;/span&gt;.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-246110448280772856?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/246110448280772856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-and-pathname.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/246110448280772856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/246110448280772856'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-and-pathname.html' title='Java and pathname'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3834963884638193539</id><published>2009-03-18T08:03:00.004+08:00</published><updated>2009-03-18T08:52:56.344+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='open'/><category scheme='http://www.blogger.com/atom/ns#' term='cd tray'/><title type='text'>Java open cd tray in Windows XP</title><content type='html'>&lt;table&gt;&lt;br /&gt;Complete source code below will show you how to open cd tray using java in Windows XP. I'm not sure whether this code success or not in Vista. I hope someone that use Vista will tell me through comment. It is simple. We will use VBScript code to open cd tray for us. Before i forget, VBScript that will use is VBScript that has related to WSH(Windows Script Host). If you want to make some googling, you must search something like "VBScript wsh" or "Introduction to VBScript &amp; WSH". This is because, if you use only something like "VBScript", you will be bring to page that explain about VBScript in web page development. For someone that interesting in computer virus development, you can try to learn VBScript in wsh. Most of computer virus today is writing using this stuff beside using c,c++,assembly language or others.&lt;br /&gt;&lt;br /&gt;PROBLEM IN THIS CODE : How to terminate wscript.exe that left in process tab in windows task manager. Tell me if you know how to solve it in comment box.&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : OpenCdTray.java&lt;br /&gt;*************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.awt.Desktop;&lt;br /&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.PrintWriter;&lt;br /&gt;&lt;br /&gt;public class OpenCdTray&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;   //********Start VBScript code to open cd tray************&lt;br /&gt;   String a="Set oWMP = CreateObject(\"WMPlayer.OCX\")"+"\n"&lt;br /&gt;    +"Set colCDROMs = oWMP.cdromCollection"+"\n"&lt;br /&gt;    +"For d = 0 to colCDROMs.Count - 1"+"\n"&lt;br /&gt;    +"colCDROMs.Item(d).Eject"+"\n"&lt;br /&gt;    +"Next"+"\n"&lt;br /&gt;    +"set owmp = nothing"+"\n"&lt;br /&gt;    +"set colCDROMs = nothing"+"\n"&lt;br /&gt;    +"wscript.Quit(0)";&lt;br /&gt;   //********End VBScript code to open cd tray************&lt;br /&gt;   &lt;br /&gt;   //Create a vbscript file called OpenCdTray.vbs&lt;br /&gt;   File myCdTrayOpener=new File("OpenCdTray.vbs");&lt;br /&gt;   &lt;br /&gt;   //Create a PrintWriter object that will use to write into created file&lt;br /&gt;   PrintWriter pw=new PrintWriter(myCdTrayOpener);&lt;br /&gt;   &lt;br /&gt;   //Write all string in (a) into created file&lt;br /&gt;   pw.print(a);&lt;br /&gt;   &lt;br /&gt;   //Flush all resource in PrintWriter to make sure&lt;br /&gt;   //there are no data left in this stream.&lt;br /&gt;   pw.flush();&lt;br /&gt;   &lt;br /&gt;   //Close PrintWriter and releases any &lt;br /&gt;   //system resources associated with it&lt;br /&gt;   pw.close();&lt;br /&gt;   &lt;br /&gt;   //Create a Desktop object to open created vbs file(OpenCdTray.vbs).&lt;br /&gt;   //It will open using default application that will use &lt;br /&gt;   //to handle this file in targeted computer. &lt;br /&gt;   //True application to run this file is wscript.exe&lt;br /&gt;   Desktop.getDesktop().open(myCdTrayOpener);&lt;br /&gt;   &lt;br /&gt;   //Delete created vbs file before terminate application&lt;br /&gt;   myCdTrayOpener.deleteOnExit();&lt;br /&gt;  }&lt;br /&gt;  catch(Exception exception)&lt;br /&gt;  {&lt;br /&gt;   exception.printStackTrace();&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3834963884638193539?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3834963884638193539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-open-cd-tray-in-windows-xp.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3834963884638193539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3834963884638193539'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-open-cd-tray-in-windows-xp.html' title='Java open cd tray in Windows XP'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-9200954955145333136</id><published>2009-03-17T08:49:00.003+08:00</published><updated>2009-03-17T08:59:42.097+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='program'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jar'/><category scheme='http://www.blogger.com/atom/ns#' term='file'/><title type='text'>Call jar file from a java program</title><content type='html'>&lt;table&gt;&lt;br /&gt;Complete source code below will show you, how to open or call a jar file (java executable file) from a java program.&lt;br /&gt;&lt;br /&gt;Download &lt;a href="http://www.4shared.com/file/93314039/193aa4ed/MyJarFile.html"&gt;&lt;b&gt;&lt;i&gt;MyJarFile.jar&lt;/i&gt;&lt;/b&gt;&lt;/a&gt; that will use in this tutorial.Place this file at the same location with java file below before compile and execute it.&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : CallJarFile.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.awt.Desktop;&lt;br /&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;&lt;br /&gt;public class CallJarFile&lt;br /&gt;{&lt;br /&gt; public static void main(String[]args)&lt;br /&gt; {&lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;   //Call MyJarFile.jar&lt;br /&gt;   Desktop.getDesktop().open(new File("MyJarFile.jar"));&lt;br /&gt;  }&lt;br /&gt;  catch(Exception exception)&lt;br /&gt;  {&lt;br /&gt;   exception.printStackTrace();&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-9200954955145333136?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/9200954955145333136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/call-jar-file-from-java-program.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/9200954955145333136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/9200954955145333136'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/call-jar-file-from-java-program.html' title='Call jar file from a java program'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6178371616698201055</id><published>2009-03-15T20:09:00.003+08:00</published><updated>2009-03-16T17:38:18.711+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jtextfield'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='selection'/><title type='text'>Set JTextField selection color</title><content type='html'>Complete source code below will show you how to set JTextField selection color.&lt;br /&gt;&lt;br /&gt;***************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJTextFieldSelectionColor.java&lt;br /&gt;***************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class SetJTextFieldSelectionColor&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; JTextField jtf=new JTextField("Select this text");&lt;br /&gt;&lt;br /&gt; //Color that will use as JTextField's selection color&lt;br /&gt; //It is base on RGB value&lt;br /&gt; //Red=255&lt;br /&gt; //Green=0&lt;br /&gt; //Blue=0&lt;br /&gt; //You can use color picker at above to get RGB value&lt;br /&gt; Color selectionColor=new Color(255,0,0);&lt;br /&gt;&lt;br /&gt; //Set JTextField selection color&lt;br /&gt; jtf.setSelectionColor(selectionColor);&lt;br /&gt;&lt;br /&gt; JFrame myWindow=new JFrame("Set JTextField selection color");&lt;br /&gt;&lt;br /&gt; myWindow.add(jtf);&lt;br /&gt; myWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; myWindow.setSize(400,50);&lt;br /&gt; myWindow.setLocationRelativeTo(null);&lt;br /&gt; myWindow.setVisible(true);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;***************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6178371616698201055?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6178371616698201055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/set-jtextfield-selection-color.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6178371616698201055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6178371616698201055'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/set-jtextfield-selection-color.html' title='Set JTextField selection color'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5136349792802983395</id><published>2009-03-15T15:54:00.003+08:00</published><updated>2009-03-16T17:38:46.635+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jtextfield'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='caret'/><title type='text'>Set JTextField caret color</title><content type='html'>Complete source code below will show you, how to set JTextField caret color.&lt;br /&gt;&lt;br /&gt;****************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJTextFieldCaretColor.java&lt;br /&gt;****************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class SetJTextFieldCaretColor&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; JTextField jtf=new JTextField(20);&lt;br /&gt; jtf.setFont(new Font("Verdana",Font.BOLD,34));&lt;br /&gt;&lt;br /&gt; JFrame myFrame=new JFrame("Set JTextField caret color");&lt;br /&gt;&lt;br /&gt; //Set caret color base on RGB value&lt;br /&gt; //R=255&lt;br /&gt; //G=0&lt;br /&gt; //B=0&lt;br /&gt; //You can get RGB value from color picker at above&lt;br /&gt; jtf.setCaretColor(new Color(255,0,0));&lt;br /&gt;&lt;br /&gt; myFrame.setLayout(new FlowLayout());&lt;br /&gt; myFrame.add(jtf);&lt;br /&gt; myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; myFrame.pack();&lt;br /&gt; myFrame.setLocationRelativeTo(null);&lt;br /&gt; myFrame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;****************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;****************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5136349792802983395?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5136349792802983395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/set-jtextfield-caret-color.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5136349792802983395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5136349792802983395'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/set-jtextfield-caret-color.html' title='Set JTextField caret color'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6449756873695851249</id><published>2009-03-15T03:12:00.003+08:00</published><updated>2009-03-16T17:39:22.603+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jtextfield'/><category scheme='http://www.blogger.com/atom/ns#' term='caret'/><title type='text'>JTextField caret</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_f2uGmZtYbGs/SbwB9xWWFsI/AAAAAAAABsw/rRXf0bxsKx8/s1600-h/What+is+CARET.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5313123821121050306" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 250px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_f2uGmZtYbGs/SbwB9xWWFsI/AAAAAAAABsw/rRXf0bxsKx8/s400/What+is+CARET.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6449756873695851249?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6449756873695851249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/jtextfield-caret.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6449756873695851249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6449756873695851249'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/jtextfield-caret.html' title='JTextField caret'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_f2uGmZtYbGs/SbwB9xWWFsI/AAAAAAAABsw/rRXf0bxsKx8/s72-c/What+is+CARET.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-99244529728565938</id><published>2009-03-14T09:39:00.004+08:00</published><updated>2009-03-16T18:08:04.267+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='transparent'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jtextfield'/><title type='text'>Java : Transparent JTextField</title><content type='html'>Complete source code below, will show you how to create a transparent text field in Java.&lt;br /&gt;&lt;br /&gt;***********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : TransparentJTextField.java&lt;br /&gt;***********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class TransparentJTextField&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;JFrame myFrame=new JFrame("Transparent JTextField");&lt;br /&gt;&lt;br /&gt;JTextField test=new JTextField(10);&lt;br /&gt;&lt;br /&gt;//MAKE JTextField TRANSPARENT&lt;br /&gt;test.setOpaque(false);&lt;br /&gt;&lt;br /&gt;myFrame.setLayout(new FlowLayout());&lt;br /&gt;myFrame.add(test);&lt;br /&gt;myFrame.setSize(400,100);&lt;br /&gt;myFrame.setLocationRelativeTo(null);&lt;br /&gt;myFrame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;***********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-99244529728565938?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/99244529728565938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-transparent-jtextfield.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/99244529728565938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/99244529728565938'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-transparent-jtextfield.html' title='Java : Transparent JTextField'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5074131555672353902</id><published>2009-03-14T02:24:00.003+08:00</published><updated>2009-03-16T17:40:47.052+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='while'/><category scheme='http://www.blogger.com/atom/ns#' term='loop'/><category scheme='http://www.blogger.com/atom/ns#' term='for'/><title type='text'>For loop act as while loop</title><content type='html'>&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class ForActAsWhile&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; /*&lt;br /&gt;  * while(true)&lt;br /&gt;  * {&lt;br /&gt;  *  System.out.println("HELLO WORLD");&lt;br /&gt;  * }&lt;br /&gt;  *&lt;br /&gt;  *&lt;br /&gt;  *Now we will create for loop&lt;br /&gt;  *that will act like while loop at above&lt;br /&gt;  */&lt;br /&gt; &lt;br /&gt;  /*&lt;br /&gt;   *For loop at below is an unstopable loop.&lt;br /&gt;   *It will act like while loop at above.&lt;br /&gt;   *It has no i++ at last.So (i) value is always 0.&lt;br /&gt;   *And 0 is less then 1.This condition is always true.&lt;br /&gt;   *NOTE : &amp;lt;&amp;lt;DON'T EXECUTE IT!!&amp;gt;&amp;gt;.This is only for learning.&lt;br /&gt;   */&lt;br /&gt;  for(int i=0;i&amp;lt;1;)&lt;br /&gt;  {&lt;br /&gt;   System.out.println("HELLO WORLD");&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5074131555672353902?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5074131555672353902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/for-loop-act-as-while-loop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5074131555672353902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5074131555672353902'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/for-loop-act-as-while-loop.html' title='For loop act as while loop'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6309148679826995044</id><published>2009-03-13T01:53:00.004+08:00</published><updated>2009-03-16T18:08:24.250+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='play'/><category scheme='http://www.blogger.com/atom/ns#' term='wav'/><category scheme='http://www.blogger.com/atom/ns#' term='file'/><title type='text'>Java play wav file</title><content type='html'>Complete source code below will show you, how to play wav file in java.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.4shared.com/file/92543249/70e6b924/Star-Wars-4118.html"&gt;Click here to download &lt;b&gt;&lt;i&gt;Star-Wars-4118.wav&lt;/i&gt;&lt;/b&gt;&lt;/a&gt; that will use with this code. Place this wav file same location with this source code file.&lt;br /&gt;&lt;br /&gt;***********************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : PlayWavFile.java&lt;br /&gt;***********************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;import javax.sound.sampled.AudioFormat;&lt;br /&gt;import javax.sound.sampled.AudioInputStream;&lt;br /&gt;import javax.sound.sampled.AudioSystem;&lt;br /&gt;import javax.sound.sampled.DataLine;&lt;br /&gt;import javax.sound.sampled.SourceDataLine;&lt;br /&gt;&lt;br /&gt;public class PlayWavFile&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;String filename="Star-Wars-4118.wav";&lt;br /&gt;&lt;br /&gt;int EXTERNAL_BUFFER_SIZE = 524288;&lt;br /&gt;&lt;br /&gt;File soundFile = new File(filename);&lt;br /&gt;&lt;br /&gt;if (!soundFile.exists())&lt;br /&gt;{&lt;br /&gt; System.err.println("Wave file not found: " + filename);&lt;br /&gt; return;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;AudioInputStream audioInputStream = null;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt; audioInputStream = AudioSystem.getAudioInputStream(soundFile);&lt;br /&gt;}&lt;br /&gt;catch(Exception e)&lt;br /&gt;{&lt;br /&gt; e.printStackTrace();&lt;br /&gt; return;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;AudioFormat format = audioInputStream.getFormat();&lt;br /&gt;&lt;br /&gt;SourceDataLine auline = null;&lt;br /&gt;&lt;br /&gt;//Describe a desired line&lt;br /&gt;DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt; auline = (SourceDataLine) AudioSystem.getLine(info);&lt;br /&gt;&lt;br /&gt; //Opens the line with the specified format,&lt;br /&gt; //causing the line to acquire any required&lt;br /&gt; //system resources and become operational.&lt;br /&gt; auline.open(format);&lt;br /&gt;}&lt;br /&gt;catch(Exception e)&lt;br /&gt;{&lt;br /&gt; e.printStackTrace();&lt;br /&gt; return;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; //Allows a line to engage in data I/O&lt;br /&gt;auline.start();&lt;br /&gt;&lt;br /&gt;int nBytesRead = 0;&lt;br /&gt;byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt; while (nBytesRead != -1)&lt;br /&gt; {&lt;br /&gt;  nBytesRead = audioInputStream.read(abData, 0, abData.length);&lt;br /&gt;  if (nBytesRead &gt;= 0)&lt;br /&gt;  {&lt;br /&gt;   //Writes audio data to the mixer via this source data line&lt;br /&gt;   //NOTE : A mixer is an audio device with one or more lines&lt;br /&gt;   auline.write(abData, 0, nBytesRead);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;catch(Exception e)&lt;br /&gt;{&lt;br /&gt; e.printStackTrace();&lt;br /&gt; return;&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt; //Drains queued data from the line&lt;br /&gt; //by continuing data I/O until the&lt;br /&gt; //data line's internal buffer has been emptied&lt;br /&gt; auline.drain();&lt;br /&gt;&lt;br /&gt; //Closes the line, indicating that any system&lt;br /&gt; //resources in use by the line can be released&lt;br /&gt; auline.close();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;***********************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***********************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6309148679826995044?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6309148679826995044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-play-wav-file.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6309148679826995044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6309148679826995044'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-play-wav-file.html' title='Java play wav file'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5648599317044530586</id><published>2009-03-11T08:38:00.004+08:00</published><updated>2009-03-16T18:08:40.263+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='invisible'/><category scheme='http://www.blogger.com/atom/ns#' term='cursor'/><title type='text'>Java invisible cursor</title><content type='html'>Complete source code below will show you, how to create invisible cursor in java.&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : MakeCursorInvisible.java&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.awt.Toolkit;&lt;br /&gt;import java.awt.Cursor;&lt;br /&gt;import java.awt.Point;&lt;br /&gt;import java.awt.Image;&lt;br /&gt;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;&lt;br /&gt;public class MakeCursorInvisible&lt;br /&gt;{&lt;br /&gt;//Create an empty byte array&lt;br /&gt;byte[]imageByte=new byte[0];&lt;br /&gt;&lt;br /&gt;Cursor myCursor;&lt;br /&gt;Point myPoint=new Point(0,0);&lt;br /&gt;&lt;br /&gt;//Create image for cursor using empty array&lt;br /&gt;Image cursorImage=Toolkit.getDefaultToolkit().createImage(imageByte);&lt;br /&gt;&lt;br /&gt;public MakeCursorInvisible()&lt;br /&gt;{&lt;br /&gt;//Create cursor&lt;br /&gt;myCursor=Toolkit.getDefaultToolkit().createCustomCursor(cursorImage,myPoint,"cursor");&lt;br /&gt;&lt;br /&gt;JFrame frame=new JFrame("Put your cursor into me");&lt;br /&gt;&lt;br /&gt;//Set cursor for JFrame using created cursor(myCursor)&lt;br /&gt;frame.setCursor(myCursor);&lt;br /&gt;&lt;br /&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;frame.setSize(300,300);&lt;br /&gt;frame.setLocationRelativeTo(null);&lt;br /&gt;frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;MakeCursorInvisible mci=new MakeCursorInvisible();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5648599317044530586?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5648599317044530586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-invisible-cursor.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5648599317044530586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5648599317044530586'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-invisible-cursor.html' title='Java invisible cursor'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4821598939904474557</id><published>2009-03-10T02:21:00.004+08:00</published><updated>2009-03-16T18:08:53.543+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='file'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='read only'/><title type='text'>Set file to Read-only in java</title><content type='html'>Complete source code below will show you, how to set a file to Read-only in java.&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetFileReadOnly.java&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;&lt;br /&gt;public class SetFileReadOnly&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;File myFile=new File("MyFile.txt");&lt;br /&gt;&lt;br /&gt;//Set MyFile.txt to Read-only&lt;br /&gt;myFile.setReadOnly();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.4shared.com/file/91966113/e4366392/MyFile.html"&gt;&lt;b&gt;Click here to download MyFile.txt&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note : Put MyFile.txt with java file above at the same location.&lt;/b&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4821598939904474557?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4821598939904474557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/set-file-to-read-only-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4821598939904474557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4821598939904474557'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/set-file-to-read-only-in-java.html' title='Set file to Read-only in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-7551419327116946901</id><published>2009-03-09T22:13:00.004+08:00</published><updated>2009-03-16T18:09:14.970+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='palindrome'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java palindrome checker</title><content type='html'>What is palindrome ?&lt;br /&gt;-Palindrome is &lt;b&gt;a word or sequence that reads the same backwards as forwards&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For example :&lt;br /&gt;&lt;b&gt;MADAM&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;***************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaPalindromeChecker.java&lt;br /&gt;***************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;import java.util.StringTokenizer;&lt;br /&gt;&lt;br /&gt;public class JavaPalindromeChecker&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;System.out.println("Put your text below");&lt;br /&gt;Scanner sc=new Scanner(System.in);&lt;br /&gt;String a=sc.nextLine();&lt;br /&gt;StringTokenizer st=new StringTokenizer(a);&lt;br /&gt;String b="";&lt;br /&gt;while(st.hasMoreTokens())&lt;br /&gt;{&lt;br /&gt; b=b+st.nextToken();&lt;br /&gt;}&lt;br /&gt;int stringLength=b.length();&lt;br /&gt;String benchMark="Palindrome";&lt;br /&gt;if(stringLength%2!=0)&lt;br /&gt;{&lt;br /&gt; int c=((stringLength-1)/2);&lt;br /&gt; for(int i=0;i&amp;lt;c;i++)&lt;br /&gt; {&lt;br /&gt;  char before=b.charAt(c-(i+1));&lt;br /&gt;  char after=b.charAt(c+(i+1));&lt;br /&gt;  if(before!=after)&lt;br /&gt;  {&lt;br /&gt;   benchMark=new String("Not Palindrome");&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt; int c=stringLength/2;&lt;br /&gt; for(int i=0;i&amp;lt;c;i++)&lt;br /&gt; {&lt;br /&gt;  char before=b.charAt(i);&lt;br /&gt;  char after=b.charAt(stringLength-(i+1));&lt;br /&gt;  if(before!=after)&lt;br /&gt;  {&lt;br /&gt;   benchMark=new String("Not Palindrome");&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;System.out.println(benchMark);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;***************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-7551419327116946901?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/7551419327116946901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-palindrome-checker.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7551419327116946901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7551419327116946901'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-palindrome-checker.html' title='Java palindrome checker'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3708955805591652276</id><published>2009-03-08T02:30:00.009+08:00</published><updated>2010-09-22T20:46:07.093+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='transparent'/><category scheme='http://www.blogger.com/atom/ns#' term='splash'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='screen'/><title type='text'>Java transparent splash screen</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_f2uGmZtYbGs/SbK92u8XRJI/AAAAAAAABqY/pYeMkDaLiJ8/s1600-h/SAMPLE.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" style="text-decoration: none;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5310515658635035794" src="http://2.bp.blogspot.com/_f2uGmZtYbGs/SbK92u8XRJI/AAAAAAAABqY/pYeMkDaLiJ8/s400/SAMPLE.jpg" style="cursor: pointer; display: block; height: 250px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; text-align: center; text-decoration: underline; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;Sample&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;**********************************************************************&lt;/div&gt;&lt;div style="text-align: left;"&gt;TRANSPARENT IMAGE THAT WILL BE USE IN SOURCE CODE (batman.png)&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;**********************************************************************&lt;/div&gt;&lt;a href="http://2.bp.blogspot.com/_f2uGmZtYbGs/SbK-XR-cQNI/AAAAAAAABqg/cRMcsFx4CLM/s1600-h/batman.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5310516217794805970" src="http://2.bp.blogspot.com/_f2uGmZtYbGs/SbK-XR-cQNI/AAAAAAAABqg/cRMcsFx4CLM/s400/batman.png" style="cursor: hand; cursor: pointer; display: block; height: 267px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Note : Make sure batman.png locate at same location with java file below.You can use other location, but for this simple tutorial, we will use same location.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : TransparentSplashScreen.java&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre class="Java" name="code"&gt;import javax.swing.JWindow;&lt;br /&gt;import javax.swing.ImageIcon;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;&lt;br /&gt;import java.awt.Graphics;&lt;br /&gt;import java.awt.Image;&lt;br /&gt;import java.awt.Toolkit;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class TransparentSplashScreen extends JWindow&lt;br /&gt;{&lt;br /&gt;//Get transparent image that will be use as splash screen image.&lt;br /&gt;Image bi=Toolkit.getDefaultToolkit().getImage("batman.png");&lt;br /&gt;&lt;br /&gt;ImageIcon ii=new ImageIcon(bi);&lt;br /&gt;&lt;br /&gt;public TransparentSplashScreen()&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;setSize(ii.getIconWidth(),ii.getIconHeight());&lt;br /&gt;setLocationRelativeTo(null);&lt;br /&gt;show();&lt;br /&gt;Thread.sleep(10000);&lt;br /&gt;dispose();&lt;br /&gt;JOptionPane.showMessageDialog(null,"This program will exit !!!","&amp;lt;&amp;gt;",JOptionPane.INFORMATION_MESSAGE);&lt;br /&gt;}&lt;br /&gt;catch(Exception exception)&lt;br /&gt;{&lt;br /&gt;exception.printStackTrace();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//Paint transparent image onto JWindow&lt;br /&gt;public void paint(Graphics g)&lt;br /&gt;{&lt;br /&gt;g.drawImage(bi,0,0,this);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;TransparentSplashScreen tss=new TransparentSplashScreen();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3708955805591652276?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3708955805591652276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-transparent-splash-screen.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3708955805591652276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3708955805591652276'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-transparent-splash-screen.html' title='Java transparent splash screen'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_f2uGmZtYbGs/SbK92u8XRJI/AAAAAAAABqY/pYeMkDaLiJ8/s72-c/SAMPLE.jpg' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6583620793428426787</id><published>2009-03-07T03:15:00.004+08:00</published><updated>2009-03-16T18:09:48.759+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='screen'/><category scheme='http://www.blogger.com/atom/ns#' term='print'/><title type='text'>Java print screen</title><content type='html'>Complete source code below will show you, how to implement print screen or capture screen image in java. Program below will capture screen during it's executing time and after that, it will paint the image on a canvas before add it into a JFrame to display it's result.&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : CaptureScreen.java&lt;br /&gt;*************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.awt.Robot;&lt;br /&gt;import java.awt.Rectangle;&lt;br /&gt;import java.awt.Toolkit;&lt;br /&gt;import java.awt.Canvas;&lt;br /&gt;import java.awt.Graphics;&lt;br /&gt;&lt;br /&gt;import java.awt.image.BufferedImage;&lt;br /&gt;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;&lt;br /&gt;public class CaptureScreen extends Canvas&lt;br /&gt;{&lt;br /&gt;Rectangle screenRectangle=new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());&lt;br /&gt;&lt;br /&gt;Robot myRobot;&lt;br /&gt;&lt;br /&gt;BufferedImage screenImage;&lt;br /&gt;&lt;br /&gt;public CaptureScreen()&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt; myRobot=new Robot();&lt;br /&gt;}&lt;br /&gt;catch(Exception exception)&lt;br /&gt;{&lt;br /&gt; exception.printStackTrace();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;screenImage=myRobot.createScreenCapture(screenRectangle);&lt;br /&gt;&lt;br /&gt;JFrame myFrame=new JFrame("Capture Screen");&lt;br /&gt;&lt;br /&gt;myFrame.add(this);&lt;br /&gt;&lt;br /&gt;myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;myFrame.setSize(Toolkit.getDefaultToolkit().getScreenSize().width,Toolkit.getDefaultToolkit().getScreenSize().height);&lt;br /&gt;myFrame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void paint(Graphics g)&lt;br /&gt;{&lt;br /&gt;g.drawImage(screenImage,0,0,this);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;CaptureScreen cs=new CaptureScreen();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6583620793428426787?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6583620793428426787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-print-screen.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6583620793428426787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6583620793428426787'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/java-print-screen.html' title='Java print screen'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5534457551428076844</id><published>2009-03-06T01:51:00.003+08:00</published><updated>2009-03-16T17:48:31.331+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='look and feel'/><category scheme='http://www.blogger.com/atom/ns#' term='metal'/><category scheme='http://www.blogger.com/atom/ns#' term='default'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='change'/><title type='text'>Change default metal look and feel color</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_f2uGmZtYbGs/SbARpgiCQqI/AAAAAAAABpQ/t4XvLj-V314/s1600-h/ChangeMetalLookAndFeelColor.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://3.bp.blogspot.com/_f2uGmZtYbGs/SbARpgiCQqI/AAAAAAAABpQ/t4XvLj-V314/s400/ChangeMetalLookAndFeelColor.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5309763365474812578" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ChangeMetalLookAndFeelColor.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.plaf.metal.DefaultMetalTheme;&lt;br /&gt;&lt;br /&gt;import javax.swing.plaf.metal.MetalLookAndFeel;&lt;br /&gt;&lt;br /&gt;import javax.swing.plaf.ColorUIResource;&lt;br /&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.FlowLayout;&lt;br /&gt;&lt;br /&gt;public class ChangeMetalLookAndFeelColor&lt;br /&gt;{&lt;br /&gt;public ChangeMetalLookAndFeelColor()&lt;br /&gt;{&lt;br /&gt; JFrame.setDefaultLookAndFeelDecorated(true);&lt;br /&gt;&lt;br /&gt; MetalLookAndFeel.setCurrentTheme(new OrangeTheme());&lt;br /&gt;&lt;br /&gt; JFrame frame=new JFrame("Orange Theme");&lt;br /&gt;&lt;br /&gt; frame.getContentPane().setLayout(new FlowLayout());&lt;br /&gt;&lt;br /&gt; frame.getContentPane().add(new JButton("JButton"));&lt;br /&gt; frame.getContentPane().add(new JCheckBox("JCheckBox"));&lt;br /&gt; frame.getContentPane().add(new JTextField("JTextField"));&lt;br /&gt;&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; frame.setSize(500,500);&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; ChangeMetalLookAndFeelColor cmlafm=new ChangeMetalLookAndFeelColor();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OrangeTheme extends DefaultMetalTheme&lt;br /&gt;{&lt;br /&gt; //NEW COLOR FOR METAL LOOK AND FEEL&lt;br /&gt; ColorUIResource primary1=new ColorUIResource(255,215,76);&lt;br /&gt; ColorUIResource primary2=new ColorUIResource(255,198,0);&lt;br /&gt; ColorUIResource primary3=new ColorUIResource(205,162,11);&lt;br /&gt;&lt;br /&gt; ColorUIResource secondary1=new ColorUIResource(255,187,57);&lt;br /&gt; ColorUIResource secondary2=new ColorUIResource(255,168,0);&lt;br /&gt; ColorUIResource secondary3=new ColorUIResource(255,214,104);&lt;br /&gt; //NEW COLOR FOR METAL LOOK AND FEEL&lt;br /&gt;&lt;br /&gt; protected ColorUIResource getPrimary1()&lt;br /&gt; {&lt;br /&gt;  return primary1;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; protected ColorUIResource getPrimary2()&lt;br /&gt; {&lt;br /&gt;  return primary2;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; protected ColorUIResource getPrimary3()&lt;br /&gt; {&lt;br /&gt;  return primary3;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; protected ColorUIResource getSecondary1()&lt;br /&gt; {&lt;br /&gt;  return secondary1;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; protected ColorUIResource getSecondary2()&lt;br /&gt; {&lt;br /&gt;  return secondary2;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; protected ColorUIResource getSecondary3()&lt;br /&gt; {&lt;br /&gt;  return secondary3;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5534457551428076844?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5534457551428076844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/change-default-metal-look-and-feel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5534457551428076844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5534457551428076844'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/change-default-metal-look-and-feel.html' title='Change default metal look and feel color'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_f2uGmZtYbGs/SbARpgiCQqI/AAAAAAAABpQ/t4XvLj-V314/s72-c/ChangeMetalLookAndFeelColor.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-1462903340332344473</id><published>2009-03-03T02:03:00.003+08:00</published><updated>2009-03-16T17:52:13.319+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jradiobutton'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Get last selected JRadioButton</title><content type='html'>Complete source code below will show you, how to get last selected JRadioButton when we click on other JRadioButton. I hope you will understand what i want to tell you, or you can try to compile and execute source code below.&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : GetLastSelectedJRadioButton.java&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;&lt;br /&gt;public class GetLastSelectedJRadioButton implements ItemListener&lt;br /&gt;{&lt;br /&gt;JRadioButton jrd1=new JRadioButton("a");&lt;br /&gt;JRadioButton jrd2=new JRadioButton("b");&lt;br /&gt;JRadioButton jrd3=new JRadioButton("c");&lt;br /&gt;JRadioButton jrd4=new JRadioButton("d");&lt;br /&gt;&lt;br /&gt;JRadioButton last=null;&lt;br /&gt;&lt;br /&gt;ButtonGroup bg=new ButtonGroup();&lt;br /&gt;&lt;br /&gt;JFrame myFrame=new JFrame("Get last selected JRadioButton");&lt;br /&gt;&lt;br /&gt;public GetLastSelectedJRadioButton()&lt;br /&gt;{&lt;br /&gt; jrd1.addItemListener(this);&lt;br /&gt; jrd2.addItemListener(this);&lt;br /&gt; jrd3.addItemListener(this);&lt;br /&gt; jrd4.addItemListener(this);&lt;br /&gt;&lt;br /&gt; bg.add(jrd1);&lt;br /&gt; bg.add(jrd2);&lt;br /&gt; bg.add(jrd3);&lt;br /&gt; bg.add(jrd4);&lt;br /&gt;&lt;br /&gt; myFrame.getContentPane().setLayout(new GridLayout(4,1));&lt;br /&gt;&lt;br /&gt; myFrame.getContentPane().add(jrd1);&lt;br /&gt; myFrame.getContentPane().add(jrd2);&lt;br /&gt; myFrame.getContentPane().add(jrd3);&lt;br /&gt; myFrame.getContentPane().add(jrd4);&lt;br /&gt;&lt;br /&gt; myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; myFrame.setSize(400,400);&lt;br /&gt; myFrame.setLocationRelativeTo(null);&lt;br /&gt; myFrame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void itemStateChanged(ItemEvent event)&lt;br /&gt;{&lt;br /&gt; JRadioButton temp=(JRadioButton)event.getItem();&lt;br /&gt;&lt;br /&gt; if(event.getStateChange()==ItemEvent.DESELECTED)&lt;br /&gt; {&lt;br /&gt;  last=temp;&lt;br /&gt; }&lt;br /&gt; else if(event.getStateChange()==ItemEvent.SELECTED)&lt;br /&gt; {&lt;br /&gt;  if(last!=null)&lt;br /&gt;  {&lt;br /&gt;   JOptionPane.showMessageDialog(myFrame,"LAST : "+last.getText(),"Last",JOptionPane.INFORMATION_MESSAGE);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; GetLastSelectedJRadioButton glsjrb=new GetLastSelectedJRadioButton();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-1462903340332344473?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/1462903340332344473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/get-last-selected-jradiobutton.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1462903340332344473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1462903340332344473'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/get-last-selected-jradiobutton.html' title='Get last selected JRadioButton'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6928885245207297113</id><published>2009-03-02T22:57:00.004+08:00</published><updated>2009-03-16T17:52:53.935+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='look and feel'/><category scheme='http://www.blogger.com/atom/ns#' term='metal'/><category scheme='http://www.blogger.com/atom/ns#' term='jframe'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><title type='text'>Set JFrame decoration to MetalLookAndFeel decoration</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_f2uGmZtYbGs/Sav0ulfhU8I/AAAAAAAABoQ/_yUBJWWsvT4/s1600-h/SetJFrameWindowDecoration.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://1.bp.blogspot.com/_f2uGmZtYbGs/Sav0ulfhU8I/AAAAAAAABoQ/_yUBJWWsvT4/s400/SetJFrameWindowDecoration.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5308605666961740738" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJFrameDecorationToMetalLookAndFeel.java&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;import java.awt.FlowLayout;&lt;br /&gt;&lt;br /&gt;public class SetJFrameDecorationToMetalLookAndFeel&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Set JFrame decoration to current look and feel decoration&lt;br /&gt; //You can try to make this line as comment and&lt;br /&gt; //after that try compile and execute it to see it's differential&lt;br /&gt;       JFrame.setDefaultLookAndFeelDecorated(true);&lt;br /&gt;      &lt;br /&gt;       JButton myButton=new JButton("Click On Me");&lt;br /&gt;      &lt;br /&gt; JFrame myFrame=new JFrame("Set JFrame window decoration to current look and feel");&lt;br /&gt; myFrame.setLayout(new FlowLayout());&lt;br /&gt;&lt;br /&gt; myFrame.add(myButton);&lt;br /&gt; myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; myFrame.setSize(400,400);&lt;br /&gt; myFrame.setLocationRelativeTo(null);&lt;br /&gt; myFrame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6928885245207297113?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6928885245207297113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/set-jframe-decoration-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6928885245207297113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6928885245207297113'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/set-jframe-decoration-to.html' title='Set JFrame decoration to MetalLookAndFeel decoration'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_f2uGmZtYbGs/Sav0ulfhU8I/AAAAAAAABoQ/_yUBJWWsvT4/s72-c/SetJFrameWindowDecoration.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6678603061771827610</id><published>2009-03-01T22:26:00.003+08:00</published><updated>2009-03-16T17:53:55.122+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='string'/><title type='text'>Check word in String</title><content type='html'>Complete source code below will show you how to check word if exist or not in a String. It will compare a word that we want to check with all word that separate by white space in targeted String. Comparison will ignore case.&lt;br /&gt;&lt;br /&gt;**************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : CheckWordInString.java&lt;br /&gt;**************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.StringTokenizer;&lt;br /&gt;&lt;br /&gt;public class CheckWordInString&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; String a="Hello World !";&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Word(hello) that we want&lt;br /&gt;  *to check if exist&lt;br /&gt;  *or not in String a&lt;br /&gt;  */&lt;br /&gt; String b="hello";&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Get all word that&lt;br /&gt;  *separate by white space&lt;br /&gt;  *in String a&lt;br /&gt;  */&lt;br /&gt; StringTokenizer st&lt;br /&gt;  =new StringTokenizer(a);&lt;br /&gt;  &lt;br /&gt; while(st.hasMoreTokens())&lt;br /&gt; {&lt;br /&gt;  String temp=st.nextToken();&lt;br /&gt; &lt;br /&gt;  /*&lt;br /&gt;   *Compare with&lt;br /&gt;   *ignore case&lt;br /&gt;   */&lt;br /&gt;  if(temp.equalsIgnoreCase(b))&lt;br /&gt;  {&lt;br /&gt;   System.out.println&lt;br /&gt;    ("b exist in a");&lt;br /&gt;   break;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6678603061771827610?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6678603061771827610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/03/check-word-in-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6678603061771827610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6678603061771827610'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/03/check-word-in-string.html' title='Check word in String'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4521755222703344379</id><published>2009-02-28T01:51:00.004+08:00</published><updated>2009-03-16T18:10:19.169+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='timer'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><title type='text'>Java simple timer</title><content type='html'>Complete source code below will show you, how to create simple timer using java. Actually it has a problem. The problem that i mean is, it seem &lt;b&gt;more slow&lt;/b&gt; than real timer.If you find how to solve it, i hope you can share with me by put a comment.&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaSimpleTimer.java&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class JavaSimpleTimer extends JPanel implements ActionListener&lt;br /&gt;{&lt;br /&gt;int miliseconds=0;&lt;br /&gt;int seconds=0;&lt;br /&gt;int minutes=0;&lt;br /&gt;&lt;br /&gt;Timer myTimer;&lt;br /&gt;&lt;br /&gt;Font timerFont=new Font("Verdana",Font.BOLD,24);&lt;br /&gt;&lt;br /&gt;public JavaSimpleTimer()&lt;br /&gt;{&lt;br /&gt;myTimer=new Timer(10,this);&lt;br /&gt;&lt;br /&gt;JFrame myFrame=new JFrame("Simple Timer");&lt;br /&gt;&lt;br /&gt;myFrame.add(this);&lt;br /&gt;myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;myFrame.setSize(500,500);&lt;br /&gt;myFrame.setVisible(true);&lt;br /&gt;&lt;br /&gt;myTimer.setInitialDelay(0);&lt;br /&gt;myTimer.start();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void paint(Graphics g)&lt;br /&gt;{&lt;br /&gt;super.paint(g);&lt;br /&gt;String mili=Integer.toString(miliseconds);&lt;br /&gt;String sec=Integer.toString(seconds);&lt;br /&gt;String min=Integer.toString(minutes);&lt;br /&gt;&lt;br /&gt;if(mili.length()==1)&lt;br /&gt;{&lt;br /&gt; mili="0"+mili;&lt;br /&gt;}&lt;br /&gt;if(sec.length()==1)&lt;br /&gt;{&lt;br /&gt; sec="0"+sec;&lt;br /&gt;}&lt;br /&gt;if(min.length()==1)&lt;br /&gt;{&lt;br /&gt; min="0"+min;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;g.setFont(timerFont);&lt;br /&gt;&lt;br /&gt;g.drawString(min+" :",20,20);&lt;br /&gt;g.drawString(sec+" :",80,20);&lt;br /&gt;g.drawString(mili,140,20);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void actionPerformed(ActionEvent event)&lt;br /&gt;{&lt;br /&gt;miliseconds=miliseconds+1;&lt;br /&gt;if(miliseconds==100)&lt;br /&gt;{&lt;br /&gt; miliseconds=0;&lt;br /&gt; seconds=seconds+1;&lt;br /&gt;}&lt;br /&gt;if(seconds==60)&lt;br /&gt;{&lt;br /&gt; seconds=0;&lt;br /&gt; minutes=minutes+1;&lt;br /&gt;}&lt;br /&gt;repaint();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;JavaSimpleTimer myTest=new JavaSimpleTimer();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4521755222703344379?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4521755222703344379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/java-simple-timer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4521755222703344379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4521755222703344379'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/java-simple-timer.html' title='Java simple timer'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3056679391917285128</id><published>2009-02-25T16:13:00.003+08:00</published><updated>2009-03-16T17:55:48.270+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='jslider'/><category scheme='http://www.blogger.com/atom/ns#' term='tick'/><title type='text'>Set JSlider tick color</title><content type='html'>Complete source code below will show you, how to set JSlider tick color. I have tried to find method in JSlider class to set JSlider tick color...but, i can't find it. So i tried to create UI Delegate only for SliderUI that change JSlider tick color. You can try to compile both source code below. Make sure both java file below locate at the same location. JSlider's tick color is set in &lt;b&gt;&lt;i&gt;MyNewMetalSliderUI.java&lt;/i&gt;&lt;/b&gt;.You can try to change it's color follow what color that you want base on RGB value. After you compile &lt;b&gt;&lt;i&gt;SetJSliderTickColor.java&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;MyNewMetalSliderUI.java&lt;/i&gt;&lt;/b&gt;, you try execute &lt;b&gt;&lt;i&gt;SetJSliderTickColor.java&lt;/i&gt;&lt;/b&gt;. This is because, main method contain in this file.Oooo...before i forget, it's only handle horizontal slider. If you want to make it can use for vertical slider, you can try overwrite method paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) and paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) in MetalSliderUI class. You can review it in Java SE API for MetalSliderUI class.&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : MyNewMetalSliderUI.java&lt;br /&gt;**********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;import javax.swing.plaf.ColorUIResource;&lt;br /&gt;&lt;br /&gt;import javax.swing.plaf.metal.MetalSliderUI;&lt;br /&gt;&lt;br /&gt;import javax.swing.plaf.ComponentUI;&lt;br /&gt;&lt;br /&gt;public class MyNewMetalSliderUI extends MetalSliderUI&lt;br /&gt;{&lt;br /&gt;// Create our own slider UI&lt;br /&gt;public static ComponentUI createUI(JComponent c )&lt;br /&gt;{&lt;br /&gt; return new MyNewMetalSliderUI();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//*******************HORIZONTAL MAJOR TICK*******************&lt;br /&gt;public void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)&lt;br /&gt;{&lt;br /&gt; int coordinateX=x;&lt;br /&gt;&lt;br /&gt; if(slider.getOrientation()==JSlider.HORIZONTAL)&lt;br /&gt; {&lt;br /&gt;  //Create color using RGB value(RED=255,GREEN=0,BLUE=0)&lt;br /&gt;  //You can use Color picker above to get RGB value for color that you want&lt;br /&gt;  Color majorTickColor=new Color(255,0,0);&lt;br /&gt; &lt;br /&gt;  //Set color that will use to draw MAJOR TICK using created color&lt;br /&gt;  g.setColor(majorTickColor);&lt;br /&gt; &lt;br /&gt;  //Draw MAJOR TICK&lt;br /&gt;  g.drawLine(coordinateX,0,coordinateX,tickBounds.height);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;//*******************HORIZONTAL MAJOR TICK*******************&lt;br /&gt;&lt;br /&gt;//*******************HORIZONTAL MINOR TICK*******************&lt;br /&gt;public void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)&lt;br /&gt;{&lt;br /&gt; int coordinateX=x;&lt;br /&gt;&lt;br /&gt; if(slider.getOrientation()==JSlider.HORIZONTAL)&lt;br /&gt; {&lt;br /&gt;  //Create color using RGB value(RED=12,GREEN=255,BLUE=0)&lt;br /&gt;  //You can use Color picker above to get RGB value for color that you want&lt;br /&gt;  Color majorTickColor=new Color(12,255,0);&lt;br /&gt; &lt;br /&gt;  //Set color that will use to draw MINOR TICK using created color&lt;br /&gt;  g.setColor(majorTickColor);&lt;br /&gt; &lt;br /&gt;  //Draw MINOR TICK&lt;br /&gt;  g.drawLine(coordinateX,0,coordinateX,tickBounds.height/2);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;//*******************HORIZONTAL MINOR TICK*******************&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;JUST COMPILE&lt;br /&gt;**********************************************************************&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJSliderTickColor.java&lt;br /&gt;**********************************************************************&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class SetJSliderTickColor&lt;br /&gt;{&lt;br /&gt;public SetJSliderTickColor()&lt;br /&gt;{&lt;br /&gt; //Create slider using JSlider&lt;br /&gt; JSlider mySlider=new JSlider();&lt;br /&gt;&lt;br /&gt; //Set major tick spacing to 10&lt;br /&gt; mySlider.setMajorTickSpacing(10);&lt;br /&gt;&lt;br /&gt; //Set minor tick spacing to 1&lt;br /&gt; mySlider.setMinorTickSpacing(1);&lt;br /&gt;&lt;br /&gt; //Make slider's numbers visible&lt;br /&gt; mySlider.setPaintLabels(true);&lt;br /&gt;&lt;br /&gt; //Make slider's ticks visible&lt;br /&gt; mySlider.setPaintTicks(true);&lt;br /&gt;&lt;br /&gt; //Create a window using JFrame with title ( Set JSlider tick color )&lt;br /&gt; JFrame frame=new JFrame("Set JSlider tick color");&lt;br /&gt;&lt;br /&gt; //Set JFrame layout to FlowLayout&lt;br /&gt; frame.setLayout(new FlowLayout());&lt;br /&gt;&lt;br /&gt; //Add created JSlider into JFrame&lt;br /&gt; frame.add(mySlider);&lt;br /&gt;&lt;br /&gt; //Set JFrame's default close operation&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;&lt;br /&gt; //Set JFrame size&lt;br /&gt; frame.setSize(500,300);&lt;br /&gt;&lt;br /&gt; //Set JFrame locate at center of screen&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt;&lt;br /&gt; //Make JFrame visible&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; /***********Set our own UI Delegate for Slider*************/&lt;br /&gt; UIManager uim=new UIManager();&lt;br /&gt;&lt;br /&gt; //MyNewMetalSliderUI contain settings that use to change tick color&lt;br /&gt; uim.put("SliderUI","MyNewMetalSliderUI");&lt;br /&gt; /***********Set our own UI Delegate for Slider*************/&lt;br /&gt;&lt;br /&gt; SetJSliderTickColor sjstc=new SetJSliderTickColor();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE&lt;br /&gt;**********************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3056679391917285128?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3056679391917285128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-jslider-tick-color.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3056679391917285128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3056679391917285128'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-jslider-tick-color.html' title='Set JSlider tick color'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8268087483556714830</id><published>2009-02-20T07:53:00.002+08:00</published><updated>2009-03-16T17:56:50.144+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='icon'/><category scheme='http://www.blogger.com/atom/ns#' term='joptionpane'/><title type='text'>Set JOptionPane warning icon</title><content type='html'>Complete source code below will show you, how to set warning icon in JOptionPane.&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJOptionPaneWarningIcon.java&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;public class SetJOptionPaneWarningIcon&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //null-Message Box appear in no parent component&lt;br /&gt; //Warning Icon-text in message box&lt;br /&gt; //WARNING-JOptionPane title&lt;br /&gt; //JOptionPane.WARNING_MESSAGE-Set warning icon that will be show in message box&lt;br /&gt; JOptionPane.showMessageDialog(null,"Warning Icon","WARNING",JOptionPane.WARNING_MESSAGE);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8268087483556714830?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8268087483556714830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-warning-icon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8268087483556714830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8268087483556714830'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-warning-icon.html' title='Set JOptionPane warning icon'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-703929189677698494</id><published>2009-02-20T07:47:00.002+08:00</published><updated>2009-03-16T17:57:06.867+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='icon'/><category scheme='http://www.blogger.com/atom/ns#' term='joptionpane'/><title type='text'>Set JOptionPane error icon</title><content type='html'>Complete source code below will show you, how to set error icon in JOptionPane.&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJOptionPaneErrorIcon.java&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;public class SetJOptionPaneErrorIcon&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //null-Message Box appear in no parent component&lt;br /&gt; //Error Icon-text in message box&lt;br /&gt; //ERROR-JOptionPane title&lt;br /&gt; //JOptionPane.ERROR_MESSAGE-Set error icon that will be show in message box&lt;br /&gt; JOptionPane.showMessageDialog(null,"Error Icon","ERROR",JOptionPane.ERROR_MESSAGE);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-703929189677698494?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/703929189677698494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-error-icon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/703929189677698494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/703929189677698494'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-error-icon.html' title='Set JOptionPane error icon'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-7318860753388607865</id><published>2009-02-20T07:36:00.003+08:00</published><updated>2009-03-16T17:57:23.646+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='icon'/><category scheme='http://www.blogger.com/atom/ns#' term='joptionpane'/><title type='text'>Set JOptionPane information icon</title><content type='html'>Complete source code below will show you, how to set information icon in JOptionPane.&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJOptionPaneInformationIcon.java&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;public class SetJOptionPaneInformationIcon&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //null-Message Box appear in no parent component&lt;br /&gt; //Information Icon-text in message box&lt;br /&gt; //INFORMATION-JOptionPane title&lt;br /&gt; //JOptionPane.INFORMATION_MESSAGE-Set information icon that will be show in message box&lt;br /&gt; JOptionPane.showMessageDialog(null,"Information Icon","INFORMATION",JOptionPane.INFORMATION_MESSAGE);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-7318860753388607865?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/7318860753388607865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-information-icon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7318860753388607865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7318860753388607865'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-information-icon.html' title='Set JOptionPane information icon'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8132260141408224733</id><published>2009-02-20T07:31:00.003+08:00</published><updated>2009-03-16T17:57:41.370+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='icon'/><category scheme='http://www.blogger.com/atom/ns#' term='joptionpane'/><title type='text'>Set JOptionPane question icon</title><content type='html'>Complete source code below will show you, how to set question icon in JOptionPane.&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJOptionPaneQuestionIcon.java&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;public class SetJOptionPaneQuestionIcon&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //null-Message Box appear in no parent component&lt;br /&gt; //Question Icon-text in message box&lt;br /&gt; //QUESTION-JOptionPane title&lt;br /&gt; //JOptionPane.QUESTION_MESSAGE-Set question icon that will be show in message box&lt;br /&gt; JOptionPane.showMessageDialog(null,"Question Icon","QUESTION",JOptionPane.QUESTION_MESSAGE);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8132260141408224733?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8132260141408224733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-question-icon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8132260141408224733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8132260141408224733'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-question-icon.html' title='Set JOptionPane question icon'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8781177378215133791</id><published>2009-02-20T02:17:00.004+08:00</published><updated>2009-03-16T18:11:06.978+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='clock'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><category scheme='http://www.blogger.com/atom/ns#' term='digital'/><title type='text'>Create simple digital clock in java</title><content type='html'>Complete source code below, will show you, how to &lt;b&gt;create simple digital clock&lt;/b&gt; in java.&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SimpleDigitalClock.java&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;public class SimpleDigitalClock extends JPanel&lt;br /&gt;{&lt;br /&gt;JFrame frame;&lt;br /&gt;&lt;br /&gt;int currentHour;&lt;br /&gt;int currentMinute;&lt;br /&gt;int currentSecond;&lt;br /&gt;&lt;br /&gt;//Font that will be use to show digital clock&lt;br /&gt;Font myFont=new Font("Tahoma",Font.BOLD+Font.ITALIC,20);&lt;br /&gt;&lt;br /&gt;//Color that will be use to show digital clock&lt;br /&gt;Color myColor=new Color(255,0,0);&lt;br /&gt;&lt;br /&gt;//Font metrics that will use to store font informations&lt;br /&gt;//For example, width of a character&lt;br /&gt;FontMetrics fm;&lt;br /&gt;&lt;br /&gt;public SimpleDigitalClock()&lt;br /&gt;{&lt;br /&gt;//Create a window using JFrame with title ( Simple Digital Clock )&lt;br /&gt;frame=new JFrame("Simple Digital Clock");&lt;br /&gt;&lt;br /&gt;//add(this) mean add created panel into JFrame&lt;br /&gt;//Which panel ?&lt;br /&gt;//See line 81 and 7 (I hope you understand it)&lt;br /&gt;frame.add(this);&lt;br /&gt;&lt;br /&gt;//Set default close operation for JFrame&lt;br /&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;&lt;br /&gt;//Set JFrame size&lt;br /&gt;frame.setSize(300,300);&lt;br /&gt;&lt;br /&gt;//Make JFrame locate at center&lt;br /&gt;frame.setLocationRelativeTo(null);&lt;br /&gt;&lt;br /&gt;//Make JFrame visible&lt;br /&gt;frame.setVisible(true);&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt; *Loop that will make sure panel show current time&lt;br /&gt; *like current second, current minute and current hour.&lt;br /&gt; */&lt;br /&gt;while(true)&lt;br /&gt;{&lt;br /&gt; //It will do all code in method paint(See line 67)&lt;br /&gt; repaint();&lt;br /&gt;&lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt;  Thread.sleep(900);&lt;br /&gt; }&lt;br /&gt; catch(Exception exception)&lt;br /&gt; {&lt;br /&gt;  exception.printStackTrace();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void paint(Graphics g)&lt;br /&gt;{&lt;br /&gt;super.paint(g);&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt; *Create  current Date object. It means it store information&lt;br /&gt; *about current hour, minute and second.&lt;br /&gt; */&lt;br /&gt;Date myDate=new Date();&lt;br /&gt;&lt;br /&gt;currentHour=myDate.getHours();&lt;br /&gt;currentMinute=myDate.getMinutes();&lt;br /&gt;currentSecond=myDate.getSeconds();&lt;br /&gt;&lt;br /&gt;//Set font that will use to draw digital number&lt;br /&gt;g.setFont(myFont);&lt;br /&gt;&lt;br /&gt;//Information about distance between number in digital clock&lt;br /&gt;fm=g.getFontMetrics();&lt;br /&gt;int hourXCoordinate=20;&lt;br /&gt;int minuteXCoordinate=hourXCoordinate+(fm.getMaxAdvance()*2);&lt;br /&gt;int secondXCoordinate=hourXCoordinate+(fm.getMaxAdvance()*4);&lt;br /&gt;&lt;br /&gt;//Set color that will use to draw digital number&lt;br /&gt;g.setColor(myColor);&lt;br /&gt;&lt;br /&gt;//Draw hour, draw (:) between number, draw minute and draw second.&lt;br /&gt;g.drawString(Integer.toString(currentHour),hourXCoordinate,20);&lt;br /&gt;g.drawString(":",(hourXCoordinate+minuteXCoordinate)/2,20);&lt;br /&gt;g.drawString(Integer.toString(currentMinute),minuteXCoordinate,20);&lt;br /&gt;g.drawString(":",(secondXCoordinate+minuteXCoordinate)/2,20);&lt;br /&gt;g.drawString(Integer.toString(currentSecond),secondXCoordinate,20);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;SimpleDigitalClock sdc=new SimpleDigitalClock();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8781177378215133791?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8781177378215133791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/create-simple-digital-clock-in-java.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8781177378215133791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8781177378215133791'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/create-simple-digital-clock-in-java.html' title='Create simple digital clock in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8907561386236244050</id><published>2009-02-19T22:25:00.004+08:00</published><updated>2009-03-16T17:58:38.590+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='second'/><category scheme='http://www.blogger.com/atom/ns#' term='current'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Get current second</title><content type='html'>Complete source code below, will show you how to get current computer second and print the value. The second value that it get is &lt;b&gt;second value at program executing time&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&gt;&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/get-current-minute.html"&gt;&lt;b&gt;Get current minute&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&gt;&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/get-current-hour.html"&gt;&lt;b&gt;Get current hour&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&gt;&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/get-current-computer-time-in-java.html"&gt;&lt;b&gt;Get current computer time in java&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : GetCurrentSecond.java&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;public class GetCurrentSecond&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;Date myDate=new Date();&lt;br /&gt;&lt;br /&gt;//Get current second&lt;br /&gt;int currentSecond=myDate.getSeconds();&lt;br /&gt;&lt;br /&gt;//Print current second that we get&lt;br /&gt;System.out.println("Current second is : "+currentSecond);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8907561386236244050?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8907561386236244050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-current-second.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8907561386236244050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8907561386236244050'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-current-second.html' title='Get current second'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-1258486818843215757</id><published>2009-02-19T21:50:00.004+08:00</published><updated>2009-03-16T17:59:01.578+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='minute'/><category scheme='http://www.blogger.com/atom/ns#' term='current'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Get current minute</title><content type='html'>Complete source code below will print current computer minute.&lt;br /&gt;&lt;br /&gt;&gt;&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/get-current-second.html"&gt;&lt;b&gt;Get current second&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&gt;&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/get-current-hour.html"&gt;&lt;b&gt;Get current hour&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&gt;&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/get-current-computer-time-in-java.html"&gt;&lt;b&gt;Get current computer time in java&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : GetCurrentMinute.java&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;public class GetCurrentMinute&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; Date myDate=new Date();&lt;br /&gt;&lt;br /&gt; //Get current minute&lt;br /&gt; int currentMinute=myDate.getMinutes();&lt;br /&gt;&lt;br /&gt; //Print current minute that we get&lt;br /&gt; System.out.println("Current minute is : "+currentMinute);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-1258486818843215757?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/1258486818843215757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-current-minute.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1258486818843215757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1258486818843215757'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-current-minute.html' title='Get current minute'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6457290678632074660</id><published>2009-02-19T21:25:00.004+08:00</published><updated>2009-03-16T17:59:22.125+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='current'/><category scheme='http://www.blogger.com/atom/ns#' term='hour'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Get current hour</title><content type='html'>Complete source code below will print current computer hour in soldier time format.Soldier time format is 24 hour format.&lt;br /&gt;&lt;br /&gt;&gt;&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/get-current-minute.html"&gt;&lt;b&gt;Get current minute&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&gt;&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/get-current-second.html"&gt;&lt;b&gt;Get current second&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&gt;&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/get-current-computer-time-in-java.html"&gt;&lt;b&gt;Get current computer time in java&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;**************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : GetCurrentHour.java&lt;br /&gt;**************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;public class GetCurrentHour&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; Date myDate=new Date();&lt;br /&gt;&lt;br /&gt; //Get current hour in soldier time format&lt;br /&gt; int currentHour=myDate.getHours();&lt;br /&gt;&lt;br /&gt; //Print current hour that we get&lt;br /&gt; System.out.println("Current hour is : "+currentHour);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6457290678632074660?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6457290678632074660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-current-hour.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6457290678632074660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6457290678632074660'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-current-hour.html' title='Get current hour'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8843932191146525934</id><published>2009-02-19T21:15:00.004+08:00</published><updated>2009-03-16T18:11:36.947+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='time'/><category scheme='http://www.blogger.com/atom/ns#' term='current'/><category scheme='http://www.blogger.com/atom/ns#' term='computer'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Get current computer time in java</title><content type='html'>Complete source code below will show you, how to get current computer time in java.&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : GetCurrentTime.java&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;public class GetCurrentTime&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;Date myDate=new Date();&lt;br /&gt;&lt;br /&gt;System.out.println(myDate.getHours()+":"+myDate.getMinutes()+":"+myDate.getSeconds());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8843932191146525934?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8843932191146525934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-current-computer-time-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8843932191146525934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8843932191146525934'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-current-computer-time-in-java.html' title='Get current computer time in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6185933561886347532</id><published>2009-02-17T17:25:00.003+08:00</published><updated>2009-03-16T18:00:43.009+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='tooltiptext'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><title type='text'>Set ToolTipText background color</title><content type='html'>Complete source code below, will show you how to set ToolTipText background color.&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetToolTipTextBackgroundColor.java&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.UIManager;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;import javax.swing.JButton;&lt;br /&gt;&lt;br /&gt;import java.awt.FlowLayout;&lt;br /&gt;import java.awt.Color;&lt;br /&gt;&lt;br /&gt;public class SetToolTipTextBackgroundColor&lt;br /&gt;{&lt;br /&gt;/**&lt;br /&gt; *Create a button with text ( Put your cursor on me )&lt;br /&gt; */&lt;br /&gt;JButton button=new JButton("Put your cursor on me");&lt;br /&gt;&lt;br /&gt;//Create a window using JFrame with text ( Set ToolTipText background color )&lt;br /&gt;JFrame frame=new JFrame("Set ToolTipText background color");&lt;br /&gt;&lt;br /&gt;public SetToolTipTextBackgroundColor()&lt;br /&gt;{&lt;br /&gt; //Create a color base on RGB value&lt;br /&gt; //You can get your color value base on RGB using Color picker at above&lt;br /&gt; //R=204 G=0 B=153&lt;br /&gt; Color backgroundColor=new Color(204,0,153);&lt;br /&gt;&lt;br /&gt; //Create UIManager&lt;br /&gt; UIManager uim=new UIManager();&lt;br /&gt;&lt;br /&gt; //Set tooltiptext background color using created Color&lt;br /&gt; uim.put("ToolTip.background",backgroundColor);&lt;br /&gt;&lt;br /&gt; //Set tooltiptext for created button&lt;br /&gt; button.setToolTipText("I am a button");&lt;br /&gt;&lt;br /&gt; frame.setLayout(new FlowLayout());&lt;br /&gt; frame.add(button);&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; frame.setSize(400,400);&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; SetToolTipTextBackgroundColor stttbc=new SetToolTipTextBackgroundColor();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6185933561886347532?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6185933561886347532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-tooltiptext-background-color.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6185933561886347532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6185933561886347532'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-tooltiptext-background-color.html' title='Set ToolTipText background color'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8917511382476791296</id><published>2009-02-17T17:13:00.002+08:00</published><updated>2009-03-16T18:01:10.986+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='font'/><category scheme='http://www.blogger.com/atom/ns#' term='tooltiptext'/><title type='text'>Set ToolTipText text font</title><content type='html'>Complete source code below, will show you how to set ToolTipText text font.&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetToolTipTextFont.java&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.UIManager;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;import javax.swing.JButton;&lt;br /&gt;&lt;br /&gt;import java.awt.FlowLayout;&lt;br /&gt;import java.awt.Font;&lt;br /&gt;&lt;br /&gt;public class SetToolTipTextFont&lt;br /&gt;{&lt;br /&gt;/**&lt;br /&gt; *Create a button with text ( Put your cursor on me )&lt;br /&gt; */&lt;br /&gt;JButton button=new JButton("Put your cursor on me");&lt;br /&gt;&lt;br /&gt;//Create a window using JFrame with text ( Set ToolTipText text font )&lt;br /&gt;JFrame frame=new JFrame("Set ToolTipText text font");&lt;br /&gt;&lt;br /&gt;public SetToolTipTextFont()&lt;br /&gt;{&lt;br /&gt; //Create a font :&lt;br /&gt; //Name : Verdana&lt;br /&gt; //Style : Bold&lt;br /&gt; //Size : 20&lt;br /&gt; Font textFont=new Font("Verdana",Font.BOLD,20);&lt;br /&gt;&lt;br /&gt; //Create UIManager&lt;br /&gt; UIManager uim=new UIManager();&lt;br /&gt;&lt;br /&gt; //Set tooltiptext text font using created Font&lt;br /&gt; uim.put("ToolTip.font",textFont);&lt;br /&gt;&lt;br /&gt; //Set tooltiptext for created button&lt;br /&gt; button.setToolTipText("I am a button");&lt;br /&gt;&lt;br /&gt; frame.setLayout(new FlowLayout());&lt;br /&gt; frame.add(button);&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; frame.setSize(400,400);&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; SetToolTipTextFont stttf=new SetToolTipTextFont();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8917511382476791296?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8917511382476791296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-tooltiptext-text-font.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8917511382476791296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8917511382476791296'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-tooltiptext-text-font.html' title='Set ToolTipText text font'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-7936523463973430716</id><published>2009-02-17T15:43:00.004+08:00</published><updated>2009-03-16T18:02:29.509+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='tooltiptext'/><title type='text'>Set ToolTipText text color</title><content type='html'>Complete source code below, will show you how to set ToolTipText text color.&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetToolTipTextColor.java&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.UIManager;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;import javax.swing.JButton;&lt;br /&gt;&lt;br /&gt;import java.awt.FlowLayout;&lt;br /&gt;import java.awt.Color;&lt;br /&gt;&lt;br /&gt;public class SetToolTipTextColor&lt;br /&gt;{&lt;br /&gt;/**&lt;br /&gt; *Create a button with text ( Put your cursor on me )&lt;br /&gt; */&lt;br /&gt;JButton button=new JButton("Put your cursor on me");&lt;br /&gt;&lt;br /&gt;//Create a window using JFrame with title ( Set ToolTipText text color )&lt;br /&gt;JFrame frame=new JFrame("Set ToolTipText text color");&lt;br /&gt;&lt;br /&gt;public SetToolTipTextColor()&lt;br /&gt;{&lt;br /&gt; //Create a color base on RGB value&lt;br /&gt; //You can get your color value base on RGB using Color picker at above&lt;br /&gt; //R=255 G=255 B=255 is RGB value for white&lt;br /&gt; Color textColor=new Color(255,255,255);&lt;br /&gt;&lt;br /&gt; //Create UIManager&lt;br /&gt; UIManager uim=new UIManager();&lt;br /&gt;&lt;br /&gt; //Set tooltiptext text color using created Color&lt;br /&gt; uim.put("ToolTip.foreground",textColor);&lt;br /&gt;&lt;br /&gt; //Set tooltiptext for created button&lt;br /&gt; //So, it's tooltiptext text color will be WHITE&lt;br /&gt; button.setToolTipText("I am a button");&lt;br /&gt;&lt;br /&gt; frame.setLayout(new FlowLayout());&lt;br /&gt; frame.add(button);&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; frame.setSize(400,400);&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; SetToolTipTextColor stttc=new SetToolTipTextColor();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-7936523463973430716?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/7936523463973430716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-tooltiptext-text-color.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7936523463973430716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7936523463973430716'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-tooltiptext-text-color.html' title='Set ToolTipText text color'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3509879480902465117</id><published>2009-02-16T08:52:00.006+08:00</published><updated>2009-03-16T18:02:55.241+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='icon'/><category scheme='http://www.blogger.com/atom/ns#' term='joptionpane'/><title type='text'>Set JOptionPane icons</title><content type='html'>&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/gMGEWK54CFk&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/gMGEWK54CFk&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Complete source code below will show you, how to set JOptionPane icons using any GIF image. Before you compile and execute complete source code below, you need to download all images below and place them with your java file that contain source code below.You also can use any GIF image that you want, but make sure it's location is right. This is because i suggest you place all GIF image at same location with source code file. So you don't need to put any file path in your source code. If you still want to use GIF image at other location, you can try step by step below.&lt;br /&gt;&lt;br /&gt;For example, your GIF image with name MyImage.gif locate at C:\Documents and Settings...like below :&lt;br /&gt;&lt;br\&gt;&lt;br /&gt;&lt;b&gt;C:\Documents and Settings\MyImage.gif&lt;/b&gt;&lt;br /&gt;&lt;br\&gt;&lt;br /&gt;So, you must put in your source code like this :&lt;br /&gt;&lt;b&gt;"C:\\Documents and Settings\\MyImage.gif"&lt;/b&gt;&lt;br /&gt;&lt;br\&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_f2uGmZtYbGs/SZi90K7vUGI/AAAAAAAABjM/JY9CdLcevo8/s1600-h/WARNING.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 40px; height: 40px;" src="http://2.bp.blogspot.com/_f2uGmZtYbGs/SZi90K7vUGI/AAAAAAAABjM/JY9CdLcevo8/s400/WARNING.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5303197265214525538" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;WARNING.gif&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_f2uGmZtYbGs/SZi9z8ZTmyI/AAAAAAAABjE/LUvR005BTJk/s1600-h/QUESTION.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 40px; height: 40px;" src="http://1.bp.blogspot.com/_f2uGmZtYbGs/SZi9z8ZTmyI/AAAAAAAABjE/LUvR005BTJk/s400/QUESTION.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5303197261312006946" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;QUESTION.gif&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_f2uGmZtYbGs/SZi9z3PK9II/AAAAAAAABi8/MokEfRqJwYY/s1600-h/INFORMATION.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 40px; height: 40px;" src="http://4.bp.blogspot.com/_f2uGmZtYbGs/SZi9z3PK9II/AAAAAAAABi8/MokEfRqJwYY/s400/INFORMATION.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5303197259927319682" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;INFORMATION.gif&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_f2uGmZtYbGs/SZi9zk3vkXI/AAAAAAAABi0/a5lkalLFUbs/s1600-h/ERROR.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 40px; height: 40px;" src="http://4.bp.blogspot.com/_f2uGmZtYbGs/SZi9zk3vkXI/AAAAAAAABi0/a5lkalLFUbs/s400/ERROR.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5303197254997217650" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;ERROR.gif&lt;/div&gt;&lt;br /&gt;&lt;br\&gt;&lt;br /&gt;&lt;a href="http://java2everyone.blogspot.com/2009/02/create-transparent-image-using-adobe.html"&gt;&lt;b&gt;Click here for how to create all icons above&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br\&gt;&lt;br /&gt;****************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ChangeJOptionPaneIcons.java&lt;br /&gt;****************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;import javax.swing.JButton;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;import javax.swing.UIManager;&lt;br /&gt;import javax.swing.LookAndFeel;&lt;br /&gt;&lt;br /&gt;import java.awt.GridLayout;&lt;br /&gt;&lt;br /&gt;import java.awt.event.ActionListener;&lt;br /&gt;import java.awt.event.ActionEvent;&lt;br /&gt;&lt;br /&gt;public class ChangeJOptionPaneIcons implements ActionListener&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;JButton button=new JButton("JOptionPane with Error Icon");&lt;br /&gt;JButton button2=new JButton("JOptionPane with Information Icon");&lt;br /&gt;JButton button3=new JButton("JOptionPane with Question Icon");&lt;br /&gt;JButton button4=new JButton("JOptionPane with Warning Icon");&lt;br /&gt;&lt;br /&gt;JFrame frame=new JFrame("Change JOptionPane icons");&lt;br /&gt;&lt;br /&gt;public ChangeJOptionPaneIcons()&lt;br /&gt;{&lt;br /&gt; //---START SETTING NEW ICON---&lt;br /&gt; UIManager uim=new UIManager();&lt;br /&gt;&lt;br /&gt; Object error=LookAndFeel.makeIcon(getClass(),"ERROR.gif");&lt;br /&gt; Object information=LookAndFeel.makeIcon(getClass(),"INFORMATION.gif");&lt;br /&gt; Object question=LookAndFeel.makeIcon(getClass(),"QUESTION.gif");&lt;br /&gt; Object warning=LookAndFeel.makeIcon(getClass(),"WARNING.gif");&lt;br /&gt;&lt;br /&gt; //Set new icon for Error message&lt;br /&gt; uim.put("OptionPane.errorIcon",error);&lt;br /&gt;&lt;br /&gt; //Set new icon for Information message&lt;br /&gt; uim.put("OptionPane.informationIcon",information);&lt;br /&gt;&lt;br /&gt; //Set new icon for Question message&lt;br /&gt; uim.put("OptionPane.questionIcon",question);&lt;br /&gt;&lt;br /&gt; //Set new icon for Warning message&lt;br /&gt; uim.put("OptionPane.warningIcon",warning);&lt;br /&gt; //---END SETTING NEW ICON---&lt;br /&gt;&lt;br /&gt; button.addActionListener(this);&lt;br /&gt; button2.addActionListener(this);&lt;br /&gt; button3.addActionListener(this);&lt;br /&gt; button4.addActionListener(this);&lt;br /&gt;&lt;br /&gt; frame.setLayout(new GridLayout(4,1));&lt;br /&gt; frame.add(button);&lt;br /&gt; frame.add(button2);&lt;br /&gt; frame.add(button3);&lt;br /&gt; frame.add(button4);&lt;br /&gt;&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; frame.setSize(400,200);&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void actionPerformed(ActionEvent event)&lt;br /&gt;{&lt;br /&gt; if(event.getSource()==button)&lt;br /&gt; {&lt;br /&gt;  JOptionPane.showMessageDialog(frame,"Error Icon","ERROR",JOptionPane.ERROR_MESSAGE);&lt;br /&gt; }&lt;br /&gt; else if(event.getSource()==button2)&lt;br /&gt; {&lt;br /&gt;  JOptionPane.showMessageDialog(frame,"Information Icon","INFORMATION",JOptionPane.INFORMATION_MESSAGE);&lt;br /&gt; }&lt;br /&gt; else if(event.getSource()==button3)&lt;br /&gt; {&lt;br /&gt;  JOptionPane.showMessageDialog(frame,"Question Icon","QUESTION",JOptionPane.QUESTION_MESSAGE);&lt;br /&gt; }&lt;br /&gt; else if(event.getSource()==button4)&lt;br /&gt; {&lt;br /&gt;  JOptionPane.showMessageDialog(frame,"Warning Icon","WARNING",JOptionPane.WARNING_MESSAGE);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; ChangeJOptionPaneIcons cjopi=new ChangeJOptionPaneIcons();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;//END&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;****************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;****************************************************************&lt;br /&gt;&lt;/br\&gt;&lt;/br\&gt;&lt;/br\&gt;&lt;/br\&gt;&lt;/br\&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3509879480902465117?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3509879480902465117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-icons.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3509879480902465117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3509879480902465117'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-joptionpane-icons.html' title='Set JOptionPane icons'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_f2uGmZtYbGs/SZi90K7vUGI/AAAAAAAABjM/JY9CdLcevo8/s72-c/WARNING.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-376131149379887090</id><published>2009-02-13T00:22:00.007+08:00</published><updated>2009-03-16T18:03:25.910+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='class'/><category scheme='http://www.blogger.com/atom/ns#' term='date'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Get date using Calendar class</title><content type='html'>Complete source code below will show you, how to get date on local computer in java using Calendar class.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;&lt;br /&gt;import java.util.Calendar;&lt;br /&gt;import java.util.Locale;&lt;br /&gt;&lt;br /&gt;public class GetDate&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Get a calendar using the default time zone and locale.&lt;br /&gt; Calendar currentComputerDate=Calendar.getInstance();&lt;br /&gt;&lt;br /&gt; //Print date&lt;br /&gt; System.out.print(currentComputerDate.get(Calendar.DATE));&lt;br /&gt; System.out.print(".");&lt;br /&gt;&lt;br /&gt; /*Print month in text representation. For example January is first month.&lt;br /&gt;  *Month that will print is in long representation.&lt;br /&gt;  *Short representation for January is Jan&lt;br /&gt;  *You can try to change Calendar.LONG to Calendar.SHORT&lt;br /&gt;  *Local.ROOT is useful constant for the root locale.&lt;br /&gt;  */&lt;br /&gt;    System.out.print(currentComputerDate.getDisplayName(Calendar.MONTH,Calendar.LONG,Locale.ROOT));&lt;br /&gt; System.out.print(".");&lt;br /&gt;&lt;br /&gt; //Print year&lt;br /&gt; System.out.print(currentComputerDate.get(Calendar.YEAR));&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-376131149379887090?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/376131149379887090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-date-using-calendar-class.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/376131149379887090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/376131149379887090'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-date-using-calendar-class.html' title='Get date using Calendar class'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-9214745777854327404</id><published>2009-02-08T02:26:00.005+08:00</published><updated>2009-03-16T18:23:25.795+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jradiobutton'/><category scheme='http://www.blogger.com/atom/ns#' term='buttongroup'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Get selected JRadioButton from ButtonGroup</title><content type='html'>Complete source code below will show you, how to get selected JRadioButton from ButtonGroup.&lt;br /&gt;&lt;br /&gt;*************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : GetSelectedJRadioButtonFromButtonGroup.java&lt;br /&gt;*************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JRadioButton;&lt;br /&gt;import javax.swing.ButtonGroup;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;import javax.swing.JButton;&lt;br /&gt;import javax.swing.JPanel;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;import javax.swing.AbstractButton;&lt;br /&gt;&lt;br /&gt;import java.awt.BorderLayout;&lt;br /&gt;&lt;br /&gt;import java.awt.event.ActionListener;&lt;br /&gt;import java.awt.event.ActionEvent;&lt;br /&gt;&lt;br /&gt;import java.util.Enumeration;&lt;br /&gt;&lt;br /&gt;public class GetSelectedJRadioButtonFromButtonGroup implements ActionListener&lt;br /&gt;{&lt;br /&gt;//Create two radio button that will be put into a group&lt;br /&gt;//Set start radio button selection to female&lt;br /&gt;JRadioButton firstRadioButton=new JRadioButton("Female",true);&lt;br /&gt;JRadioButton secondRadioButton=new JRadioButton("Male");&lt;br /&gt;&lt;br /&gt;//Create a button with text ( What i select )&lt;br /&gt;JButton button=new JButton("What i select");&lt;br /&gt;&lt;br /&gt;//Create a window using JFrame with title ( Get selected JRadioButton from ButtonGroup)&lt;br /&gt;JFrame frame=new JFrame("Get selected JRadioButton from ButtonGroup");&lt;br /&gt;&lt;br /&gt;//Create a radio button group using ButtonGroup&lt;br /&gt;ButtonGroup bg=new ButtonGroup();&lt;br /&gt;&lt;br /&gt;public GetSelectedJRadioButtonFromButtonGroup()&lt;br /&gt;{&lt;br /&gt; //Add all radio button into created group&lt;br /&gt; bg.add(firstRadioButton);&lt;br /&gt; bg.add(secondRadioButton);&lt;br /&gt;&lt;br /&gt; //Set JFrame layout to border layout&lt;br /&gt; frame.setLayout(new BorderLayout());&lt;br /&gt;&lt;br /&gt; //Create a panel that will be put radio button into it&lt;br /&gt; JPanel panel=new JPanel();&lt;br /&gt;&lt;br /&gt; //Add all created radio button into panel&lt;br /&gt; panel.add(firstRadioButton);&lt;br /&gt; panel.add(secondRadioButton);&lt;br /&gt;&lt;br /&gt; //Add action listener to created button&lt;br /&gt; button.addActionListener(this);&lt;br /&gt;&lt;br /&gt; //Add panel and button into JFrame&lt;br /&gt; frame.add(panel,BorderLayout.CENTER);&lt;br /&gt; frame.add(button,BorderLayout.SOUTH);&lt;br /&gt;&lt;br /&gt; //Set default close operation for JFrame&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;&lt;br /&gt; //Set JFrame size&lt;br /&gt; frame.setSize(600,150);&lt;br /&gt;&lt;br /&gt; //Make JFrame visible&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;   //Action for button&lt;br /&gt;   //Get selected JRadioButton from ButtonGroup&lt;br /&gt;public void actionPerformed(ActionEvent event)&lt;br /&gt;{&lt;br /&gt; if(event.getSource()==button)&lt;br /&gt; {&lt;br /&gt;  Enumeration&amp;lt;AbstractButton&amp;gt; allRadioButton=bg.getElements();&lt;br /&gt; &lt;br /&gt;  while(allRadioButton.hasMoreElements())&lt;br /&gt;  {&lt;br /&gt;   JRadioButton temp=(JRadioButton)allRadioButton.nextElement();&lt;br /&gt;   if(temp.isSelected())&lt;br /&gt;   {&lt;br /&gt;    JOptionPane.showMessageDialog(frame,"You select : "+temp.getText());&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; GetSelectedJRadioButtonFromButtonGroup gsjrbfbg=new  GetSelectedJRadioButtonFromButtonGroup();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*************************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-9214745777854327404?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/9214745777854327404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-selected-jradiobutton-from.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/9214745777854327404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/9214745777854327404'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/get-selected-jradiobutton-from.html' title='Get selected JRadioButton from ButtonGroup'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8075730861788216149</id><published>2009-02-07T16:39:00.005+08:00</published><updated>2009-03-16T18:23:41.008+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='joptionpane'/><title type='text'>Two text field in JOptionPane</title><content type='html'>Complete source code below will show you, how to put two text field into JOptionPane. First text field is to receive username from user and second is to receive password from user. This gui is suitable when you want to receive username and password from user using JOptionPane.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;username : jamesBond&lt;br /&gt;password : 007&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;***********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : TwoTextFieldInJOptionPane.java&lt;br /&gt;***********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class TwoTextFieldInJOptionPane&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a panel that will be use to put&lt;br /&gt; //one JTextField, one JPasswordField and two JLabel&lt;br /&gt; JPanel panel=new JPanel();&lt;br /&gt;&lt;br /&gt; //Set JPanel layout using GridLayout&lt;br /&gt; panel.setLayout(new GridLayout(4,1));&lt;br /&gt;&lt;br /&gt; //Create a label with text (Username)&lt;br /&gt; JLabel username=new JLabel("Username");&lt;br /&gt;&lt;br /&gt; //Create a label with text (Password)&lt;br /&gt; JLabel password=new JLabel("Password");&lt;br /&gt;&lt;br /&gt; //Create text field that will use to enter username&lt;br /&gt; JTextField textField=new JTextField(12);&lt;br /&gt;&lt;br /&gt; //Create password field that will be use to enter password&lt;br /&gt; JPasswordField passwordField=new JPasswordField(12);&lt;br /&gt;&lt;br /&gt; //Add label with text (username) into created panel&lt;br /&gt; panel.add(username);&lt;br /&gt;&lt;br /&gt; //Add text field into created panel&lt;br /&gt; panel.add(textField);&lt;br /&gt;&lt;br /&gt; //Add label with text (password) into created panel&lt;br /&gt; panel.add(password);&lt;br /&gt;&lt;br /&gt; //Add password field into created panel&lt;br /&gt; panel.add(passwordField);&lt;br /&gt;&lt;br /&gt; //Create a window using JFrame with title ( Two text component in JOptionPane )&lt;br /&gt; JFrame frame=new JFrame("Two text component in JOptionPane");&lt;br /&gt;&lt;br /&gt; //Set default close operation for JFrame&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;&lt;br /&gt; //Set JFrame size&lt;br /&gt; frame.setSize(300,300);&lt;br /&gt;&lt;br /&gt; //Set JFrame locate at center&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt;&lt;br /&gt; //Make JFrame visible&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;&lt;br /&gt; //Show JOptionPane that will ask user for username and password&lt;br /&gt; int a=JOptionPane.showConfirmDialog(frame,panel,"Put username and password",JOptionPane.OK_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE);&lt;br /&gt;&lt;br /&gt; //Operation that will do when user click 'OK'&lt;br /&gt; if(a==JOptionPane.OK_OPTION)&lt;br /&gt; {&lt;br /&gt;  if(textField.getText().equals("jamesBond")&amp;amp;&amp;amp;new String(passwordField.getPassword()).equals("007"))&lt;br /&gt;  {&lt;br /&gt;   JOptionPane.showMessageDialog(frame,"You are James Bond","Correct",JOptionPane.INFORMATION_MESSAGE);&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   JOptionPane.showMessageDialog(frame,"You are not James Bond","False",JOptionPane.ERROR_MESSAGE);&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; //Operation that will do when user click 'Cancel'&lt;br /&gt; else if(a==JOptionPane.CANCEL_OPTION)&lt;br /&gt; {&lt;br /&gt;  JOptionPane.showMessageDialog(frame,"You pressed Cancel button");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;***********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8075730861788216149?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8075730861788216149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/two-text-field-in-joptionpane.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8075730861788216149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8075730861788216149'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/two-text-field-in-joptionpane.html' title='Two text field in JOptionPane'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-1245779868933461793</id><published>2009-02-07T08:35:00.004+08:00</published><updated>2009-03-16T18:24:05.706+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jfilechooser'/><category scheme='http://www.blogger.com/atom/ns#' term='file'/><title type='text'>Open file using JFileChooser</title><content type='html'>Complete source code below will show you, how to open file using JFileChooser.&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : OpenFileUsingJFileChooser.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;/*&lt;br /&gt;*Desktop class only can get when you use JDK 6&lt;br /&gt;*/&lt;br /&gt;import java.awt.Desktop;&lt;br /&gt;&lt;br /&gt;import javax.swing.JFileChooser;&lt;br /&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;&lt;br /&gt;public class OpenFileUsingJFileChooser&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a file chooser&lt;br /&gt; JFileChooser fileChooser=new JFileChooser();&lt;br /&gt;&lt;br /&gt; //File chooser will appear in no windows parent&lt;br /&gt; int a=fileChooser.showOpenDialog(null);&lt;br /&gt;&lt;br /&gt; //Action that will take when user click open button&lt;br /&gt; if(a==JFileChooser.APPROVE_OPTION)&lt;br /&gt; {&lt;br /&gt;  //Get file that want to open&lt;br /&gt;  File fileToOpen=fileChooser.getSelectedFile();&lt;br /&gt;&lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;   //Open file using suitable program on computer.&lt;br /&gt;   //You don't need to tell what program to use.&lt;br /&gt;   //Java will select default program that your&lt;br /&gt;   //computer use to open the file.&lt;br /&gt;   //In windowsXP you can see what&lt;br /&gt;   //program that your computer use to open&lt;br /&gt;   //a file by right click on file,&lt;br /&gt;   //choose properties and see at&lt;br /&gt;   //Opens with : ProgramNameToOpenTheFile&lt;br /&gt;   Desktop.getDesktop().open(fileToOpen);&lt;br /&gt;  }&lt;br /&gt;  catch(Exception exception)&lt;br /&gt;  {&lt;br /&gt;   System.out.println("Problem occour when to open the file");&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-1245779868933461793?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/1245779868933461793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/open-file-using-jfilechooser.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1245779868933461793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1245779868933461793'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/open-file-using-jfilechooser.html' title='Open file using JFileChooser'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-2145472934384390274</id><published>2009-02-06T18:29:00.004+08:00</published><updated>2009-03-16T18:24:28.470+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file'/><title type='text'>Open any file or folder using Desktop class</title><content type='html'>Complete source code below will show you, how to open C:\ drive using Desktop class. Desktop class is only can get when you use jdk 6.&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : OpenFileUsingDesktopClass.java&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;/*&lt;br /&gt;*If you want to use Desktop class,&lt;br /&gt;*you must make sure that jdk version&lt;br /&gt;*that you use is 6. This facilities&lt;br /&gt;*is exist in jdk 6.&lt;br /&gt;*/&lt;br /&gt;import java.awt.Desktop;&lt;br /&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;&lt;br /&gt;public class OpenFileUsingDesktopClass&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt;  //Open C:\ drive&lt;br /&gt;  //Make sure that you change \ to \\&lt;br /&gt;  //You can change to other file or folder that you want&lt;br /&gt;  //Example for file that you want to open:&lt;br /&gt;  //C:\Sunset.jpg&lt;br /&gt;  //So, change C:\\ below to&lt;br /&gt;  //C:\\Sunset.jpg&lt;br /&gt;  Desktop.getDesktop().open(new File("C:\\"));&lt;br /&gt; }&lt;br /&gt; catch(Exception exception)&lt;br /&gt; {&lt;br /&gt;  exception.printStackTrace();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jdk-6u12-oth-JPR@CDS-CDS_Developer"&gt;&lt;b&gt;Click here to download jdk6&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jdk-6u10-docs-oth-JPR@CDS-CDS_Developer"&gt;&lt;b&gt;Click here to download jdk6 documentation&lt;/b&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-2145472934384390274?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/2145472934384390274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/open-any-file-or-folder-using-desktop.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2145472934384390274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2145472934384390274'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/open-any-file-or-folder-using-desktop.html' title='Open any file or folder using Desktop class'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-1577930453811211182</id><published>2009-02-06T00:23:00.004+08:00</published><updated>2009-03-16T18:25:06.741+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='uimanager'/><category scheme='http://www.blogger.com/atom/ns#' term='jbutton'/><title type='text'>Set JButton text color using UIManager</title><content type='html'>Complete source code below will show you, how to set JButton text color using UIManager. When you set JButton text color using this style, it will make all JButton in your program will have same text color. So, if you want to set only one text color for JButton, i suggest you &lt;a href="http://java2everyone.blogspot.com/2008/12/set-jbutton-text-color.html"&gt;&lt;b&gt;click here&lt;/b&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJButtonForegroundColorUseUiManager.java&lt;br /&gt;**********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.UIManager;&lt;br /&gt;&lt;br /&gt;import javax.swing.plaf.ColorUIResource;&lt;br /&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class SetJButtonForegroundColorUseUiManager&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; /*&lt;br /&gt;  *Create color base on RGB color model&lt;br /&gt;  *that will use as JButton foreground color.&lt;br /&gt;  *Red=255&lt;br /&gt;  *Green=0&lt;br /&gt;  *Blue=0&lt;br /&gt;  */&lt;br /&gt; Color foregroundColor=new Color(255,0,0);&lt;br /&gt;&lt;br /&gt; //Set JButton foreground color&lt;br /&gt; UIManager.put("Button.foreground",new ColorUIResource(foregroundColor));&lt;br /&gt;&lt;br /&gt; //Create a window using JFrame with title ( Set JButton foreground color using UIManager )&lt;br /&gt; JFrame frame=new JFrame("Set JButton foreground color using UIManager");&lt;br /&gt;&lt;br /&gt; //Create two button&lt;br /&gt; JButton button1=new JButton("Button 1");&lt;br /&gt; JButton button2=new JButton("Button 2");&lt;br /&gt;&lt;br /&gt; //Set JFrame layout to FlowLayout&lt;br /&gt; frame.setLayout(new FlowLayout());&lt;br /&gt;&lt;br /&gt; //Add created button into frame&lt;br /&gt; frame.add(button1);&lt;br /&gt; frame.add(button2);&lt;br /&gt;&lt;br /&gt; //Set JFrame default close operation&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;&lt;br /&gt; //Set JFrame size&lt;br /&gt; frame.setSize(400,400);&lt;br /&gt;&lt;br /&gt; //Make JFrame locate at center&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt;&lt;br /&gt; //Make JFrame visible&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-1577930453811211182?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/1577930453811211182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-jbutton-text-color-using-uimanager.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1577930453811211182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1577930453811211182'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/set-jbutton-text-color-using-uimanager.html' title='Set JButton text color using UIManager'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4766086473471260257</id><published>2009-02-05T16:43:00.004+08:00</published><updated>2009-03-16T18:25:55.849+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='file'/><title type='text'>Open any file or folder in java</title><content type='html'>Complete source code will show you, how to open any files or folders using java in windows.What you must know is :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;rundll32 SHELL32.DLL,ShellExec_RunDLL File_Or_Folder_To_Open&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;a href="http://www.howtogeek.com/howto/windows-vista/what-is-rundll32exe-and-why-is-it-running/"&gt;What is rundll32.exe And Why Is It Running?&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;****************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : OpenFileUsingJava.java&lt;br /&gt;****************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class OpenFileUsingJava&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt;  //Path for folder or file that you want to open&lt;br /&gt;  //In my case i will open C:\ drive&lt;br /&gt;  //So create a String like below&lt;br /&gt;  //Don't forget to change \ to \\&lt;br /&gt;  String a="C:\\";&lt;br /&gt; &lt;br /&gt;  //Execute command&lt;br /&gt;  //Command that you must know : rundll32 SHELL32.DLL,ShellExec_RunDLL File_Or_Folder_To_Open&lt;br /&gt;  Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL \""+a+"\"");&lt;br /&gt; }&lt;br /&gt; catch(Exception exception)&lt;br /&gt; {&lt;br /&gt;  exception.printStackTrace();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;****************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;****************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4766086473471260257?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4766086473471260257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/open-any-file-or-folder-in-java.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4766086473471260257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4766086473471260257'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/open-any-file-or-folder-in-java.html' title='Open any file or folder in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-2652771258887286530</id><published>2009-02-05T14:48:00.003+08:00</published><updated>2009-03-16T18:26:33.485+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='i++'/><category scheme='http://www.blogger.com/atom/ns#' term='++i'/><title type='text'>What is different between i++ and ++i</title><content type='html'>I want to share with you about different between i++ and ++i.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;++i&lt;/b&gt;&lt;br /&gt;**********&lt;br /&gt;int i=0;&lt;br /&gt;System.out.println(++i);&lt;br /&gt;**********&lt;br /&gt;&lt;b&gt;It will print on screen 1&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;i++&lt;/b&gt;&lt;br /&gt;**********&lt;br /&gt;int i=0;&lt;br /&gt;System.out.println(i++);&lt;br /&gt;**********&lt;br /&gt;&lt;b&gt;It will print on screen 0&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Answer :&lt;br /&gt;&lt;b&gt;++i will add current i value with 1 before print&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;i++ will add current i value with 1 after print&lt;/b&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-2652771258887286530?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/2652771258887286530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/what-is-different-between-i-and-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2652771258887286530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2652771258887286530'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/what-is-different-between-i-and-i.html' title='What is different between i++ and ++i'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8164078720376921173</id><published>2009-02-03T13:58:00.006+08:00</published><updated>2009-03-16T18:27:15.675+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='triangle'/><category scheme='http://www.blogger.com/atom/ns#' term='draw'/><category scheme='http://www.blogger.com/atom/ns#' term='jpanel'/><title type='text'>Draw triangle in JPanel</title><content type='html'>Complete source code below will show you, how to draw triangle in JPanel&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : DrawTriangle.java&lt;br /&gt;*********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class DrawTriangle extends JPanel&lt;br /&gt;{&lt;br /&gt;public DrawTriangle()&lt;br /&gt;{&lt;br /&gt; JFrame frame=new JFrame("Draw triangle in JPanel");&lt;br /&gt; frame.add(this);&lt;br /&gt;&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; frame.setSize(400,400);&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void paint(Graphics g)&lt;br /&gt;{&lt;br /&gt; super.paint(g);&lt;br /&gt;&lt;br /&gt; //All triangle corner x coordinate&lt;br /&gt; int[]x={0,150,300};&lt;br /&gt;&lt;br /&gt; //All triangle corner y coordinate&lt;br /&gt; int[]y={200,0,200};&lt;br /&gt;&lt;br /&gt; //Set color base on RGB&lt;br /&gt; //You can get RGB value for your color at "Color picker" at above&lt;br /&gt; //R=255&lt;br /&gt; //G=192&lt;br /&gt; //B=0&lt;br /&gt; //So after this all you draw will use this color&lt;br /&gt; g.setColor(new Color(255,192,0));&lt;br /&gt;&lt;br /&gt; //Draw triangle in JPanel&lt;br /&gt; g.fillPolygon(x,y,3);&lt;br /&gt;&lt;br /&gt; //Set color base on RGB&lt;br /&gt; //You can get RGB value for your color at "Color picker" at above&lt;br /&gt; //R=1&lt;br /&gt; //G=1&lt;br /&gt; //B=1&lt;br /&gt; //So after this all you draw will use this color&lt;br /&gt; g.setColor(new Color(1,1,1));&lt;br /&gt;&lt;br /&gt; //Set font that will use when draw String&lt;br /&gt; g.setFont(new Font("Arial",Font.BOLD,14));&lt;br /&gt;&lt;br /&gt; //Draw String in JPanel&lt;br /&gt; g.drawString("(0,200)",10,200);&lt;br /&gt; g.drawString("(150,0)",150,20);&lt;br /&gt; g.drawString("(300,200)",290,200);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; DrawTriangle dt=new DrawTriangle();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8164078720376921173?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8164078720376921173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/draw-triangle-in-jpanel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8164078720376921173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8164078720376921173'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/draw-triangle-in-jpanel.html' title='Draw triangle in JPanel'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8111135814482828956</id><published>2009-02-03T07:14:00.005+08:00</published><updated>2009-03-16T18:31:54.731+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='current'/><category scheme='http://www.blogger.com/atom/ns#' term='user input'/><category scheme='http://www.blogger.com/atom/ns#' term='date'/><title type='text'>Compare current date with user input date in java</title><content type='html'>Complete source code below will show you, how to compare current date with user input date in java.&lt;br /&gt;&lt;br /&gt;***************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : GetDate.java&lt;br /&gt;***************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;&lt;br /&gt;public class GetDate implements ActionListener&lt;br /&gt;{&lt;br /&gt;int year=0;&lt;br /&gt;int month=0;&lt;br /&gt;int date=0;&lt;br /&gt;&lt;br /&gt;String [] yearContent={"2000","2001","2002","2003","2004","2005","2006","2007","2008","2009","2010","2011"};&lt;br /&gt;String [] monthContent={"January","February","March","April","Mei","Jun","July","August","September","October","November","December"};&lt;br /&gt;String [] dateContent={"1","2","3","4","5","6","7","8","9","10",&lt;br /&gt;    "11","12","13","14","15","16","17","18","19","20",&lt;br /&gt;    "21","22","23","24","25","26","27","28","29","30",&lt;br /&gt;    "31"};&lt;br /&gt;&lt;br /&gt;JComboBox yearComboBox=new JComboBox(yearContent);&lt;br /&gt;JComboBox monthComboBox=new JComboBox(monthContent);&lt;br /&gt;JComboBox dateComboBox=new JComboBox(dateContent);&lt;br /&gt;&lt;br /&gt;JButton button=new JButton("Click here to compare to current date");&lt;br /&gt;&lt;br /&gt;JFrame frame=new JFrame("Compare date with current date");&lt;br /&gt;&lt;br /&gt;public GetDate()&lt;br /&gt;{&lt;br /&gt;button.addActionListener(this);&lt;br /&gt;&lt;br /&gt;Box box=Box.createHorizontalBox();&lt;br /&gt;box.add(dateComboBox);&lt;br /&gt;box.add(monthComboBox);&lt;br /&gt;box.add(yearComboBox);&lt;br /&gt;&lt;br /&gt;frame.setLayout(new GridLayout(2,1));&lt;br /&gt;&lt;br /&gt;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;frame.add(box);&lt;br /&gt;frame.add(button);&lt;br /&gt;frame.setSize(500,100);&lt;br /&gt;frame.setLocationRelativeTo(null);&lt;br /&gt;frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void actionPerformed(ActionEvent event)&lt;br /&gt;{&lt;br /&gt;if(event.getSource()==button)&lt;br /&gt;{&lt;br /&gt; String tempDate=(String)dateComboBox.getSelectedItem();&lt;br /&gt; date=Integer.parseInt(tempDate);&lt;br /&gt;&lt;br /&gt; month=monthComboBox.getSelectedIndex();&lt;br /&gt;&lt;br /&gt; String tempYear=(String)yearComboBox.getSelectedItem();&lt;br /&gt; year=Integer.parseInt(tempYear)-1900;&lt;br /&gt;&lt;br /&gt; Date currentDateValue=new Date();&lt;br /&gt; Date userChooserDate=new Date(year,month,date);&lt;br /&gt;&lt;br /&gt; int currentYear=currentDateValue.getYear();&lt;br /&gt; int currentMonth=currentDateValue.getMonth();&lt;br /&gt; int currentDate=currentDateValue.getDate();&lt;br /&gt;&lt;br /&gt; if((date==currentDate)&amp;amp;&amp;amp;(month==currentMonth)&amp;amp;&amp;amp;(year==currentYear))&lt;br /&gt; {&lt;br /&gt;  JOptionPane.showMessageDialog(frame,"Same date","SAME",JOptionPane.INFORMATION_MESSAGE);&lt;br /&gt; }&lt;br /&gt; else if(userChooserDate.compareTo(currentDateValue)&lt;0)&gt;0)&lt;br /&gt; {&lt;br /&gt;  JOptionPane.showMessageDialog(frame,"Welcome to the future","FUTURE",JOptionPane.INFORMATION_MESSAGE);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt;GetDate gd=new GetDate();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;***************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;***************************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8111135814482828956?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8111135814482828956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/02/compare-current-date-with-user-input.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8111135814482828956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8111135814482828956'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/02/compare-current-date-with-user-input.html' title='Compare current date with user input date in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6678149604404758846</id><published>2009-01-28T00:57:00.005+08:00</published><updated>2009-03-16T18:30:01.686+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Input box in java</title><content type='html'>Complete source code below will show you, how to &lt;b&gt;create simple input box&lt;/b&gt; that will prompt some input from user. We will use predefined java class, JOptionPane to create simple input box. If you want your input box appear in a container, you can change &lt;b&gt;null&lt;/b&gt; in source code below to target container.You can see example by &lt;a href="http://java2everyone.blogspot.com/2009/01/message-box-appear-in-jframe.html"&gt;&lt;b&gt;click here&lt;/b&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;*************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaInputDialog.java&lt;br /&gt;*************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;&lt;br /&gt;public class JavaInputDialog&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Pop up an input box with text ( What is your name ? )&lt;br /&gt; String a=JOptionPane.showInputDialog(null,"What is your name ?");&lt;br /&gt;&lt;br /&gt; //Print into command prompt what you put into input dialog box&lt;br /&gt; System.out.println("My name is : "+a);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*************************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6678149604404758846?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6678149604404758846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/input-box-in-java.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6678149604404758846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6678149604404758846'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/input-box-in-java.html' title='Input box in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8633245480730932080</id><published>2009-01-27T23:52:00.005+08:00</published><updated>2009-03-16T18:30:29.379+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jframe'/><category scheme='http://www.blogger.com/atom/ns#' term='message box'/><title type='text'>Message box appear in JFrame</title><content type='html'>Complete source code below will show you, how to make message box appear in a container.&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : MessageBoxAppearInJFrame.java&lt;br /&gt;**********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;&lt;br /&gt;public class MessageBoxAppearInJFrame&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a window using JFrame with title ( Message box appear in JFrame )&lt;br /&gt; JFrame frame=new JFrame("Message box appear in JFrame");&lt;br /&gt;&lt;br /&gt; //Set default close operation for JFrame&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;&lt;br /&gt; //Set JFrame size&lt;br /&gt; frame.setSize(400,400);&lt;br /&gt;&lt;br /&gt; //Make JFrame locate at center on screen&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt;&lt;br /&gt; //Make JFrame visible&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; //Pop up a message box with text ( I am a message dialog ) in created JFrame&lt;br /&gt; JOptionPane.showMessageDialog(frame,"I am a message dialog");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8633245480730932080?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8633245480730932080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/message-box-appear-in-jframe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8633245480730932080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8633245480730932080'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/message-box-appear-in-jframe.html' title='Message box appear in JFrame'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-7018231471183102685</id><published>2009-01-27T23:25:00.005+08:00</published><updated>2009-03-16T18:30:49.523+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='message box'/><title type='text'>Create message box in java</title><content type='html'>Complete source code below will show you, how to &lt;b&gt;create message box in java&lt;/b&gt;. We will use JOptionPane class to create message box. If you want your message box appear in a container, you can change &lt;b&gt;null&lt;/b&gt; in source code below to target container.You can see example by &lt;a href="http://java2everyone.blogspot.com/2009/01/message-box-appear-in-jframe.html"&gt;&lt;b&gt;click here&lt;/b&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : JavaMessageDialog.java&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.JOptionPane;&lt;br /&gt;&lt;br /&gt;public class JavaMessageDialog&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Pop up a message box with text ( I am a message dialog )&lt;br /&gt; JOptionPane.showMessageDialog(null,"I am a message dialog");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;************************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-7018231471183102685?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/7018231471183102685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/create-message-box-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7018231471183102685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7018231471183102685'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/create-message-box-in-java.html' title='Create message box in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4840701634602042122</id><published>2009-01-26T18:05:00.004+08:00</published><updated>2009-03-16T18:31:33.134+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='floating'/><category scheme='http://www.blogger.com/atom/ns#' term='number'/><category scheme='http://www.blogger.com/atom/ns#' term='point'/><category scheme='http://www.blogger.com/atom/ns#' term='user input'/><title type='text'>Read floating point number user input in java</title><content type='html'>Complete source code below, will show you how to wait and read floating point number user input in command prompt.&lt;br /&gt;&lt;br /&gt;********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ReadFloatingPointNumberUserInput.java&lt;br /&gt;********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class ReadFloatingPointNumberUserInput&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt;  //Create a scanner object&lt;br /&gt;  //Scanner is a predefined class in java that will be use to scan text&lt;br /&gt;  //System.in is mean, we will receive input from standard input stream&lt;br /&gt;  Scanner readUserInput=new Scanner(System.in);&lt;br /&gt;&lt;br /&gt;  //Print into command prompt(Put a floating point number : )&lt;br /&gt;  System.out.print("Put a floating point number : ");&lt;br /&gt;&lt;br /&gt;  //Wait and READ FLOATING POINT NUMBER from user input after user hit 'Enter'&lt;br /&gt;  float myPointNumber=readUserInput.nextFloat();&lt;br /&gt;&lt;br /&gt;  //Print what store in myPointNumber&lt;br /&gt;  System.out.println("My floating point number is : "+myPointNumber);&lt;br /&gt; }&lt;br /&gt; catch(Exception exception)&lt;br /&gt; {&lt;br /&gt;  //Error that will be print if user put other than floating point number&lt;br /&gt;  System.out.println("Hey !!! Don't put other than floating point number");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4840701634602042122?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4840701634602042122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/read-floating-point-number-user-input.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4840701634602042122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4840701634602042122'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/read-floating-point-number-user-input.html' title='Read floating point number user input in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-7315407570578615862</id><published>2009-01-26T17:46:00.004+08:00</published><updated>2009-03-16T18:33:26.528+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='integer'/><category scheme='http://www.blogger.com/atom/ns#' term='user input'/><title type='text'>Read integer user input in java</title><content type='html'>Complete source code below, will show you how to &lt;b&gt;wait and read integer user input in command prompt&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ReadIntegerUserInput.java&lt;br /&gt;**********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class ReadIntegerUserInput&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt;  //Create a scanner object&lt;br /&gt;  //Scanner is a predefined class in java that will be use to scan text&lt;br /&gt;  //System.in is mean, we will receive input from standard input stream&lt;br /&gt;  Scanner readUserInput=new Scanner(System.in);&lt;br /&gt;&lt;br /&gt;  //Print into command prompt(What is your age ?)&lt;br /&gt;  System.out.println("What is your age ?");&lt;br /&gt;&lt;br /&gt;  //Wait and READ INTEGER INPUT from user after user hit 'Enter'&lt;br /&gt;  int myAge=readUserInput.nextInt();&lt;br /&gt;&lt;br /&gt;  //Print what store in myAge&lt;br /&gt;  System.out.println("Your age is : "+myAge);&lt;br /&gt; }&lt;br /&gt; catch(Exception exception)&lt;br /&gt; {&lt;br /&gt;  //Error that will be print if user put other than number include&lt;br /&gt;  //point number&lt;br /&gt;  System.out.println("Hey !!! Don't put other than number");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-7315407570578615862?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/7315407570578615862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/read-integer-user-input-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7315407570578615862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7315407570578615862'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/read-integer-user-input-in-java.html' title='Read integer user input in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4741456281271886027</id><published>2009-01-26T16:49:00.005+08:00</published><updated>2009-03-16T18:33:51.565+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='word'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='user input'/><title type='text'>Read a word user input in java</title><content type='html'>Complete source code below, will show you how to &lt;b&gt;wait and read only a word from user input in command prompt&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;*****************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ReadOneWordUserInput.java&lt;br /&gt;*****************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class ReadOneWordUserInput&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a scanner object&lt;br /&gt; //Scanner is a predefined class in java that will be use to scan text&lt;br /&gt; //System.in is mean, we will receive input from standard input stream&lt;br /&gt; Scanner readUserInput=new Scanner(System.in);&lt;br /&gt;&lt;br /&gt; //Print into command prompt(What is your gender ?)&lt;br /&gt; //Print into command prompt(Female/Male)&lt;br /&gt; System.out.println("What is your gender ?\nFemale/Male");&lt;br /&gt;&lt;br /&gt; //Wait and READ A WORD from user input after user hit 'Enter'&lt;br /&gt; //Method next() in class scanner will read only first word in user input&lt;br /&gt; //So, second word that seperate by space will be ignore.&lt;br /&gt; String myGender=readUserInput.next();&lt;br /&gt;&lt;br /&gt; //Print what store in myGender&lt;br /&gt; System.out.println(myGender);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*****************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*****************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4741456281271886027?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4741456281271886027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/read-word-user-input-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4741456281271886027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4741456281271886027'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/read-word-user-input-in-java.html' title='Read a word user input in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-7953219090374557876</id><published>2009-01-26T16:23:00.004+08:00</published><updated>2009-03-16T18:34:25.204+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='user input'/><title type='text'>Read text user input in java</title><content type='html'>Complete source code below, will show you how to &lt;b&gt;wait and read text user input in command prompt&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : ReadTextUserInput.java&lt;br /&gt;********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class ReadTextUserInput&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a scanner object&lt;br /&gt; //Scanner is a predefined class in java that will be use to scan text&lt;br /&gt; //System.in is mean, we will receive input from standard input stream&lt;br /&gt; Scanner readUserInput=new Scanner(System.in);&lt;br /&gt;&lt;br /&gt; //Print into command prompt(What is your name ?)&lt;br /&gt; System.out.println("What is your name ?");&lt;br /&gt;&lt;br /&gt; //Wait and READ TEXT INPUT from user after user hit 'Enter'&lt;br /&gt; String myName=readUserInput.nextLine();&lt;br /&gt;&lt;br /&gt; //Print what store in myName&lt;br /&gt; System.out.println(myName);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-7953219090374557876?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/7953219090374557876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/read-text-user-input-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7953219090374557876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/7953219090374557876'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/read-text-user-input-in-java.html' title='Read text user input in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-5512396690661025787</id><published>2009-01-26T15:46:00.005+08:00</published><updated>2009-03-16T18:34:44.814+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='user input'/><title type='text'>Wait user input in java</title><content type='html'>Complete source code below will show you, how to &lt;b&gt;wait for user input in command prompt&lt;/b&gt;.&lt;br /&gt;Input is a line of text.&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : WaitUserInput.java&lt;br /&gt;**********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import java.util.Scanner;&lt;br /&gt;&lt;br /&gt;public class WaitUserInput&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a scanner object&lt;br /&gt; //Scanner is a predefined class in java that will be use to scan text&lt;br /&gt; //System.in is mean, we will receive input from standard input stream&lt;br /&gt; Scanner readUserInput=new Scanner(System.in);&lt;br /&gt;&lt;br /&gt; //Print into command prompt(What is your name ?)&lt;br /&gt; System.out.println("What is your name ?");&lt;br /&gt;&lt;br /&gt; //WAIT FOR USER INPUT&lt;br /&gt; //After user put it's name, he or she must press 'Enter'&lt;br /&gt; //After user press 'Enter', all the input contents will read into 'myName'&lt;br /&gt; String myName=readUserInput.nextLine();&lt;br /&gt;&lt;br /&gt; //Print what it store in myName&lt;br /&gt; System.out.println(myName);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-5512396690661025787?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/5512396690661025787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/wait-user-input-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5512396690661025787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/5512396690661025787'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/wait-user-input-in-java.html' title='Wait user input in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3234081311794277001</id><published>2009-01-26T15:23:00.012+08:00</published><updated>2009-03-16T18:35:01.256+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='user input'/><title type='text'>User input in java</title><content type='html'>Ok, now i share with you how you can handle user input in java.&lt;br /&gt;&lt;br /&gt;&gt;&gt;Receive user input from command line&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://java2everyone.blogspot.com/2009/01/wait-user-input-in-java.html"&gt;&lt;b&gt;Wait for user input&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://java2everyone.blogspot.com/2009/01/read-text-user-input-in-java.html"&gt;&lt;b&gt;Read text user input in java&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://java2everyone.blogspot.com/2009/01/read-word-user-input-in-java.html"&gt;&lt;b&gt;Read a word user input in java&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://java2everyone.blogspot.com/2009/01/read-integer-user-input-in-java.html"&gt;&lt;b&gt;Read integer input in java&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://java2everyone.blogspot.com/2009/01/read-floating-point-number-user-input.html"&gt;&lt;b&gt;Read floating point number user input in java&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&gt;&gt;Receive user input from input box&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://java2everyone.blogspot.com/2009/01/input-box-in-java.html"&gt;&lt;b&gt;Create simple input box in java&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&gt;&gt;Receive user input from text field&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;ul&gt;&lt;li&gt;&lt;a style="font-weight: bold;" href="http://java2everyone.blogspot.com/2008/12/get-jtextfield-text.html"&gt;Get JTextField text&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&gt;&gt;Receive user input from text area&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;ul&gt;&lt;li&gt;&lt;a style="font-weight: bold;" href="http://java2everyone.blogspot.com/2008/12/get-jtextarea-text.html"&gt;Get JTextArea text&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;table&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3234081311794277001?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3234081311794277001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/user-input-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3234081311794277001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3234081311794277001'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/user-input-in-java.html' title='User input in java'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8937013813317216065</id><published>2009-01-25T23:09:00.004+08:00</published><updated>2009-03-16T18:35:32.512+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tip'/><category scheme='http://www.blogger.com/atom/ns#' term='boxlayout'/><title type='text'>Tip for BoxLayout</title><content type='html'>BoxLayout enable we arrange components into two direction. Firstly is horizontal and secondly is vertical.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;a href="http://java2everyone.blogspot.com/2009/01/set-jpanel-layout-using-baglayout.html"&gt;Example source code for set layout using BoxLayout&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8937013813317216065?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8937013813317216065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-baglayout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8937013813317216065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8937013813317216065'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-baglayout.html' title='Tip for BoxLayout'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8929126732763907025</id><published>2009-01-25T23:03:00.005+08:00</published><updated>2009-03-16T18:36:02.581+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='layout'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='jpanel'/><category scheme='http://www.blogger.com/atom/ns#' term='boxlayout'/><title type='text'>Set JPanel layout using BoxLayout</title><content type='html'>Complete source code below will show you how to set JPanel layout using BoxLayout&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJPanelLayoutUsingBoxLayout.java&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class SetJPanelLayoutUsingBoxLayout&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a window using JFrame with title ( Set JPanel layout using BoxLayout )&lt;br /&gt; JFrame frame=new JFrame("Set JPanel layout using BoxLayout");&lt;br /&gt;&lt;br /&gt; //Create a panel using JPanel&lt;br /&gt; JPanel panel=new JPanel();&lt;br /&gt;&lt;br /&gt; //Set JPanel layout using BoxLayout with vertical lay out&lt;br /&gt; //You can try change to BoxLayout.X_AXIS to make components lay out in horizontal&lt;br /&gt; panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));&lt;br /&gt;&lt;br /&gt; //Create a button with text ( First button )&lt;br /&gt; JButton button=new JButton("First button");&lt;br /&gt;&lt;br /&gt; //Create a button with text ( Second button )&lt;br /&gt; JButton button2=new JButton("Second button");&lt;br /&gt;&lt;br /&gt; //Create a button with text ( Third button )&lt;br /&gt; JButton button3=new JButton("Third button");&lt;br /&gt;&lt;br /&gt; //Create a dimension with :&lt;br /&gt; //Width : 10 pixels&lt;br /&gt; //Height : 10 pixels&lt;br /&gt; Dimension dim=new Dimension(10,10);&lt;br /&gt;&lt;br /&gt; //Create an invisible box with dimension size and add into created panel&lt;br /&gt; //You can try eliminate this and see what happen&lt;br /&gt; panel.add(Box.createRigidArea(dim));&lt;br /&gt;&lt;br /&gt; //Add button into panel&lt;br /&gt; panel.add(button);&lt;br /&gt;&lt;br /&gt; //Create an invisible box with dimension size and add into created panel&lt;br /&gt; //You can try eliminate this and see what happen&lt;br /&gt; panel.add(Box.createRigidArea(dim));&lt;br /&gt;&lt;br /&gt; //Add button2 into panel&lt;br /&gt; panel.add(button2);&lt;br /&gt;&lt;br /&gt; //Create an invisible box with dimension size and add into created panel&lt;br /&gt; //You can try eliminate this and see what happen&lt;br /&gt; panel.add(Box.createRigidArea(dim));&lt;br /&gt;&lt;br /&gt; //Add button3 into panel&lt;br /&gt; panel.add(button3);&lt;br /&gt;&lt;br /&gt; //Create an invisible box with dimension size and add into created panel&lt;br /&gt; //You can try eliminate this and see what happen&lt;br /&gt; panel.add(Box.createRigidArea(dim));&lt;br /&gt;&lt;br /&gt; //add panel into created JFrame&lt;br /&gt; frame.add(panel);&lt;br /&gt;&lt;br /&gt; //Set default close operation for JFrame&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;&lt;br /&gt; //Set JFrame size&lt;br /&gt; frame.setSize(500,200);&lt;br /&gt;&lt;br /&gt; //Make JFrame locate at center of screen&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt;&lt;br /&gt; //Make JFrame visible&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8929126732763907025?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8929126732763907025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/set-jpanel-layout-using-baglayout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8929126732763907025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8929126732763907025'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/set-jpanel-layout-using-baglayout.html' title='Set JPanel layout using BoxLayout'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-8116373292650188071</id><published>2009-01-25T20:27:00.004+08:00</published><updated>2009-03-16T18:36:32.823+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='layout'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='jpanel'/><category scheme='http://www.blogger.com/atom/ns#' term='gridbaglayout'/><title type='text'>Set JPanel layout using GridBagLayout</title><content type='html'>Source code below will show you, how to set JPanel layout using GridBagLayout.&lt;br /&gt;&lt;br /&gt;**************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJPanelLayoutToGridBagLayout.java&lt;br /&gt;**************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class SetJPanelLayoutToGridBagLayout extends JPanel&lt;br /&gt;{&lt;br /&gt;/**Note**&lt;br /&gt; *When it say, "It will take 4 grid for it's width"&lt;br /&gt; *it mean it will use 4 box in grid and it's direction is to right&lt;br /&gt; *&lt;br /&gt; *When it say, "It will take 4 grid for it's height"&lt;br /&gt; *it mean it will use 4 box in grid and it's direction is to bottom&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;//Create GridBigLayout object&lt;br /&gt;GridBagLayout gbl=new GridBagLayout();&lt;br /&gt;&lt;br /&gt;//Create GridBagConstraints object&lt;br /&gt;GridBagConstraints gbc=new GridBagConstraints();&lt;br /&gt;&lt;br /&gt;//Create a label using JLabel with text ( Name : )&lt;br /&gt;JLabel label=new JLabel("Name :");&lt;br /&gt;&lt;br /&gt;//Create a label using JLabel with text ( Age : )&lt;br /&gt;JLabel label2=new JLabel("Age :");&lt;br /&gt;&lt;br /&gt;//Create a text field using JTextField with numbers of column equal to 12&lt;br /&gt;JTextField textField=new JTextField(12);&lt;br /&gt;&lt;br /&gt;//Create a text field using JTextField with numbers of column equal to 3&lt;br /&gt;JTextField textField2=new JTextField(3);&lt;br /&gt;&lt;br /&gt;//Create a button with text ( OK )&lt;br /&gt;JButton button=new JButton("OK");&lt;br /&gt;&lt;br /&gt;//Create a button with text ( Cancel )&lt;br /&gt;JButton button2=new JButton("Cancel");&lt;br /&gt;&lt;br /&gt;//Create a box with vertical layout&lt;br /&gt;Box box1=new Box(BoxLayout.Y_AXIS);&lt;br /&gt;&lt;br /&gt;//Create a box with horizontal layout&lt;br /&gt;Box box2=new Box(BoxLayout.X_AXIS);&lt;br /&gt;&lt;br /&gt;//Create a box with horizontal layout&lt;br /&gt;Box box3=new Box(BoxLayout.X_AXIS);&lt;br /&gt;&lt;br /&gt;//Create a box with vertical layout&lt;br /&gt;Box box4=new Box(BoxLayout.Y_AXIS);&lt;br /&gt;&lt;br /&gt;//Create a window using JFrame with title ( Set JPanel layout using GridBagLayout )&lt;br /&gt;JFrame frame=new JFrame("Set JPanel layout using GridBagLayout");&lt;br /&gt;&lt;br /&gt;//Constructor&lt;br /&gt;public SetJPanelLayoutToGridBagLayout()&lt;br /&gt;{&lt;br /&gt; //Make text in label allign to right&lt;br /&gt; label.setHorizontalAlignment(SwingConstants.RIGHT);&lt;br /&gt; label2.setHorizontalAlignment(SwingConstants.RIGHT);&lt;br /&gt;&lt;br /&gt; //Set panel layout to GridBagLayout&lt;br /&gt; setLayout(gbl);&lt;br /&gt;&lt;br /&gt; //Field that will be use when display area is larger than component size.&lt;br /&gt; //It mean when it has some space between component, component will&lt;br /&gt; //enlarge to horizontal direction&lt;br /&gt; gbc.fill=GridBagConstraints.HORIZONTAL;&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add label into panel with top left corner of the label at crossing between&lt;br /&gt;  *first horizontal and first vertical line.&lt;br /&gt;  *It will take 4 grid for it's width&lt;br /&gt;  *It will take 1 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(label,1,1,4,1);&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add label2 into panel with top left corner of the&lt;br /&gt;  *label at crossing between&lt;br /&gt;  *third horizontal and first vertical line.&lt;br /&gt;  *It will take 4 grid for it's width&lt;br /&gt;  *It will take 1 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(label2,3,1,4,1);&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add textField into panel with top left corner of the text field at&lt;br /&gt;  *crossing between first horizontal and sixth vertical line&lt;br /&gt;  *It will take 12 grid for it's width&lt;br /&gt;  *It will take 1 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(textField,1,6,12,1);&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add textField2 into panel with top left corner of the text field at&lt;br /&gt;  *crossing between third horizontal and sixth vertical line&lt;br /&gt;  *It will take 3 grid for it's width&lt;br /&gt;  *It will take 1 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(textField2,3,6,3,1);&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add button into panel with top left corner of the button at&lt;br /&gt;  *crossing between fifth horizontal and fifth vertical line&lt;br /&gt;  *It will take 5 grid for it's width&lt;br /&gt;  *It will take 2 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(button,5,5,5,2);&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add button2 into panel with top left corner of the button at&lt;br /&gt;  *crossing between fifth horizontal and eleventh vertical line&lt;br /&gt;  *It will take 5 grid for it's width&lt;br /&gt;  *It will take 2 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(button2,5,11,5,2);&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add a component that is invisible with 10 pixels width&lt;br /&gt;  *and 10 pixels height into box1&lt;br /&gt;  */&lt;br /&gt; box1.add(Box.createRigidArea(new Dimension(10,10)));&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add box1 into panel with top left corner of the box at&lt;br /&gt;  *crossing between first horizontal and fifth vertical line&lt;br /&gt;  *It will take 1 grid for it's width&lt;br /&gt;  *It will take 3 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(box1,1,5,1,3);&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add a component that is invisible with 30 pixels width&lt;br /&gt;  *and 10 pixels height into box2&lt;br /&gt;  */&lt;br /&gt; box2.add(Box.createRigidArea(new Dimension(30,10)));&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add box2 into panel with top left corner of the box at&lt;br /&gt;  *crossing between second horizontal and first vertical line&lt;br /&gt;  *It will take 17 grid for it's width&lt;br /&gt;  *It will take 1 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(box2,2,1,17,1);&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add a component that is invisible with 30 pixels width&lt;br /&gt;  *and 10 pixels height into box3&lt;br /&gt;  */&lt;br /&gt; box3.add(Box.createRigidArea(new Dimension(30,10)));&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add box3 into panel with top left corner of the box at&lt;br /&gt;  *crossing between fourth horizontal and first vertical line&lt;br /&gt;  *It will take 17 grid for it's width&lt;br /&gt;  *It will take 1 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(box3,4,1,17,1);&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add a component that is invisible with 10 pixels width&lt;br /&gt;  *and 10 pixels height into box4&lt;br /&gt;  */&lt;br /&gt; box4.add(Box.createRigidArea(new Dimension(10,10)));&lt;br /&gt;&lt;br /&gt; /*&lt;br /&gt;  *Add box4 into panel with top left corner of the box at&lt;br /&gt;  *crossing between fifth horizontal and tenth vertical line&lt;br /&gt;  *It will take 1 grid for it's width&lt;br /&gt;  *It will take 2 grid for it's height&lt;br /&gt;  */&lt;br /&gt; addComponent(box4,5,10,1,2);&lt;br /&gt;&lt;br /&gt; //Add panel into JFrame&lt;br /&gt; frame.add(this);&lt;br /&gt;&lt;br /&gt; //Set default close operation for JFrame&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;&lt;br /&gt; //SetJFrame size&lt;br /&gt; frame.setSize(500,400);&lt;br /&gt;&lt;br /&gt; //Make JFrame center on the screen&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt;&lt;br /&gt; //Disble JFrame from resizable&lt;br /&gt; frame.setResizable(false);&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//Method addComponent&lt;br /&gt;public void addComponent(Component component, int row, int column, int width, int height)&lt;br /&gt;{&lt;br /&gt; gbc.gridx=column;&lt;br /&gt; gbc.gridy=row;&lt;br /&gt; gbc.gridwidth=width;&lt;br /&gt; gbc.gridheight=height;&lt;br /&gt; gbl.setConstraints(component,gbc);&lt;br /&gt; add(component);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//Main method&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; SetJPanelLayoutToGridBagLayout sjpltgbl=new SetJPanelLayoutToGridBagLayout();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-8116373292650188071?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/8116373292650188071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/set-jpanel-layout-using-gridbaglayout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8116373292650188071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/8116373292650188071'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/set-jpanel-layout-using-gridbaglayout.html' title='Set JPanel layout using GridBagLayout'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6293852560532429632</id><published>2009-01-24T00:27:00.004+08:00</published><updated>2009-03-16T18:36:58.509+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tip'/><category scheme='http://www.blogger.com/atom/ns#' term='gridbaglayout'/><title type='text'>Tip for GridBagLayout</title><content type='html'>GridBagLayout enable you to arrange component in more flexible way. What you need is only a piece of paper. After that, you draw grid and sketch your graphical user interface on the paper like image below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_f2uGmZtYbGs/SXxcjySz7WI/AAAAAAAABXs/CuA-h18nGs0/s1600-h/gridbaglayout.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 176px;" src="http://1.bp.blogspot.com/_f2uGmZtYbGs/SXxcjySz7WI/AAAAAAAABXs/CuA-h18nGs0/s400/gridbaglayout.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5295209031746710882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java2everyone.blogspot.com/2009/01/set-jpanel-layout-using-gridbaglayout.html"&gt;&lt;b&gt;Click here for it's source code&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6293852560532429632?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6293852560532429632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-gridbaglayout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6293852560532429632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6293852560532429632'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-gridbaglayout.html' title='Tip for GridBagLayout'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_f2uGmZtYbGs/SXxcjySz7WI/AAAAAAAABXs/CuA-h18nGs0/s72-c/gridbaglayout.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-2546980994242624132</id><published>2009-01-23T23:47:00.005+08:00</published><updated>2009-03-16T18:37:23.106+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gridlayout'/><category scheme='http://www.blogger.com/atom/ns#' term='tip'/><title type='text'>Tip for GridLayout</title><content type='html'>GridLayout will arrange components into container from left to right like FlowLayout do. But what make it different to FlowLayout ? The answer is, it will arrange components in grid. See the image below. It represent a grid with 3 rows and 2 columns. First component will be put into first row and first column. Second component will be put into first row and second column. Third component will be put into second row and first column. Fourth component will be put into second row and second column. Fifth component will be put into third row and first column and last component will be put into third row and second column.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_f2uGmZtYbGs/SXnsImxq2jI/AAAAAAAABXE/PWTNUUOfGsY/s1600-h/grid(3x2).jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_f2uGmZtYbGs/SXnsImxq2jI/AAAAAAAABXE/PWTNUUOfGsY/s320/grid(3x2).jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5294522469542713906" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;a href="http://java2everyone.blogspot.com/2008/12/set-jframe-layout-using-grid-layout.html"&gt;Example source code for GridLayout&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-2546980994242624132?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/2546980994242624132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-gridlayout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2546980994242624132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2546980994242624132'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-gridlayout.html' title='Tip for GridLayout'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_f2uGmZtYbGs/SXnsImxq2jI/AAAAAAAABXE/PWTNUUOfGsY/s72-c/grid(3x2).jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4666823351991156413</id><published>2009-01-23T23:17:00.003+08:00</published><updated>2009-03-16T18:38:02.681+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tip'/><category scheme='http://www.blogger.com/atom/ns#' term='borderlayout'/><title type='text'>Tip for BorderLayout</title><content type='html'>BorderLayout is also a layout manager like FlowLayout. But, it not arrange components in container from left to right like FlowLayout do. It will arrange component in five part.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;NORTH&lt;br /&gt;SOUTH&lt;br /&gt;CENTER&lt;br /&gt;EAST&lt;br /&gt;WEST&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java2everyone.blogspot.com/2008/12/set-jframe-layout-using-border-layout.html"&gt;Example source code for BorderLayout&lt;/a&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4666823351991156413?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4666823351991156413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-borderlayout_23.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4666823351991156413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4666823351991156413'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-borderlayout_23.html' title='Tip for BorderLayout'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-2361213030766484343</id><published>2009-01-23T18:39:00.004+08:00</published><updated>2009-03-16T18:38:25.599+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tip'/><category scheme='http://www.blogger.com/atom/ns#' term='flowlayout'/><title type='text'>Tip for FlowLayout</title><content type='html'>&lt;b&gt;FlowLayout is use to arrange components in a container from left to right&lt;/b&gt;. If it reached at the end of the container, but there are still left other component, it will go to the next line in the container and start again arrange component from left to right.&lt;br /&gt;&lt;br /&gt;Example of container : JFrame, JPanel, JWindow, JInternalFrame&lt;br /&gt;(Use to hold other component)&lt;br /&gt;&lt;br /&gt;Example of component : JPanel, JButton, JTextField, JCheckBox, JRadioButton&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java2everyone.blogspot.com/2008/12/set-jframe-layout-using-flow-layout.html"&gt;&lt;b&gt;Example source code for FlowLayout&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-2361213030766484343?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/2361213030766484343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-flowlayout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2361213030766484343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/2361213030766484343'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/tip-for-flowlayout.html' title='Tip for FlowLayout'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4786427843455170824</id><published>2009-01-23T08:53:00.005+08:00</published><updated>2009-03-16T18:38:50.858+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='image'/><category scheme='http://www.blogger.com/atom/ns#' term='jtextfield'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><title type='text'>Set JTextField background image</title><content type='html'>Complete source code below will show you, how to set image background in a JTextField. You can download image (textFieldBackgroundImage.jpg) that use in source code at below.&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : SetJTextFieldBackgroundImage.java&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;public class SetJTextFieldBackgroundImage extends JTextField&lt;br /&gt;{&lt;br /&gt;public SetJTextFieldBackgroundImage()&lt;br /&gt;{&lt;br /&gt; JFrame frame=new JFrame("Set JTextField background image");&lt;br /&gt; frame.add(this);&lt;br /&gt; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt; frame.setSize(300,65);&lt;br /&gt; frame.setLocationRelativeTo(null);&lt;br /&gt; frame.setResizable(false);&lt;br /&gt; frame.setVisible(true);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void paint(Graphics g)&lt;br /&gt;{&lt;br /&gt; setOpaque(false);&lt;br /&gt;&lt;br /&gt; //Image that will be set as JTextField background&lt;br /&gt; //I suggest, image that will be use is blur...&lt;br /&gt; //If image is locate at other location, you must put it's full location address.&lt;br /&gt; //For example : C:\\Documents and Settings\\evergreen\\Desktop\\textFieldBackgroundImage.jpg&lt;br /&gt; ImageIcon ii=new ImageIcon("textFieldBackgroundImage.jpg");&lt;br /&gt; Image i=ii.getImage();&lt;br /&gt; g.drawImage(i,0,0,this);&lt;br /&gt; super.paint(g);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; SetJTextFieldBackgroundImage sjtfbi=new SetJTextFieldBackgroundImage();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_f2uGmZtYbGs/SXkVzw5Q78I/AAAAAAAABW8/Uz0qmBT6wdY/s1600-h/textFieldBackgroundImage.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_f2uGmZtYbGs/SXkVzw5Q78I/AAAAAAAABW8/Uz0qmBT6wdY/s320/textFieldBackgroundImage.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5294286815993327554" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;textFieldBackgroundImage.jpg&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4786427843455170824?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4786427843455170824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/set-jtextfield-background-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4786427843455170824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4786427843455170824'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/set-jtextfield-background-image.html' title='Set JTextField background image'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_f2uGmZtYbGs/SXkVzw5Q78I/AAAAAAAABW8/Uz0qmBT6wdY/s72-c/textFieldBackgroundImage.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-4405199000807092224</id><published>2009-01-23T07:42:00.002+08:00</published><updated>2009-03-16T18:39:25.338+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='color'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><category scheme='http://www.blogger.com/atom/ns#' term='jbutton'/><title type='text'>Set JButton background color on click</title><content type='html'>&lt;a href="http://java2everyone.blogspot.com/2009/01/set-jbutton-select-color.html"&gt;&lt;b&gt;Click here&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-4405199000807092224?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/4405199000807092224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/set-jbutton-background-color-on-click.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4405199000807092224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/4405199000807092224'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/set-jbutton-background-color-on-click.html' title='Set JButton background color on click'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-6751277361994390420</id><published>2009-01-23T01:04:00.004+08:00</published><updated>2009-03-16T18:40:01.268+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='character'/><category scheme='http://www.blogger.com/atom/ns#' term='whitespace'/><title type='text'>Determine character is whitespace</title><content type='html'>Complete source code below will show you, how to determine character is whitespace or not in java.&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : DetermineCharacterIsSpace.java&lt;br /&gt;*******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class DetermineCharacterIsSpace&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a space character using char by press spacebar once between single quote(' ')&lt;br /&gt; //You can try change it's value by change it to a letter 'A' for example.&lt;br /&gt; char a=' ';&lt;br /&gt;&lt;br /&gt; //Determine created character is space or not&lt;br /&gt; //using method isWhitespace from class Character.&lt;br /&gt; //isWhitespace is a static method, so we don't need to create object when&lt;br /&gt; //we want to use it.&lt;br /&gt; if(Character.isWhitespace(a))&lt;br /&gt; {&lt;br /&gt;  //Print (It is a whitespace) if character is a whitespace&lt;br /&gt;  System.out.println("It is a whitespace");&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt;  //Print (It is not a whitespace) if character is not a whitespace&lt;br /&gt;  System.out.println("It is not a whitespace");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;*******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;*******************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-6751277361994390420?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/6751277361994390420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/determine-character-is-whitespace.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6751277361994390420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/6751277361994390420'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/determine-character-is-whitespace.html' title='Determine character is whitespace'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-1114986240938911545</id><published>2009-01-22T17:56:00.004+08:00</published><updated>2009-03-16T18:40:20.877+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='uppercase'/><category scheme='http://www.blogger.com/atom/ns#' term='character'/><title type='text'>Determine character is uppercase</title><content type='html'>Complete source code below will show you, how to determine character is uppercase or not in java.&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : DetermineCharacterIsUppercase.java&lt;br /&gt;******************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class DetermineCharacterIsUppercase&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a uppercase character using char with value(B)&lt;br /&gt; //You can try change it's value to letter(b)&lt;br /&gt; char a='B';&lt;br /&gt;&lt;br /&gt; //Determine created character is uppercase or not&lt;br /&gt; //using method isUpperCase from class Character.&lt;br /&gt; //isUpperCase is a static method, so we don't need to create object when&lt;br /&gt; //we want to use it.&lt;br /&gt; if(Character.isUpperCase(a))&lt;br /&gt; {&lt;br /&gt;  //Print (It is an uppercase) if character is an uppercase&lt;br /&gt;  System.out.println("It is an uppercase");&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt;  //Print (It is not an uppercase) if character is not an uppercase&lt;br /&gt;  System.out.println("It is not an uppercase");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;******************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;******************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-1114986240938911545?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/1114986240938911545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/determine-character-is-uppercase.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1114986240938911545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/1114986240938911545'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/determine-character-is-uppercase.html' title='Determine character is uppercase'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5834495443794667662.post-3753501264554138430</id><published>2009-01-22T17:00:00.004+08:00</published><updated>2009-03-16T18:40:58.553+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='character'/><category scheme='http://www.blogger.com/atom/ns#' term='lowercase'/><title type='text'>Determine character is lowercase</title><content type='html'>Complete source code below will show you, how to determine character is lowercase or not in java.&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;COMPLETE SOURCE CODE FOR : DetermineCharacterIsLowercase.java&lt;br /&gt;**********************************************************************&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="Java"&gt;&lt;br /&gt;public class DetermineCharacterIsLowercase&lt;br /&gt;{&lt;br /&gt;public static void main(String[]args)&lt;br /&gt;{&lt;br /&gt; //Create a lowercase character using char with value(b)&lt;br /&gt; //You can try change it's value to letter(B)&lt;br /&gt; char a='b';&lt;br /&gt;&lt;br /&gt; //Determine created character is lowercase or not&lt;br /&gt; //using method isLowerCase from class Character.&lt;br /&gt; //isLowerCase is a static method, so we don't need to create object when&lt;br /&gt; //we want to use it.&lt;br /&gt; if(Character.isLowerCase(a))&lt;br /&gt; {&lt;br /&gt;  //Print (It is a lowercase) if character is a lowercase&lt;br /&gt;  System.out.println("It is a lowercase");&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt;  //Print (It is not a lowercase) if character is not a lowercase&lt;br /&gt;  System.out.println("It is not a lowercase");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**********************************************************************&lt;br /&gt;JUST COMPILE AND EXECUTE IT&lt;br /&gt;**********************************************************************&lt;div class="blogger-post-footer"&gt;http://java2everyone.blogspot.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5834495443794667662-3753501264554138430?l=java2everyone.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java2everyone.blogspot.com/feeds/3753501264554138430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java2everyone.blogspot.com/2009/01/determine-character-is-lowercase.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3753501264554138430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5834495443794667662/posts/default/3753501264554138430'/><link rel='alternate' type='text/html' href='http://java2everyone.blogspot.com/2009/01/determine-character-is-lowercase.html' title='Determine character is lowercase'/><author><name>Muaturun.Co.Cc</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_f2uGmZtYbGs/TD5-sffCE-I/AAAAAAAACP4/nTPqnfXLMKQ/S220/favicon.jpg'/></author><thr:total>0</thr:total></entry></feed>
