<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Itphyogyi (UCSM)'s Weblog</title>
	<atom:link href="http://itphyogyi.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://itphyogyi.wordpress.com</link>
	<description>Selected Source Codes....Thanks For Coming My Weblog...phyowaitun2008@gmail.com</description>
	<lastBuildDate>Sun, 10 Feb 2008 04:20:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='itphyogyi.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Itphyogyi (UCSM)'s Weblog</title>
		<link>http://itphyogyi.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://itphyogyi.wordpress.com/osd.xml" title="Itphyogyi (UCSM)&#039;s Weblog" />
	<atom:link rel='hub' href='http://itphyogyi.wordpress.com/?pushpress=hub'/>
		<item>
		<title></title>
		<link>http://itphyogyi.wordpress.com/2008/02/10/38/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/10/38/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 04:20:49 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/2008/02/10/38/</guid>
		<description><![CDATA[Online Users<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=38&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><!-- Start FreeOnlineUsers.com --><br />
<a href="http://www.freeonlineusers.com"><br />
<font color="blue">  Online Users</font></a><br />
<!-- End FreeOnlineUsers.com --></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=38&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/10/38/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
		<item>
		<title>JProgressbar &#8212; Sum of &#8216;n&#8217; Numbers</title>
		<link>http://itphyogyi.wordpress.com/2008/02/07/jprogressbar-sum-of-n-numbers/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/07/jprogressbar-sum-of-n-numbers/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:41:33 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/2008/02/07/jprogressbar-sum-of-n-numbers/</guid>
		<description><![CDATA[/* * &#60;Applet code=TJProgressBar width=400 height=100&#62; * &#60;/Applet&#62; */ import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; public class TJProgressBar extends JApplet { Container container = null; JButton startButton, stopButton; JTextField inputTextField, outputTextField; JProgressBar pBar = null; Timer timer = null; static int sum = 0; static int counter = 0; public void init() { [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=37&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><b><font color="#008000">/*<br />
* &lt;Applet code=TJProgressBar width=400 height=100&gt;<br />
* &lt;/Applet&gt;<br />
*/</p>
<p>import javax.swing.*;<br />
import javax.swing.border.*;<br />
import java.awt.*;<br />
import java.awt.event.*;</p>
<p>public class TJProgressBar extends JApplet {<br />
Container container = null;<br />
JButton startButton, stopButton;<br />
JTextField inputTextField, outputTextField;<br />
JProgressBar pBar = null;<br />
Timer timer = null;</p>
<p>static int sum = 0;<br />
static int counter = 0;</p>
<p>public void init() {<br />
// 1. Get the handle on the content pane and<br />
//    assign the grid layout.<br />
container = this.getContentPane();<br />
container.setLayout(new GridLayout(3,1));</p>
<p>// 2. Add a horizontal box to the container.<br />
Box hbox1 = Box.createHorizontalBox();<br />
container.add(hbox1);</p>
<p>// 3. Add labels and input and output text fields<br />
//    to the horizontal box.<br />
hbox1.add(Box.createHorizontalGlue());<br />
JLabel label1 = new JLabel(&#8220;Sum of first &#8220;, JLabel.LEFT);<br />
label1.setFont(new Font(&#8220;Dialog&#8221;, Font.PLAIN, 15));<br />
hbox1.add(label1);</p>
<p>inputTextField = new JTextField(&#8220;100&#8243;, 4);<br />
hbox1.add(inputTextField);</p>
<p>JLabel label2 = new JLabel(&#8221; numbers is &#8220;, JLabel.LEFT);<br />
label2.setFont(new Font(&#8220;Dialog&#8221;, Font.PLAIN, 15));<br />
hbox1.add(label2);</p>
<p>outputTextField = new JTextField(10);<br />
hbox1.add(outputTextField);<br />
hbox1.add(Box.createHorizontalGlue());</p>
<p>// 4. Add another horizontal box to the container.<br />
Box hbox2 = Box.createHorizontalBox();<br />
container.add(hbox2);</p>
<p>// 5. Add Start and Stop buttons to the container.<br />
startButton = new JButton(&#8220;Start&#8221;);<br />
startButton.addActionListener(new ButtonListener());<br />
hbox2.add(Box.createHorizontalGlue());<br />
hbox2.add(startButton);<br />
hbox2.add(Box.createHorizontalGlue());<br />
stopButton = new JButton(&#8220;Stop&#8221;);<br />
stopButton.addActionListener(new ButtonListener());<br />
hbox2.add(Box.createHorizontalGlue());<br />
hbox2.add(stopButton);<br />
hbox2.add(Box.createHorizontalGlue());</p>
<p>// 6. Create and add a progress bar to the remaining<br />
//    display area.<br />
pBar = new JProgressBar();<br />
pBar.setStringPainted(true);<br />
Border border = BorderFactory.createLineBorder(Color.red, 2);<br />
pBar.setBorder(border);<br />
pBar.setBackground(Color.white);<br />
pBar.setForeground(Color.blue);<br />
pBar.setMinimum(0);</p>
<p>pBar.setMaximum(Integer.parseInt(inputTextField.getText()));<br />
container.add(pBar);</p>
<p>// 7. Create a timer object.<br />
timer = new Timer(0, new TimerListener());<br />
}</p>
<p>// 8. Timer listener that computes the sum of natural numbers,<br />
//    indicates the computation progress, and displays the result.<br />
class TimerListener implements ActionListener {<br />
public void actionPerformed(ActionEvent e) {<br />
if (Integer.parseInt(inputTextField.getText())&gt; 0){<br />
counter++;<br />
sum = sum+counter;<br />
pBar.setValue(counter);<br />
outputTextField.setText(Integer.toString(sum));<br />
}<br />
else {<br />
outputTextField.setText(&#8220;0&#8243;);<br />
}</p>
<p>if (counter &gt;= Integer.parseInt(inputTextField.getText()))<br />
timer.stop();<br />
}<br />
}</p>
<p>// 9. Button listener that actually starts or stops the<br />
//    process.<br />
class ButtonListener implements ActionListener {<br />
public void actionPerformed(ActionEvent e) {<br />
JButton button = (JButton) e.getSource();</p>
<p>if (button.getText() == &#8220;Start&#8221;) {<br />
outputTextField.setText(&#8220;&#8221;);<br />
if (inputTextField.getText() != &#8221; &#8220;) {<br />
pBar.setMaximum(Integer.parseInt(<br />
inputTextField.getText()));<br />
sum = 0;<br />
counter = 0;<br />
timer.start();<br />
}<br />
}<br />
else if (button.getText() == &#8220;Stop&#8221;) {<br />
timer.stop();<br />
outputTextField.setText(&#8220;&#8221;);<br />
sum = 0;<br />
counter = 0;<br />
pBar.setValue(0);<br />
}<br />
}<br />
}<br />
}</p>
<p></font></b></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=37&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/07/jprogressbar-sum-of-n-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Color Palatte In Java</title>
		<link>http://itphyogyi.wordpress.com/2008/02/07/color-palatte-in-java/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/07/color-palatte-in-java/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:39:48 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/2008/02/07/color-palatte-in-java/</guid>
		<description><![CDATA[import javax.swing.*; import java.awt.event.*; import java.awt.*; /*&#60;applet code=colour.class height=200 width=200&#62; &#60;/applet&#62;*/ public class colour extends JApplet implements ActionListener { JPanel p,p1; JButton b,b1,b2,b3; Checkbox c,c1; TextArea area; Color d=new Color(255,0,0); Color d1=new Color(0,255,0); Color d2=new Color(0,0,255); Color d3=new Color(255,177,76); GridLayout g; public void init() { p=new JPanel(); p1=new JPanel(); g=new GridLayout(2,2); p1.setLayout(g); b=new JButton(); b1=new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=36&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><b><font color="#0000ff">import javax.swing.*;<br />
import java.awt.event.*;<br />
import java.awt.*;</p>
<p>/*&lt;applet code=colour.class height=200 width=200&gt;<br />
&lt;/applet&gt;*/</p>
<p>public class colour extends JApplet implements ActionListener<br />
{<br />
JPanel p,p1;<br />
JButton b,b1,b2,b3;<br />
Checkbox c,c1;<br />
TextArea area;<br />
Color d=new Color(255,0,0);<br />
Color d1=new Color(0,255,0);<br />
Color d2=new Color(0,0,255);<br />
Color d3=new Color(255,177,76);<br />
GridLayout g;<br />
public void init()<br />
{<br />
p=new JPanel();<br />
p1=new JPanel();<br />
g=new GridLayout(2,2);<br />
p1.setLayout(g);<br />
b=new JButton();<br />
b1=new JButton();<br />
b2=new JButton();<br />
b3=new JButton();<br />
b.setBackground(d);<br />
b1.setBackground(d1);<br />
b2.setBackground(d2);<br />
b3.setBackground(d3);<br />
area=new TextArea(&#8221; Welcome To Colour Palate &#8220;,25,25);<br />
CheckboxGroup cbg=new CheckboxGroup();<br />
c=new Checkbox(&#8221; ForeGround &#8220;,cbg,true);<br />
c1=new Checkbox(&#8221; BackGround &#8220;,cbg,false);<br />
p.add(c);<br />
p.add(c1);<br />
p.add(area);<br />
p1.add(b);<br />
p1.add(b1);<br />
p1.add(b2);<br />
p1.add(b3);<br />
p.add(p1);<br />
getContentPane().add(p);<br />
b.addActionListener(this);<br />
b1.addActionListener(this);<br />
b2.addActionListener(this);<br />
b3.addActionListener(this);<br />
}<br />
public void actionPerformed(ActionEvent e)<br />
{<br />
Object obj=e.getSource();<br />
if(obj==b)<br />
{<br />
if(c.getState()==true)<br />
area.setForeground(d);<br />
else<br />
area.setBackground(d);<br />
}<br />
if(obj==b1)<br />
{<br />
if(c.getState()==true)<br />
area.setForeground(d1);<br />
else<br />
area.setBackground(d1);<br />
}<br />
if(obj==b2)<br />
{<br />
if(c.getState()==true)<br />
area.setForeground(d2);<br />
else<br />
area.setBackground(d2);<br />
}<br />
if(obj==b3)<br />
{<br />
if(c.getState()==true)<br />
area.setForeground(d3);<br />
else<br />
area.setBackground(d3);<br />
}<br />
}<br />
}</font></b></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=36&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/07/color-palatte-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
		<item>
		<title>First Come First Served</title>
		<link>http://itphyogyi.wordpress.com/2008/02/07/first-come-first-served/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/07/first-come-first-served/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:38:17 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/2008/02/07/first-come-first-served/</guid>
		<description><![CDATA[import javax.swing.*; import java.awt.*; import java.awt.event.*; class   fcfs  extends JFrame implements ActionListener {    JButton jb[] = new JButton[3];    JTextField  jt1[],jt2[];    JLabel  jl[],jl1,jl2,jl3;    JPanel  jp,jp1;    Container con;    int  k,p;    String str[] = {&#8220;SUBMIT&#8221;,&#8221;RESET&#8221;,&#8221;EXIT&#8221;};    String str1[] = {&#8220;Process&#8221;,&#8221;   AT&#8221;,&#8221;ST&#8221;,&#8221;WT&#8221;,&#8221;FT&#8221;,&#8221;TAT&#8221;,&#8221;NTAT&#8221;};    public fcfs()  {        super(&#8220;fcfs scheduling algoritham&#8221;);     con [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=35&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font color="#008000">import javax.swing.*;<br />
import java.awt.*;<br />
import java.awt.event.*;</font></p>
<p><font color="#008000">class   fcfs  extends JFrame implements ActionListener<br />
{<br />
   JButton jb[] = new JButton[3];<br />
   JTextField  jt1[],jt2[];<br />
   JLabel  jl[],jl1,jl2,jl3;<br />
   JPanel  jp,jp1;<br />
   Container con;<br />
   int  k,p;<br />
   String str[] = {&#8220;SUBMIT&#8221;,&#8221;RESET&#8221;,&#8221;EXIT&#8221;};<br />
   String str1[] = {&#8220;Process&#8221;,&#8221;   AT&#8221;,&#8221;ST&#8221;,&#8221;WT&#8221;,&#8221;FT&#8221;,&#8221;TAT&#8221;,&#8221;NTAT&#8221;};</font><br />
<font color="#008000">   public fcfs()<br />
 {<br />
       super(&#8220;fcfs scheduling algoritham&#8221;);<br />
    con = getContentPane();</font></p>
<p><font color="#008000">    k= Integer.parseInt(JOptionPane.showInputDialog(&#8220;Enter number of<br />
process&#8221;));</font></p>
<p><font color="#008000">    jl1 = new JLabel(&#8220;Process&#8221;);<br />
    jl2 = new JLabel(&#8220;Arival Time&#8221;);<br />
    jl3 = new JLabel(&#8220;Service Time&#8221;);</font></p>
<p><font color="#008000">    jl = new JLabel[k];<br />
       jt1 = new JTextField[k];<br />
    jt2 = new JTextField[k];</font><br />
<font color="#008000">       for(int i=0;i&lt;k;i++)<br />
  {<br />
     jl[i] = new JLabel(&#8220;process&#8221;+(i+1));<br />
     jt1[i]  = new JTextField(10);<br />
           jt2[i]  = new JTextField(10);<br />
    }</font></p>
<p><font color="#008000">   for(int i=0;i&lt;3;i++)<br />
 {<br />
    jb[i] = new JButton(str[i]);<br />
   }</font></p>
<p><font color="#008000">   con.setLayout(new  GridLayout(k+2,3));<br />
   con.add(jl1);<br />
   con.add(jl2);<br />
   con.add(jl3);</font></p>
<p><font color="#008000">   int l=0;</font></p>
<p><font color="#008000">   for(int i=0;i&lt;k;i++)<br />
  {<br />
            con.add(jl[l]);<br />
   con.add(jt1[l]);<br />
   con.add(jt2[l]);<br />
   l++;<br />
   }<br />
   l=0;<br />
   for(int i=0;i&lt;3;i++)<br />
  {<br />
    con.add(jb[l]);<br />
    jb[l].addActionListener(this);<br />
    l++;<br />
        }<br />
 }//end of constructor</font></p>
<p><font color="#008000"> public void actionPerformed(ActionEvent ae)<br />
 {<br />
  int FT[] = new int[k];<br />
    int WT[] = new int[k];<br />
  int TAT[] = new int[k];<br />
 float NTAT[] = new float[k];<br />
  float sum=0;<br />
        float avg;<br />
   JPanel main = new JPanel();<br />
   main.setLayout(new BorderLayout());<br />
   jp = new JPanel();<br />
   jp1 = new JPanel();<br />
   jp.setLayout(new GridLayout(k+1,7));<br />
   jp1.setLayout(new FlowLayout());</font></p>
<p><font color="#008000">  if(ae.getSource() == jb[2])<br />
        {<br />
   System.exit(0);<br />
     }<br />
   else if(ae.getSource() == jb[0])<br />
        {<br />
    FT[0] = Integer.parseInt(jt1[0].getText()) +<br />
Integer.parseInt(jt2[0].getText());</font></p>
<p><font color="#008000">    for(int i=0;i&lt;k;i++)<br />
   {<br />
     if(i==0)<br />
    {<br />
      WT[i] = 0;<br />
    }<br />
     else<br />
    {<br />
      if(FT[i-1] &lt; Integer.parseInt(jt1[i].getText()))<br />
     {<br />
       FT[i] =<br />
Integer.parseInt(jt1[i].getText())+Integer.parseInt(jt2[i].getText());<br />
       WT[i] = 0;<br />
     }<br />
     else<br />
     {<br />
      FT[i] = FT[i-1] + Integer.parseInt(jt2[i].getText());<br />
      WT[i] = FT[i-1] &#8211; Integer.parseInt(jt1[i].getText());<br />
     }</font></p>
<p><font color="#008000">                }<br />
    TAT[i] = WT[i]+Integer.parseInt(jt2[i].getText());<br />
    NTAT[i] = TAT[i]/(Integer.parseInt(jt2[i].getText()));<br />
    sum = sum+WT[i];</font><br />
<font color="#008000">   }//end for loop<br />
            for (int i=0;i&lt;7;i++ )<br />
            {<br />
     jp.add(new JLabel(str1[i]));<br />
            }<br />
   for (int i=0;i&lt;k;i++)<br />
   {<br />
     jp.add(new JLabel(&#8220;process&#8221;+(i+1)));<br />
     jp.add(new JLabel(&#8220;   &#8220;+Integer.parseInt(jt1[i].getText())));<br />
     jp.add(new JLabel(&#8220;&#8221;+Integer.parseInt(jt2[i].getText())));<br />
     jp.add(new JLabel(&#8220;&#8221;+WT[i]));<br />
     jp.add(new JLabel(&#8220;&#8221;+FT[i]));<br />
     jp.add(new JLabel(&#8220;&#8221;+TAT[i]));<br />
         jp.add(new JLabel(&#8220;&#8221;+NTAT[i]));</font><br />
<font color="#008000">   }<br />
   avg = sum/k;<br />
   String str2 = &#8220;Average Waiting Time is &#8220;+ avg;<br />
             jp1.add(new JLabel(str2));<br />
    main.add(jp,BorderLayout.NORTH);<br />
    main.add(jp1,BorderLayout.SOUTH);</font></p>
<p><font color="#008000">JOptionPane.showMessageDialog(null,main,&#8221;output&#8221;,JOptionPane.PLAIN_MESSAGE<br />
);</font></p>
<p><font color="#008000">        }<br />
  else if(ae.getSource() == jb[1])<br />
  {<br />
   setVisible(false);<br />
   fcfs  window = new fcfs();<br />
   window.setSize(400,300);<br />
   window.setVisible(true);<br />
   window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);</font></p>
<p><font color="#008000">  }<br />
 }//END ACTION PERFORMED</font></p>
<p><font color="#008000"> public static void main(String[] args)<br />
 {<br />
            fcfs  window = new fcfs();<br />
   window.setSize(400,300);<br />
   window.setVisible(true);<br />
   window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
 }//end main<br />
}//end class<br />
</font></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=35&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/07/first-come-first-served/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Drawing a simple graph using an applet</title>
		<link>http://itphyogyi.wordpress.com/2008/02/07/drawing-a-simple-graph-using-an-applet/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/07/drawing-a-simple-graph-using-an-applet/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:36:06 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/2008/02/07/drawing-a-simple-graph-using-an-applet/</guid>
		<description><![CDATA[import java.applet.*; import java.awt.*; public class hw0125 extends Applet { public void paint(Graphics g) { int newx,newy; // variables for x and y coordinates int k=0;       // flag variable int i=20;      // for incrementing the size of the lines int w = getSize().width ; // the width of the graphic space int h = getSize().height [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=34&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>import java.applet.*;<br />
import java.awt.*;</p>
<p>public class hw0125 extends Applet {</p>
<p>public void paint(Graphics g) {</p>
<p>int newx,newy; // variables for x and y coordinates<br />
int k=0;       // flag variable<br />
int i=20;      // for incrementing the size of the lines<br />
int w = getSize().width ; // the width of the graphic space<br />
int h = getSize().height ;// the height of the graphic space<br />
g.drawLine(w/2,h/2,w/2,h/2-10) ; //drawing the line<br />
g.drawLine(w/2,h/2-10,w/2-10,h/2-10) ;//drawing the line</p>
<p>int x=w/2-10; // x-coordinates<br />
int y=h/2-10; // y-coordinates</p>
<p>do{</p>
<p>if(k==0)   //k is used as a flag to know when to decrement the value<br />
newy = y+i;  //of the height and when to increment it.<br />
else<br />
newy = y-i;</p>
<p>//************************************************************************<br />
******</p>
<p>if(((h)-(newy-i) &lt;5))<br />
{g.drawLine(x,y,x,newy+10) ;<br />
break;}<br />
if(((h)-(newy+i) &lt;5))<br />
{g.drawLine(x,y,x,newy-10) ;<br />
break;}</p>
<p>if(((h)-newy &gt;=5)&amp;&amp;((w)-x&gt;=5)&amp;&amp;(x&gt;=5)&amp;&amp;(newy&gt;=5)) //stopping case for<br />
the graph<br />
g.drawLine(x,y,x,newy) ;<br />
else<br />
break;<br />
//************************************************************************<br />
******</p>
<p>if(k==0)    //k is the flag.<br />
newx=x+i;   //incrementing the width o<br />
else<br />
newx=x-i;   //decrementing the width<br />
//************************************************************************<br />
******</p>
<p>if(((w)-(newx-i) &lt;5))<br />
{ g.drawLine(x,newy,newx+10,newy) ;<br />
break; }<br />
if(((w)-(newx+i) &lt;5))<br />
{ g.drawLine(x,newy,newx-10,newy) ;<br />
break;}</p>
<p>if(((w)-newx&gt;=5)&amp;&amp;((h)-newy&gt;=5)&amp;&amp;(newx&gt;=5)&amp;&amp;(newy&gt;=5))<br />
g.drawLine(x,newy,newx,newy) ;<br />
else<br />
break;<br />
//************************************************************************<br />
******<br />
if(k==0)  //each time the flag k is changed to it&#8217;s opposite value<br />
k=1;    //coz we need to increment once and then to decrement<br />
else<br />
k=0;</p>
<p>//************************************************************************<br />
******<br />
x=newx;  //storing the new x-coordinates<br />
y=newy;  //storing the old x-coordinates<br />
i=i+10;</p>
<p>}while(i!=10); //dummy case!!! will never happen&#8230;the stopping case<br />
are inside the loop.</p>
<p>}<br />
}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=34&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/07/drawing-a-simple-graph-using-an-applet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Dxball game demo (mini project)</title>
		<link>http://itphyogyi.wordpress.com/2008/02/07/dxball-game-demo-mini-project/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/07/dxball-game-demo-mini-project/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:34:09 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/?p=33</guid>
		<description><![CDATA[import java.awt.*; import java.awt.event.*; import java.applet.*; import javax.swing.*; import javax.swing.event.*; /* &#60;applet code=&#8221;Dxball1.class&#8221; width=670 height=300&#62; &#60;/applet&#62; */ public class Dxball1 extends Applet implements Runnable,KeyListener,MouseListener { Thread th; static    Rectangle ob[] = new Rectangle[30]; Ball ball; Bar bar; Message mes; int i,j; int x = 1; int y=1; int z = 0; int xx,yy1,zz; int b,b1; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=33&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>import java.awt.*;<br />
import java.awt.event.*;<br />
import java.applet.*;<br />
import javax.swing.*;<br />
import javax.swing.event.*;</p>
<p>/*<br />
&lt;applet code=&#8221;Dxball1.class&#8221; width=670 height=300&gt;<br />
&lt;/applet&gt;<br />
*/<br />
public class Dxball1 extends Applet implements<br />
Runnable,KeyListener,MouseListener<br />
{<br />
Thread th;<br />
static    Rectangle ob[] = new Rectangle[30];<br />
Ball ball;<br />
Bar bar;<br />
Message mes;<br />
int i,j;<br />
int x = 1;<br />
int y=1;<br />
int z = 0;<br />
int xx,yy1,zz;<br />
int b,b1;<br />
int flag;<br />
//static int yy=0;<br />
boolean runing=true;<br />
Image dbimage;<br />
Graphics dbg;<br />
int c1,c2,c3,c4;<br />
int flagg=1;<br />
//int ballCheck=0;<br />
String ss = &#8220;&#8221;;<br />
String ss1=&#8221;";<br />
String me = &#8220;&#8221;;<br />
static int score = 0;</p>
<p>static Font ff;<br />
TextArea ta;</p>
<p>public void start()<br />
{<br />
th = new Thread(this);<br />
runing = false;<br />
//th.start();<br />
}<br />
public void stop()<br />
{</p>
<p>runing = true;<br />
th = null;<br />
}<br />
public void run()<br />
{</p>
<p>for(; <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
{<br />
if(ball.over())<br />
{<br />
ss = &#8220;Game Over!!!!!&#8221;;<br />
ss1 = &#8220;You have loss the game&#8221;;<br />
repaint();<br />
System.out.print(&#8220;braek&#8221;);<br />
break;</p>
<p>}<br />
try<br />
{    Thread.sleep(20);<br />
if(runing)break;</p>
<p>int tempx=Ball.flagx;<br />
int tempy=Ball.flagy;<br />
if (tempx==1)<br />
ball.move();</p>
<p>else<br />
ball.move1();<br />
if(tempy==1)<br />
ball.move2();<br />
else<br />
ball.move3();<br />
if(tempy==1)<br />
ball.move();<br />
else<br />
ball.move3();</p>
<p>repaint();</p>
<p>}</p>
<p>catch(InterruptedException ie)<br />
{<br />
ie.printStackTrace();<br />
}<br />
}<br />
}<br />
public void init()<br />
{<br />
/*me =&#8221;<br />
THIS IS A DXBALL GAME.</p>
<p>&#8220;+<br />
&#8220;<br />
This Game is Devlopped by<br />
Md.Mujibur Rahman<br />
&#8220;+<br />
&#8221; University of DIU<br />
BATCH 9th ROLL 9007<br />
&#8220;+<br />
&#8221; Created by Mujibur&#8217;s Group<br />
&#8220;+<br />
&#8220;<br />
HOW TO PLAY<br />
&#8220;+<br />
&#8220;<br />
Level 1:</p>
<p>First You press mouse<br />
&#8220;+<br />
&#8220;when you press mouse the the ball is moved<br />
&#8220;+<br />
&#8220;Then Score will be increase<br />
&#8220;+<br />
&#8220;<br />
Control the bar for using left arrow and right arrow<br />
&#8220;+<br />
&#8220;the  Ball moved Randomly<br />
&#8220;+<br />
&#8220;If the ball hits the Rectangle<br />
&#8220;+<br />
&#8220;Then Score will Increase<br />
&#8220;+<br />
&#8220;if the ball is passed the bar level<br />
&#8220;+<br />
&#8220;Game will be over and Game is finished&#8221;;</p>
<p>setLayout(null);<br />
ta = new TextArea(me);<br />
ta.setBounds(470,120,150,150);<br />
ta.setEditable(false);<br />
add(ta);*/<br />
int xx=30,mm=30;<br />
for(int i =0 ;i&lt;24;i=i+3)<br />
{<br />
ob[i] = new Rectangle(xx,mm);<br />
ob[i].display=true;<br />
mm=mm+20;<br />
ob[i+1] = new Rectangle(xx,mm);<br />
ob[i+1].display=true;<br />
mm=mm+20;<br />
ob[i+2] = new Rectangle(xx,mm);<br />
ob[i+2].display=true;<br />
xx=xx+50;<br />
mm = 30;</p>
<p>}</p>
<p>mes =new Message();</p>
<p>ball = new Ball(90,250);<br />
bar = new Bar(70);</p>
<p>ff = new Font(&#8220;arial&#8221;,Font.BOLD,20);</p>
<p>this.addKeyListener(this);<br />
this.addMouseListener(this);<br />
}</p>
<p>public void paint(Graphics g)<br />
{</p>
<p>int count=0;<br />
for(int i=0;i&lt;24;i++)<br />
{<br />
if(ob[i].display==false)<br />
count++;<br />
}<br />
if(count==24)<br />
{<br />
mes.mess(g);<br />
return;<br />
}<br />
g.setFont(new Font(&#8220;arial&#8221;,Font.PLAIN,15));<br />
g.setColor(Color.gray);<br />
g.fillRect(470,30,150,70);<br />
g.setColor(Color.blue);<br />
g.drawString(&#8220;Score:  &#8220;+score,480,50);<br />
g.drawString(&#8220;Status:&#8221;+Ball.over,480,70);<br />
g.drawString(&#8220;Life:  &#8220;+Ball.life,480,90);<br />
//g.drawString(&#8220;&#8221;+Bar.yy,455,50);<br />
g.setColor(Color.black);<br />
g.fillRect(20,20,410,300);<br />
g.setColor(Color.red);<br />
g.setFont(ff);<br />
g.drawString(ss,100,200);<br />
g.drawString(ss1,100,230);<br />
g.setColor(Color.red);<br />
for(int j = 0;j&lt;24;j++)<br />
{<br />
if(ob[j].display==false)<br />
{<br />
continue;<br />
}<br />
System.out.print(&#8220;<br />
check   false  :  &#8220;+ob[j].display);<br />
if(ob[j].display==true)<br />
{<br />
breaking(j) ;</p>
<p>}<br />
if(ob[j].display==true)<br />
ob[j].ppaint(g);</p>
<p>}</p>
<p>ball.bpaint(g);<br />
bar.barpaint(g);</p>
<p>}</p>
<p>public void keyTyped(KeyEvent k)<br />
{<br />
}<br />
public void keyReleased(KeyEvent k)<br />
{</p>
<p>}</p>
<p>public void  keyPressed(KeyEvent k)<br />
{<br />
int R =k.getKeyCode();<br />
if(R==k.VK_LEFT)<br />
{<br />
if(bar.yy &gt; 25)<br />
bar.yy=bar.yy-10;<br />
System.out.println(&#8220;Left&#8221;);<br />
repaint();</p>
<p>}<br />
if(R==k.VK_RIGHT)<br />
{<br />
if(bar.yy &lt; 365 )<br />
{<br />
bar.yy=bar.yy+10;<br />
}<br />
System.out.println(&#8220;Right&#8221;);<br />
repaint();</p>
<p>}</p>
<p>}<br />
public void mousePressed(MouseEvent me)<br />
{<br />
th.start();<br />
}<br />
public void mouseReleased(MouseEvent me)<br />
{</p>
<p>}<br />
public void mouseClicked(MouseEvent me)<br />
{</p>
<p>}<br />
public void mouseExited(MouseEvent me)<br />
{</p>
<p>}<br />
public void mouseEntered(MouseEvent me)<br />
{<br />
}<br />
public void update(Graphics g) //to remove flickering<br />
{<br />
if (dbimage==null)<br />
{<br />
dbimage=createImage(this.getSize().width,this.getSize().height);<br />
dbg=dbimage.getGraphics();<br />
}<br />
dbg.setColor(getBackground());<br />
dbg.fillRect(0,0,this.getSize().width,this.getSize().height);<br />
dbg.setColor(getForeground());<br />
paint(dbg);<br />
g.drawImage(dbimage,0,0,this);</p>
<p>}</p>
<p>public boolean breaking(int i)<br />
{<br />
if(check(i))<br />
return true;<br />
else<br />
return false;</p>
<p>}<br />
public boolean check(int i)<br />
{<br />
int am,ami;<br />
am = Math.abs(ball.x1-ob[i].x);<br />
ami = Math.abs(ball.y1-ob[i].y);<br />
if(am&lt;20 &amp;&amp; ami&lt;20 )<br />
{<br />
ob[i].display=false;<br />
score=score+10;<br />
Ball.flagy=1;<br />
return true;</p>
<p>}<br />
else<br />
{</p>
<p>return false;</p>
<p>}</p>
<p>}</p>
<p>} //Class main is end</p>
<p>class Rectangle<br />
{<br />
int i;<br />
int x,y;<br />
Graphics g;<br />
int ballCheck=0;<br />
boolean display;<br />
Rectangle(int m ,int n)<br />
{</p>
<p>x = m;<br />
y =n;<br />
}<br />
public void ppaint(Graphics g)<br />
{<br />
g.fillRect(x,y,40,10);</p>
<p>}</p>
<p>}</p>
<p>class Ball<br />
{<br />
static int flag=3;<br />
static int flagx=1;<br />
static int flagy=2;<br />
static int Point = 0;<br />
static String over=&#8221;";<br />
static int life=1;<br />
int x,y,m;<br />
int x1,y1;<br />
Graphics g;<br />
Ball(int a1,int a2)<br />
{<br />
x1 = a1;<br />
y1 = a2;<br />
}<br />
public void bpaint(Graphics g)<br />
{<br />
//g.drawString(&#8220;  y : &#8220;+y1,455,250);<br />
if(20&gt;=x1||x1&gt;=410||y1&lt;=20||y1&gt;=260)   //checking boundaries<br />
{</p>
<p>getflag();<br />
}<br />
g.setColor(Color.white);<br />
g.fillOval(x1,y1,15,15);</p>
<p>}<br />
public boolean over()<br />
{<br />
//System.out.println(&#8220;&#8221;+y1);<br />
if(y1&gt;290)<br />
return true;<br />
else<br />
return false;<br />
}<br />
public void move()<br />
{<br />
x1++;</p>
<p>}<br />
public void move1()<br />
{<br />
x1&#8211;;</p>
<p>}<br />
public void move2()<br />
{<br />
y1=y1+2;<br />
}<br />
public void move3()<br />
{<br />
y1=y1-2;<br />
}</p>
<p>public void move4()<br />
{<br />
x1++;<br />
y1&#8211;;<br />
}</p>
<p>public void getflag()<br />
{</p>
<p>if(x1&lt;=20)  // check boundaries and ball motion<br />
{<br />
x1=20;<br />
flagx=1;<br />
}<br />
if(x1&gt;=410)<br />
{<br />
x1=410;<br />
flagx=2;<br />
}<br />
if(y1&lt;=20)<br />
{<br />
y1=20;<br />
Point = Point +10;<br />
flagy=1;<br />
}<br />
if(y1&gt;=260)<br />
{<br />
if(Bar.yy&gt;=x1||x1&lt;=(Bar.yy+50))<br />
{<br />
System.out.print(&#8220;/n /n true Bar.yy :&#8221;+Bar.yy+&#8221;<br />
Y1:&#8221;+y1);<br />
System.out.print(&#8221; /n/n/n/ncheck ok&#8221;);<br />
y1=260;<br />
flagy=2;<br />
}<br />
else<br />
{<br />
System.out.print(&#8220;/n /n falseBar.yy :&#8221;+Bar.yy+&#8221;<br />
Y1:&#8221;+y1);<br />
if(Bar.yy&gt;260 &amp;&amp; Bar.yy&lt;200)<br />
{<br />
flag=2;<br />
System.out.print(&#8220;/n game over&#8221;);<br />
}<br />
else<br />
{<br />
if(Bar.yy&gt;290)<br />
{<br />
}<br />
else<br />
{<br />
life=0;<br />
System.out.print(Bar.yy);</p>
<p>over=&#8221;LOSS GAME&#8221;;<br />
}<br />
}</p>
<p>} //else1 end<br />
}</p>
<p>}</p>
<p>}//end class</p>
<p>class Bar<br />
{<br />
int ss;<br />
static int yy=0;<br />
int q;<br />
static int pp;<br />
Bar(int a)<br />
{<br />
yy=a+yy;<br />
}<br />
public void barpaint(Graphics g)<br />
{<br />
g.setColor(Color.gray);<br />
g.fillRect(yy,270,60,10);</p>
<p>}<br />
}</p>
<p>class Message<br />
{<br />
public void mess(Graphics g)<br />
{<br />
g.setColor(Color.black);<br />
g.fillRect(0,0,400,300);<br />
g.setColor(Color.red);<br />
g.setFont(Dxball1.ff);<br />
g.drawString(&#8220;YOU HAVE WON THE GAME&#8221;,160,180);<br />
g.drawString(&#8220;Your Score is:&#8221;+Dxball1.score,160,200);</p>
<p>}<br />
}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=33&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/07/dxball-game-demo-mini-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Payroll Management System</title>
		<link>http://itphyogyi.wordpress.com/2008/02/07/payroll-management-system/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/07/payroll-management-system/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:30:30 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/2008/02/07/payroll-management-system/</guid>
		<description><![CDATA[import java.io.*; import java.awt.*; import java.awt.Color.*; import java.awt.event.*; import java.applet.*; /*&#60;applet code=train2.class height=300 width=600&#62;&#60;/applet&#62;*/ public class train2 extends Applet implements ActionListener,ItemListener { Label name,amount,seats,number; TextField na,am,sts,nr; TextArea t; Choice css; Checkbox si,sr; CheckboxGroup g; Button b,cancel; int s,c,d; int n1=400; int n2=250; int n3=100; public void init() { setBackground(Color.yellow); setForeground(Color.red); setLayout(new FlowLayout()); na=new TextField(20); am=new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=32&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>import java.io.*;<br />
import java.awt.*;<br />
import java.awt.Color.*;<br />
import java.awt.event.*;<br />
import java.applet.*;</p>
<p>/*&lt;applet code=train2.class height=300 width=600&gt;&lt;/applet&gt;*/</p>
<p>public class train2 extends Applet implements<br />
ActionListener,ItemListener</p>
<p>{<br />
Label name,amount,seats,number;<br />
TextField na,am,sts,nr;<br />
TextArea t;<br />
Choice css;</p>
<p>Checkbox si,sr;<br />
CheckboxGroup g;</p>
<p>Button b,cancel;<br />
int s,c,d;<br />
int n1=400;<br />
int n2=250;<br />
int n3=100;</p>
<p>public void init()<br />
{<br />
setBackground(Color.yellow);<br />
setForeground(Color.red);<br />
setLayout(new FlowLayout());</p>
<p>na=new TextField(20);<br />
am=new TextField(20);<br />
sts=new TextField(20);<br />
nr=new TextField(20);</p>
<p>name=new Label(&#8220;NAME&#8221;);<br />
amount=new Label(&#8220;AMOUNT&#8221;);<br />
seats=new Label(&#8220;SEATS&#8221;);<br />
number=new Label(&#8220;REQUIRED NO OF SEATS&#8221;);</p>
<p>css=new Choice();<br />
css.add(&#8220;A.C SLEEPER&#8221;);<br />
css.add(&#8220;FIRST CLASS&#8221;);<br />
css.add(&#8220;SECOND CLASS&#8221;);</p>
<p>t=new TextArea(40,45);</p>
<p>g=new CheckboxGroup();<br />
si=new Checkbox(&#8220;SATAPTI&#8221;,g,false);<br />
sr=new Checkbox(&#8220;SABARI&#8221;,g,false);</p>
<p>b=new Button(&#8220;SUBMIT&#8221;);<br />
cancel=new Button(&#8220;CANCEL&#8221;);</p>
<p>add(name);<br />
add(na);</p>
<p>add(seats);<br />
add(sts);</p>
<p>add(number);<br />
add(nr);</p>
<p>add(si);<br />
add(sr);</p>
<p>add(css);</p>
<p>add(b);</p>
<p>add(amount);<br />
add(am);</p>
<p>add(t);<br />
add(cancel);</p>
<p>css.addItemListener(this);<br />
b.addActionListener(this);<br />
si.addItemListener (this);<br />
sr.addItemListener (this);</p>
<p>}<br />
public void actionPerformed(ActionEvent ae)<br />
{</p>
<p>if(b.getActionCommand().equals(&#8220;SUBMIT&#8221;))<br />
{<br />
d=Integer.parseInt(nr.getText());<br />
s=(Integer.parseInt(sts.getText()))-d;</p>
<p>if(css.getSelectedItem().equals(&#8220;A.C SLEEPER&#8221;))<br />
{<br />
am.setText(&#8220;400&#8243;);<br />
}<br />
else if(css.getSelectedItem().equals(&#8220;FIRST CLASS&#8221;))<br />
{<br />
am.setText(&#8220;250&#8243;);<br />
}<br />
else<br />
{<br />
am.setText(&#8220;100&#8243;);<br />
}</p>
<p>}</p>
<p>c=((Integer.parseInt(am.getText()))*(Integer.parseInt(nr.getText())));<br />
t.setText(&#8220;NAME:&#8221;+na.getText()+&#8221;<br />
&#8220;+&#8221;After reservation total no.of<br />
seats are:&#8221;<br />
+s+&#8221;<br />
&#8220;+&#8221;Train name<br />
:&#8221;+g.getSelectedCheckbox().getLabel()+&#8221;<br />
&#8220;+&#8221;Class:&#8221;+<br />
css.getSelectedItem()+    &#8220;Total number of Rs :&#8221;+c);</p>
<p>if(cancel.getActionCommand().equals(&#8220;CANCEL&#8221;))<br />
{<br />
repaint();<br />
}</p>
<p>}</p>
<p>public void itemStateChanged(ItemEvent ie)<br />
{</p>
<p>}</p>
<p>}</p>
<p>import java.io.*;<br />
import java.awt.*;<br />
import java.awt.Color.*;<br />
import java.awt.event.*;<br />
import java.applet.*;</p>
<p>/*&lt;applet code=train2.class height=300 width=600&gt;&lt;/applet&gt;*/</p>
<p>public class train2 extends Applet implements<br />
ActionListener,ItemListener</p>
<p>{<br />
Label name,amount,seats,number;<br />
TextField na,am,sts,nr;<br />
TextArea t;<br />
Choice css;</p>
<p>Checkbox si,sr;<br />
CheckboxGroup g;</p>
<p>Button b,cancel;<br />
int s,c,d;<br />
int n1=400;<br />
int n2=250;<br />
int n3=100;</p>
<p>public void init()<br />
{<br />
setBackground(Color.yellow);<br />
setForeground(Color.red);<br />
setLayout(new FlowLayout());</p>
<p>na=new TextField(20);<br />
am=new TextField(20);<br />
sts=new TextField(20);<br />
nr=new TextField(20);</p>
<p>name=new Label(&#8220;NAME&#8221;);<br />
amount=new Label(&#8220;AMOUNT&#8221;);<br />
seats=new Label(&#8220;SEATS&#8221;);<br />
number=new Label(&#8220;REQUIRED NO OF SEATS&#8221;);</p>
<p>css=new Choice();<br />
css.add(&#8220;A.C SLEEPER&#8221;);<br />
css.add(&#8220;FIRST CLASS&#8221;);<br />
css.add(&#8220;SECOND CLASS&#8221;);</p>
<p>t=new TextArea(40,45);</p>
<p>g=new CheckboxGroup();<br />
si=new Checkbox(&#8220;SATAPTI&#8221;,g,false);<br />
sr=new Checkbox(&#8220;SABARI&#8221;,g,false);</p>
<p>b=new Button(&#8220;SUBMIT&#8221;);<br />
cancel=new Button(&#8220;CANCEL&#8221;);</p>
<p>add(name);<br />
add(na);</p>
<p>add(seats);<br />
add(sts);</p>
<p>add(number);<br />
add(nr);</p>
<p>add(si);<br />
add(sr);</p>
<p>add(css);</p>
<p>add(b);</p>
<p>add(amount);<br />
add(am);</p>
<p>add(t);<br />
add(cancel);</p>
<p>css.addItemListener(this);<br />
b.addActionListener(this);<br />
si.addItemListener (this);<br />
sr.addItemListener (this);</p>
<p>}<br />
public void actionPerformed(ActionEvent ae)<br />
{</p>
<p>if(b.getActionCommand().equals(&#8220;SUBMIT&#8221;))<br />
{<br />
d=Integer.parseInt(nr.getText());<br />
s=(Integer.parseInt(sts.getText()))-d;</p>
<p>if(css.getSelectedItem().equals(&#8220;A.C SLEEPER&#8221;))<br />
{<br />
am.setText(&#8220;400&#8243;);<br />
}<br />
else if(css.getSelectedItem().equals(&#8220;FIRST CLASS&#8221;))<br />
{<br />
am.setText(&#8220;250&#8243;);<br />
}<br />
else<br />
{<br />
am.setText(&#8220;100&#8243;);<br />
}</p>
<p>}</p>
<p>c=((Integer.parseInt(am.getText()))*(Integer.parseInt(nr.getText())));<br />
t.setText(&#8220;NAME:&#8221;+na.getText()+&#8221;<br />
&#8220;+&#8221;After reservation total no.of<br />
seats are:&#8221;<br />
+s+&#8221;<br />
&#8220;+&#8221;Train name<br />
:&#8221;+g.getSelectedCheckbox().getLabel()+&#8221;<br />
&#8220;+&#8221;Class:&#8221;+<br />
css.getSelectedItem()+    &#8220;Total number of Rs :&#8221;+c);</p>
<p>if(cancel.getActionCommand().equals(&#8220;CANCEL&#8221;))<br />
{<br />
repaint();<br />
}</p>
<p>}</p>
<p>public void itemStateChanged(ItemEvent ie)<br />
{</p>
<p>}</p>
<p>}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=32&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/07/payroll-management-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Database Conversion</title>
		<link>http://itphyogyi.wordpress.com/2008/02/07/database-conversion/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/07/database-conversion/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:27:51 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/2008/02/07/database-conversion/</guid>
		<description><![CDATA[import java.io.*; import java.util.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql.*; import javax.swing.filechooser.*; import javax.swing.table.*; import javax.swing.event.*; import java.sql.DatabaseMetaData.*; import java.lang.String.*; import java.util.Map.*; class FieldInfo {  public String  Name;  public String  Type;  public int Size;  public int Precision;  public int Scale;  public boolean Primary;  public boolean Unique;  public boolean  AllowNull; public String toString() { return &#8220;[ " + Name [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=31&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>import java.io.*;<br />
import java.util.*;<br />
import java.awt.*;<br />
import javax.swing.*;<br />
import java.awt.event.*;<br />
import java.sql.*;<br />
import javax.swing.filechooser.*;<br />
import javax.swing.table.*;<br />
import javax.swing.event.*;<br />
import java.sql.DatabaseMetaData.*;<br />
import java.lang.String.*;<br />
import java.util.Map.*;</p>
<p><font color="#0000ff">class FieldInfo<br />
{<br />
 public String  Name;<br />
 public String  Type;<br />
 public int Size;<br />
 public int Precision;<br />
 public int Scale;<br />
 public boolean Primary;<br />
 public boolean Unique;<br />
 public boolean  AllowNull;</font></p>
<p><font color="#0000ff">public String toString()<br />
{<br />
return &#8220;[ " + Name + ", " + Type + ", " + Size + ", " + Precision + ", "<br />
+     Scale + ", " + Primary + ", " + Unique + ", " + AllowNull + " ]&#8220;;<br />
}<br />
}</font></p>
<p><font color="#0000ff">public class DataMigration</font></p>
<p><font color="#0000ff">{</font><br />
<font color="#0000ff">         String s2[][];<br />
          int col,p,j1;</font></p>
<p><font color="#0000ff"> /*String strTypeName[] = {<br />
&#8220;GUID&#8221;, &#8220;BIT&#8221;, &#8220;BYTE&#8221;, &#8220;LONGBINARY&#8221;, &#8220;VARBINARY&#8221;, &#8220;BINARY&#8221;, &#8220;LONGCHAR&#8221;,<br />
&#8220;CHAR&#8221;, &#8220;CURRENCY&#8221;, &#8220;INTEGER&#8221;, &#8220;COUNTER&#8221;, &#8220;SMALLINT&#8221;, &#8220;REAL&#8221;, &#8220;DOUBLE&#8221;,<br />
 &#8221;DATETIME&#8221;, &#8220;VARCHAR&#8221;<br />
};</font></p>
<p><font color="#0000ff">private static String strSQLServerType[] = {<br />
&#8220;UNIQUEIDENTIFIER&#8221;, &#8220;BIT&#8221;, &#8220;TINYINT&#8221;, &#8220;VARBINARY&#8221;, &#8220;VARBINARY&#8221;, &#8220;VARBINARY&#8221;, &#8220;VARBINARY&#8221;,<br />
 &#8221;CHAR&#8221;, &#8220;MONEY&#8221;, &#8220;INT&#8221;, &#8220;INT&#8221;, &#8220;SMALLINT&#8221;, &#8220;REAL&#8221;, &#8220;DECIMAL&#8221;, &#8220;SMALLDATETIME&#8221;, &#8220;VARCHAR&#8221;<br />
};</font></p>
<p><font color="#0000ff">private static String strOracleType[] = {<br />
&#8220;UROWID&#8221;, &#8220;CHAR&#8221;, &#8220;NUMBER&#8221;, &#8220;BLOB&#8221;, &#8220;BLOB&#8221;, &#8220;BLOB&#8221;, &#8220;LONG&#8221;,<br />
&#8220;CHAR&#8221;, &#8220;NUMBER&#8221;, &#8220;NUMBER&#8221;, &#8220;NUMBER&#8221;, &#8220;NUMBER&#8221;, &#8220;NUMBER&#8221;, &#8220;NUMBER&#8221;,<br />
&#8220;DATE&#8221;, &#8220;VARCHAR2&#8243;<br />
};*/</font></p>
<p><font color="#0000ff"> LinkedList _fieldList = null;</font><br />
<font color="#0000ff">public LinkedList getFieldInfoList(String strTable, Connection<br />
conn,String strDestDSN,String strDestUser, String strDestPwd)<br />
{<br />
_fieldList = new LinkedList();</font><br />
<font color="#0000ff">try<br />
{<br />
DatabaseMetaData dbmd = conn.getMetaData();<br />
ResultSet rsIndex = dbmd.getIndexInfo(null, null, strTable, true, false);</font><br />
<font color="#0000ff"> ArrayList arrIndexColumn = new ArrayList();<br />
 ArrayList arrIndexName = new ArrayList();</font></p>
<p><font color="#0000ff"> while( rsIndex.next() )<br />
 {<br />
 String str = rsIndex.getString(&#8220;COLUMN_NAME&#8221;);<br />
 if( str == null ) str = &#8220;&#8221;;<br />
 arrIndexColumn.add(str);<br />
 str = rsIndex.getString(&#8220;INDEX_NAME&#8221;);<br />
 if( str == null ) str = &#8220;&#8221;;<br />
 arrIndexName.add(str);<br />
 }</font></p>
<p><font color="#0000ff"> rsIndex.close();</font></p>
<p><font color="#0000ff">                        Statement stmt = conn.createStatement();<br />
 ResultSet rs = stmt.executeQuery(&#8220;SELECT * FROM &#8221; + strTable);<br />
                        ResultSetMetaData rsmd = rs.getMetaData();<br />
                        col = rsmd.getColumnCount();</font></p>
<p><font color="#0000ff">                        String s1[] =new String[col];<br />
                        String s2[][]=new String[col][col];<br />
 int j=0,n=1,ij=0,l1=1;</font></p>
<p><font color="#0000ff"></font></p>
<p><font color="#0000ff">            while(rs.next())<br />
          {<br />
            for(p=0;p&lt;col;p++)<br />
            {<br />
            s2[j][p]=rs.getString(n);<br />
            n++;<br />
            }<br />
            n=1;<br />
            j++;<br />
         }</font><br />
<font color="#0000ff">                        for(int i = 1; i&lt; col; i++)<br />
 {<br />
 FieldInfo info = new FieldInfo();<br />
 info.Name=rsmd.getColumnName(i);<br />
                                info.Type=rsmd.getColumnTypeName(i);<br />
 info.Size=rsmd.getColumnDisplaySize(i);<br />
 info.Precision = rsmd.getPrecision(i);<br />
 info.Scale = rsmd.getScale(i);<br />
 info.Primary = false;<br />
 info.Unique = false;<br />
 info.AllowNull = (rsmd.isNullable(i) == ResultSetMetaData.columnNullable);</font></p>
<p><font color="#0000ff"> for(int k = 0; k &lt; arrIndexColumn.size(); k++)<br />
 {<br />
 String s = arrIndexColumn.get(k).toString();<br />
 if( s.equals(info.Name) )<br />
 {<br />
 info.Unique = true;<br />
 break;<br />
 }<br />
 }</font></p>
<p><font color="#0000ff"></font></p>
<p><font color="#0000ff"> _fieldList.add(info);<br />
 }</font><br />
<font color="#0000ff">String ss=&#8221;insert into &#8220;+ strTable +&#8221; values (?,?,?)&#8221;;</font></p>
<p><font color="#0000ff">Connection connDest = DriverManager.getConnection(&#8220;jdbc:odbc:&#8221; + strDestDSN, strDestUser, strDestPwd);<br />
PreparedStatement p = connDest.prepareStatement(ss);</font></p>
<p><font color="#0000ff">   for(int p1=0;p1&lt;3;p1++)<br />
 {<br />
       p.setString(1,s2[p1][0]);<br />
       p.setString(2,s2[p1][1]);<br />
       p.setString(3,s2[p1][2]);<br />
       if( p.executeUpdate()==0){System.out.println(&#8220;Wrong&#8221;);}</font></p>
<p><font color="#0000ff">  }</font></p>
<p><font color="#0000ff">}<br />
 catch(Exception ex)<br />
 {<br />
 System.out.println(ex.toString());<br />
 _fieldList.clear();<br />
 }<br />
System.out.println(&#8220;ravi&#8221;);<br />
return _fieldList;</font></p>
<p><font color="#0000ff"> }</font><br />
<font color="#0000ff"> public String getFieldDesc(FieldInfo fi, String strToDB)<br />
 {<br />
 String str = &#8220;&#8221;;</font></p>
<p><font color="#0000ff"> try<br />
 {<br />
 String s2 = new String(fi.Name);<br />
 s2 = s2.replace(&#8216; &#8216;, &#8216;_&#8217;);<br />
 str = s2 + &#8221; &#8220;;<br />
 String s = fi.Type.trim().toUpperCase();</font></p>
<p><font color="#0000ff"> if( s.equals(&#8220;GUID&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; UNIQUEIDENTIFIER &#8220;;<br />
 else<br />
 str += &#8221; UROWID &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;BIT&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; BIT &#8220;;<br />
 else<br />
 str += &#8221; CHAR(1) &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;BYTE&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; TINYINT &#8220;;<br />
 else<br />
 str += &#8221; NUMBER &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;LONGBINARY&#8221;) )<br />
 {<br />
 fi.Size = (fi.Size &lt; 0 || fi.Size &gt; 1000) ? 1000 : fi.Size;<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; VARBINARY(&#8221; + fi.Size + &#8220;) &#8220;;<br />
 else<br />
 str += &#8221; BLOB(&#8221; + fi.Size + &#8220;) &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;VARBINARY&#8221;) )<br />
 {<br />
 fi.Size = (fi.Size &lt; 0 || fi.Size &gt; 1000) ? 1000 : fi.Size;<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; VARBINARY(&#8221; + fi.Size + &#8220;) &#8220;;<br />
 else<br />
 str += &#8221; BLOB(&#8221; + fi.Size + &#8220;) &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;BINARY&#8221;) )<br />
 {<br />
 fi.Size = (fi.Size &lt; 0 || fi.Size &gt; 1000) ? 1000 : fi.Size;<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; VARBINARY(&#8221; + fi.Size + &#8220;) &#8220;;<br />
 else<br />
 str += &#8221; BLOB(&#8221; + fi.Size + &#8220;)&#8221;;<br />
 }<br />
 else if( s.equals(&#8220;LONGCHAR&#8221;) )<br />
 {<br />
 fi.Size = (fi.Size &lt; 0 || fi.Size &gt; 1000) ? 1000 : fi.Size;<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; VARBINARY(&#8221; + fi.Size + &#8220;) &#8220;;<br />
 else<br />
 str += &#8221; LONG(&#8221; + fi.Size + &#8220;)&#8221;;<br />
 }<br />
 else if( s.equals(&#8220;CHAR&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; CHAR(1) &#8220;;<br />
 else<br />
 str += &#8221; CHAR(1) &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;CURRENCY&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; CURRENCY &#8220;;<br />
 else<br />
 str += &#8221; NUMBER &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;INTEGER&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; INT &#8220;;<br />
 else<br />
 str += &#8221; NUMBER(10) &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;COUNTER&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; INT &#8220;;<br />
 else<br />
 str += &#8221; NUMBER(10) &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;SMALLINT&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; INT &#8220;;<br />
 else<br />
 str += &#8221; NUMBER(5) &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;REAL&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; REAL &#8220;;<br />
 else<br />
 str += &#8221; NUMBER &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;DOUBLE&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; DECIMAL &#8220;;<br />
 else<br />
 str += &#8221; NUMBER &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;DATETIME&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; SMALLDATETIME &#8220;;<br />
 else<br />
 str += &#8221; DATE &#8220;;<br />
 }<br />
 else if( s.equals(&#8220;VARCHAR&#8221;) )<br />
 {<br />
 if( strToDB.equals(&#8220;SQLServer&#8221;) )<br />
 str += &#8221; VARCHAR(&#8221; + fi.Size + &#8220;) &#8220;;<br />
 else<br />
 str += &#8221; VARCHAR2(&#8221; + fi.Size + &#8220;) &#8220;;<br />
 }<br />
 else<br />
 return &#8220;&#8221;;</font></p>
<p><font color="#0000ff"> if( fi.Unique )<br />
 s += &#8221; &#8221; + &#8220;UNIQUE &#8220;;<br />
 if( fi.AllowNull )<br />
 s += &#8221; &#8221; + &#8220;NOT NULL &#8220;;<br />
 }<br />
 catch(Exception ex)<br />
 {<br />
 }<br />
 return str;<br />
 }</font></p>
<p><font color="#0000ff"> public String getSQL(String strTable, String strToDB)<br />
 {<br />
 //String strNewTable = strTable.replace(&#8216; &#8216;, &#8216;_&#8217;);<br />
 //System.out.println(strNewTable);</font></p>
<p><font color="#0000ff"> String strSQL = &#8220;CREATE TABLE &#8221; + strTable + &#8221; (&#8220;;<br />
 for(int i = 0; i &lt; _fieldList.size(); i++)<br />
 {<br />
 String s = getFieldDesc((FieldInfo)_fieldList.get(i), strToDB);<br />
 if( i == 0 )<br />
 strSQL = strSQL + s;<br />
 else<br />
 strSQL = strSQL + &#8220;, &#8221; + s;<br />
 }<br />
 strSQL = strSQL + &#8220;)&#8221;;</font></p>
<p><font color="#0000ff"> return strSQL;<br />
 }</font></p>
<p><font color="#0000ff"> public void migrateStructureAndData(String []strSrcTable, String<br />
strSrcDSN, String strSrcUser, String strSrcPwd,<br />
  String strDestDSN, String strDestUser, String strDestPwd,<br />
  String strToDB, boolean bStructureOnly) throws Exception<br />
 {<br />
 try<br />
 {<br />
 ResultSet rsSource = null;<br />
 Statement stmtSrc = null, stmtDest = null;<br />
 Connection connSrc = null, connDest = null;</font></p>
<p><font color="#0000ff"> Class.forName(&#8220;sun.jdbc.odbc.JdbcOdbcDriver&#8221;);<br />
 connSrc = DriverManager.getConnection(&#8220;jdbc:odbc:&#8221; + strSrcDSN,<br />
strSrcUser, strSrcPwd);</font></p>
<p><font color="#0000ff"> String strDestTable[] = new String[strSrcTable.length];</font></p>
<p><font color="#0000ff"> for(int i = 0; i &lt; strSrcTable.length; i++)<br />
 {<br />
 getFieldInfoList(strSrcTable[i], connSrc,strDestDSN, strDestUser,<br />
strDestPwd);<br />
                                strDestTable[i] =<br />
getSQL(strSrcTable[i],<br />
strToDB);<br />
 System.out.println(strDestTable[i]);<br />
 }</font></p>
<p><font color="#0000ff">                         connDest =<br />
DriverManager.getConnection(&#8220;jdbc:odbc:&#8221; + strDestDSN, strDestUser,<br />
strDestPwd);<br />
                        stmtDest = connDest.createStatement();</font></p>
<p><font color="#0000ff"> for( int i = 0; i &lt; strDestTable.length; i++)<br />
 {<br />
 try<br />
 {<br />
 stmtDest.execute(strDestTable[i]);</font></p>
<p><font color="#0000ff"> /*if( bStructureOnly == false )<br />
 {<br />
 String strInsert = &#8220;INSERT INTO &#8221; +<br />
strSrcTable[i]+&#8221;(&#8220;+s1[1]+&#8221;,&#8221;+s1[2]+&#8221;,&#8221;+s1[3]+&#8221;,&#8221;+s1[4]+&#8221;,&#8221;+s1[5]+&#8221;)&#8221;+<br />
 &#8221; VALUES (&#8220;+1+&#8221;,&#8221;+&#8221;ravi&#8221;+&#8221;,&#8221;+&#8221;21&#8243;+&#8221;,&#8221;+&#8221;12000&#8243;+&#8221;,&#8221;+&#8221;1234&#8243;+&#8221;)&#8221;;<br />
 //rsSource = stmt.executeQuery(&#8220;SELECT * FROM &#8221; +strSrcTable[i]);</font></p>
<p><font color="#0000ff"> stmtDest.execute(strInsert);<br />
 }*/<br />
 }<br />
 catch(Exception ex)<br />
 {<br />
 /*String s = ex.toString().toLowerCase();<br />
 if( s.indexOf(&#8220;there is already an object&#8221;) &gt;= 0 )<br />
 System.out.println(&#8220;&#8216;&#8221; + strSrcTable[i] + &#8220;&#8216; already exists&#8221;);<br />
 else<br />
 System.out.println(ex);*/<br />
 }<br />
 }</font></p>
<p><font color="#0000ff"> //connSrc.close();<br />
 //connDest.close();<br />
 }<br />
 catch(Exception ex)<br />
 {<br />
 throw ex;<br />
 }<br />
 }</font></p>
<p><font color="#0000ff"> public static void main(String []args)<br />
 {<br />
 DataMigration dm = new DataMigration();<br />
 String []s = { &#8220;authors1&#8243;,&#8221;authors2&#8243;,&#8221;authors3&#8243;};<br />
 try<br />
 {<br />
 dm.migrateStructureAndData(s, &#8220;sql&#8221;, &#8220;sa&#8221;, &#8220;&#8221;, &#8220;con1&#8243;, &#8220;&#8221;, &#8220;&#8221;, &#8220;&#8221;,<br />
false);<br />
}<br />
 catch(Exception ex)<br />
 {<br />
 System.out.println(ex);<br />
 }<br />
 }<br />
}</font></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=31&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/07/database-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Banking Management</title>
		<link>http://itphyogyi.wordpress.com/2008/02/07/banking-management/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/07/banking-management/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:25:34 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/2008/02/07/banking-management/</guid>
		<description><![CDATA[import java.io.*; import java.awt.*; import java.applet.*; import java.awt.event.*; /*&#60;applet code=bang2.class width=300 height=400&#62;&#60;/applet&#62;*/ class frame1 extends Frame { frame1(String title) { super(title); MyWindowAdapter ad=new MyWindowAdapter(this); addWindowListener(ad); } public void paint(Graphics g) { g.drawString(&#8220;This is a frame Window&#8221;,10,40); } } class MyWindowAdapter extends WindowAdapter { frame1 f1; public MyWindowAdapter(frame1 f1) { this.f1=f1; } public void windowClosing(WindowEvent we) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=30&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>import java.io.*;<br />
import java.awt.*;<br />
import java.applet.*;<br />
import java.awt.event.*;</p>
<p>/*&lt;applet code=bang2.class width=300 height=400&gt;&lt;/applet&gt;*/</p>
<p>class frame1 extends Frame<br />
{<br />
frame1(String title)<br />
{<br />
super(title);<br />
MyWindowAdapter ad=new MyWindowAdapter(this);<br />
addWindowListener(ad);<br />
}<br />
public void paint(Graphics g)<br />
{<br />
g.drawString(&#8220;This is a frame Window&#8221;,10,40);<br />
}<br />
}</p>
<p>class MyWindowAdapter extends WindowAdapter<br />
{<br />
frame1 f1;<br />
public MyWindowAdapter(frame1 f1)<br />
{<br />
this.f1=f1;<br />
}<br />
public void windowClosing(WindowEvent we)<br />
{<br />
f1.setVisible(false);<br />
}</p>
<p>}</p>
<p>public class bang2 extends Applet implements<br />
ActionListener,ItemListener<br />
{</p>
<p>Label customer,deposit,accno,widthdraw;<br />
TextField cust,dept,number,draw;<br />
TextArea t;<br />
Choice type;<br />
Checkbox yes,nu;<br />
CheckboxGroup te;</p>
<p>Frame f;</p>
<p>Button b;</p>
<p>public void init()<br />
{</p>
<p>f=new frame1(&#8220;A frame window&#8221;);<br />
f.setSize(250,250);<br />
f.setVisible(true);</p>
<p>setBackground(Color.yellow);<br />
setForeground(Color.red);</p>
<p>customer=new Label(&#8220;CUSTOMER&#8221;);<br />
deposit=new Label(&#8220;DEPOSIT&#8221;);<br />
accno=new Label(&#8220;ACCOUNT NUMBER&#8221;);<br />
widthdraw=new Label(&#8220;WIDTHDRAW&#8221;);</p>
<p>cust=new TextField(20);<br />
dept=new TextField(20);<br />
number=new TextField(20);<br />
draw=new TextField(20);</p>
<p>type=new Choice();<br />
type.add(&#8220;FIXED&#8221;);<br />
type.add(&#8220;RD&#8221;);<br />
//        type.add(&#8220;SECOND CLASS&#8221;);</p>
<p>te=new CheckboxGroup();<br />
yes=new Checkbox(te,&#8221;YES&#8221;,false);<br />
nu=new Checkbox(te,&#8221;NO&#8221;,false);</p>
<p>t=new TextArea(40,45);</p>
<p>b=new Button(&#8220;submit&#8221;);</p>
<p>add(customer);<br />
add(cust);</p>
<p>add(accno);<br />
add(number);</p>
<p>add(deposit);<br />
add(dept);</p>
<p>add(widthdraw);<br />
add(draw);</p>
<p>add(type);<br />
add(b);</p>
<p>add(yes);<br />
add(nu);</p>
<p>add(t);</p>
<p>b.addActionListener(this);<br />
type.addItemListener(this);<br />
}</p>
<p>public void actionPerformed(ActionEvent ae)<br />
{<br />
if(ae.getActionCommand().equals(&#8220;submit&#8221;))<br />
{<br />
t.setText(&#8220;NAME: &#8220;+cust.getText()+&#8221;</p>
<p>&#8220;+&#8221;ACCOUNT NUMBER : &#8220;+<br />
number.getText()+&#8221;</p>
<p>&#8220;+&#8221;DEPOSIT<br />
AMOUNT<br />
: &#8220;+dept.getText()+&#8221;</p>
<p>&#8220;+<br />
&#8220;TYPE OF ACCOUNT : &#8220;+type.getSelectedItem());<br />
}<br />
}</p>
<p>public void itemStateChanged(ItemEvent ie)<br />
{</p>
<p>}<br />
}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=30&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/07/banking-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Connecting Java with MS-Access &#8211; Inserting data in</title>
		<link>http://itphyogyi.wordpress.com/2008/02/07/connecting-java-with-ms-access-inserting-data-in/</link>
		<comments>http://itphyogyi.wordpress.com/2008/02/07/connecting-java-with-ms-access-inserting-data-in/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:24:09 +0000</pubDate>
		<dc:creator>itphyogyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itphyogyi.wordpress.com/2008/02/07/connecting-java-with-ms-access-inserting-data-in/</guid>
		<description><![CDATA[import java.sql.*; import java.math.*; import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; /* author: aseem shrestha */ /* database connectivity with MS-Access is done by creating DataSourceName(dsn) in this example*/ /* Steps to use this example: * go to ms-access and make a table called &#8220;student_base&#8221; and give it a file name student_base.mdb * 1.    [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=29&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>import java.sql.*;<br />
import java.math.*;<br />
import javax.swing.*;<br />
import javax.swing.border.*;<br />
import java.awt.*;<br />
import java.awt.event.*;</p>
<p>/* author: aseem shrestha */<br />
/* database connectivity with MS-Access is done by creating<br />
DataSourceName(dsn) in this example*/<br />
/* Steps to use this example:<br />
* go to ms-access and make a table called &#8220;student_base&#8221; and give it a<br />
file name student_base.mdb<br />
* 1.    Go to Control Panel<br />
2.    Click  on Administrative Tools(windows 2000/xp), Click on<br />
ODBC(win98)<br />
3.    click on ODBC<br />
4.    Then , you will see a ODBC dialog box. Click on UserDSn<br />
5.    Click on Add Button<br />
6.    Select Microsoft Access Driver(*.mdb) driver and click on finish<br />
7.    Give a Data Source Name : student_base<br />
8.    Then Click on Select<br />
9.    Browse on the database name you have created and click<br />
it:student_base.mdb is a database file where all data<br />
will be stored<br />
10.    Click on OK.<br />
Once the DSN is created, you can do this example*/</p>
<p>public class AddNewStudent extends JFrame implements ActionListener {</p>
<p>private JButton btnok,btnexit,btnaddnew; //buttons<br />
private JTextField tf1,tf2;//textfields<br />
private JLabel lblname,lbladd,lblmsg; //labels</p>
<p>private JPanel p1,p2,p3,psouth; //panels</p>
<p>public AddNewStudent() //constructor<br />
{<br />
//initializing buttons<br />
btnok = new JButton(&#8220;OK&#8221;);<br />
btnok.addActionListener(this);<br />
btnexit = new JButton(&#8220;Exit&#8221;);<br />
btnexit.addActionListener(this);<br />
btnaddnew = new JButton(&#8220;AddNew&#8221;);<br />
btnaddnew.addActionListener(this);</p>
<p>//initializing textfields<br />
tf1 = new JTextField(12);<br />
tf2 = new JTextField(12);<br />
//initializing labels</p>
<p>lblname = new JLabel(&#8220;Name:&#8221;);<br />
lbladd = new JLabel(&#8220;Address:&#8221;);<br />
lblmsg = new JLabel(&#8220;&#8221;,JLabel.CENTER);</p>
<p>//initializing panels<br />
p1 = new JPanel();<br />
p2 = new JPanel();<br />
p3 = new JPanel();<br />
psouth = new JPanel();</p>
<p>//adding buttons and label to panel p1<br />
//setting flowlayout<br />
p1.setLayout(new FlowLayout());</p>
<p>p1.add(btnok);<br />
p1.add(btnexit);<br />
p1.add(btnaddnew);<br />
//adding lblmsg to panel p3<br />
p3.add(lblmsg);</p>
<p>//adding both the panels to new panel,psouth<br />
//settin layout 2:1<br />
psouth.setLayout(new GridLayout(2,1));<br />
psouth.add(p3);<br />
psouth.add(p1);</p>
<p>//adding label and textfields to panel p2<br />
p2.setLayout(new GridLayout(3,1));<br />
//setting line and titled border for panel p2<br />
p2.setBorder(BorderFactory.createLineBorder(Color.red));<br />
p2.setBorder(BorderFactory.createTitledBorder(&#8220;Enter Your<br />
Details&#8221;));<br />
p2.add(lblname);<br />
p2.add(tf1);<br />
p2.add(lbladd);<br />
p2.add(tf2);</p>
<p>//adding panel to container<br />
this.getContentPane().add(p2,&#8221;Center&#8221;);<br />
this.getContentPane().add(psouth,&#8221;South&#8221;);</p>
<p>this.setSize(300,300);<br />
this.setLocation(100,200);<br />
this.show();</p>
<p>}<br />
public static void main(String args[])<br />
{<br />
AddNewStudent ad = new AddNewStudent();<br />
}</p>
<p>//event handling<br />
public void actionPerformed(ActionEvent e)<br />
{<br />
if(e.getSource()==btnok)<br />
{<br />
PreparedStatement pstm;<br />
ResultSet rs;<br />
String sql;<br />
//if no entries has been made and hit ok button throw an error<br />
//you can do this step using try clause as well<br />
if((tf1.getText().equals(&#8220;&#8221;)&amp;&amp;(tf2.getText().equals(&#8220;&#8221;))))<br />
{<br />
lblmsg.setText(&#8220;Enter your details &#8220;);<br />
lblmsg.setForeground(Color.magenta);<br />
}</p>
<p>else<br />
{</p>
<p>try<br />
{<br />
//loading the driver<br />
Class.forName(&#8220;sun.jdbc.odbc.JdbcOdbcDriver&#8221;);</p>
<p>//connection object created using DriverManager class<br />
//student_base is the name of the database<br />
Connection connect =<br />
DriverManager.getConnection(&#8220;jdbc:odbc:student_base&#8221;);</p>
<p>//creating prepared statement object pstm so that query can be<br />
sent to database<br />
pstm=connect.prepareStatement(&#8220;insert into student_base<br />
values(?,?)&#8221;);<br />
pstm.setString(1,tf1.getText());<br />
pstm.setString(2,tf2.getText());<br />
//execute method to execute the query<br />
pstm.executeUpdate();<br />
lblmsg.setText(&#8220;Details have been added to database&#8221;);</p>
<p>//closing the prepared statement  and connection object<br />
pstm.close();<br />
connect.close();<br />
}<br />
catch(SQLException sqe)<br />
{<br />
System.out.println(&#8220;SQl error&#8221;);<br />
}<br />
catch(ClassNotFoundException cnf)<br />
{<br />
System.out.println(&#8220;Class not found error&#8221;);<br />
}<br />
}<br />
}<br />
//upon clickin button addnew , your textfield will be empty to<br />
enter<br />
next record<br />
if(e.getSource()==btnaddnew)<br />
{<br />
tf1.setText(&#8220;&#8221;);<br />
tf2.setText(&#8220;&#8221;);<br />
}</p>
<p>if(e.getSource()==btnexit)<br />
{<br />
System.exit(1);<br />
}<br />
}<br />
}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/itphyogyi.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/itphyogyi.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itphyogyi.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itphyogyi.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/itphyogyi.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/itphyogyi.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/itphyogyi.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/itphyogyi.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/itphyogyi.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/itphyogyi.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/itphyogyi.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/itphyogyi.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/itphyogyi.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/itphyogyi.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/itphyogyi.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/itphyogyi.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itphyogyi.wordpress.com&amp;blog=2346785&amp;post=29&amp;subd=itphyogyi&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itphyogyi.wordpress.com/2008/02/07/connecting-java-with-ms-access-inserting-data-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/87ef1f212abee16fc9de7b1043c0748f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">itphyogyi</media:title>
		</media:content>
	</item>
	</channel>
</rss>
