<?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/"
	>

<channel>
	<title>Swing &#8211; Jitendra Zaa</title>
	<atom:link href="https://www.jitendrazaa.com/blog/tag/swing/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.jitendrazaa.com/blog</link>
	<description>AI, Salesforce, ServiceNow &#38; Enterprise Tech Guides</description>
	<lastBuildDate>Thu, 24 Mar 2011 10:53:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">87744916</site><atom:link rel="search" type="application/opensearchdescription+xml" title="Search Jitendra Zaa" href="https://www.jitendrazaa.com/blog/wp-json/opensearch/1.1/document" />	<item>
		<title>Java Thread &#8211; Executor framework, Timer and TimerTask</title>
		<link>https://www.jitendrazaa.com/blog/java/java-thread-timertask/</link>
					<comments>https://www.jitendrazaa.com/blog/java/java-thread-timertask/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Thu, 24 Mar 2011 10:53:49 +0000</pubDate>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[Thread]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=1825</guid>

					<description><![CDATA[Tutorial and example of  Executor framework, Timer and TimerTask over Thread]]></description>
										<content:encoded><![CDATA[<p>With the Thread class you could create your own timer class using the <strong>Thread.sleep(T)</strong> method to delay action for some time . This approach, however, has some drawbacks. For periodic events, if the processing times in between the sleep periods vary significantly, then the overall timing will mismatch. Also, if you need many timer events, the program will require many threads and use up system resources.</p>
<p>We can create a Timer functionality with<strong><a title="Executor Framework" href="https://jitendrazaa.com/blog/java/java-threading-executor-framework-and-callable-interface/" target="_blank">Executor frameworks</a> </strong>and also there is <strong>Timer and Timertask</strong> available in <em>java.util package</em>. We will see both methods to create Timer functionality.<span id="more-1825"></span></p>
<p><strong>Method 1</strong> : Using Executor framework</p>
<pre class="brush: java; title: ; notranslate">
package com.G2.Thread;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

class MyTimer1 implements Runnable {

	@Override
	public void run() {
		System.out.println(&quot;This is run method&quot;);

	}

}

public class TimerTask1Demo {

	/**
	 * @param args
	 */
	public static void main(String&#x5B;] args) {
		MyTimer1 runnable = new MyTimer1();

		ScheduledExecutorService thread = Executors.newSingleThreadScheduledExecutor();

		/**
		 * Parameters :
		 * 1. Object of Runnable
		 * 2. Initial Delay
		 * 3. Delay between successive execution
		 * 4. Time Unit
		 */
		thread.scheduleAtFixedRate(runnable, 1000,1000, TimeUnit.MILLISECONDS);

	}
}
</pre>
<p>After every 1 sec the o/p will be printed.<br />
To read more on ScheduledExecutorService refer below URL: <a title="ScheduledExecutorService" href="http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledExecutorService.html" target="_blank">http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledExecutorService.html</a></p>
<p><strong>Method 2:</strong> Using java.util package for Progress bar animation in Swing</p>
<pre class="brush: java; title: ; notranslate">
package com.G2.Thread;

import java.util.Timer;
import java.util.TimerTask;

import javax.swing.JFrame;
import javax.swing.JProgressBar;

public class TimerTaskDemo2 {
	java.util.Timer fTimer;
	JProgressBar prg;

	class MyTimerTask extends TimerTask {
		public int progressValue = 0;

		@Override
		public void run() {
			progressValue++;
			prg.setValue(progressValue);
			if (progressValue &gt; 100)
				fTimer.cancel();
		}

	}

	/**
	 * @param args
	 */
	public static void main(String&#x5B;] args) {
		TimerTaskDemo2 obj = new TimerTaskDemo2();
		obj.createUI();

	}

	private void createUI() {
		JFrame f = new JFrame(&quot;Timer Task Demo&quot;);
		f.setLayout(null);
		prg = new JProgressBar();
		prg.setSize(200, 20);

		// Display percentage Text
		prg.setStringPainted(true);
		f.add(prg);

		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setSize(200, 100);
		f.setVisible(true);

		fTimer = new Timer();
		fTimer.schedule(new MyTimerTask(), 100, 100);
	}
}
</pre>
<p>Output:</p>
<figure id="attachment_1826" aria-describedby="caption-attachment-1826" style="width: 202px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/03/Animation-of-ProgressBar-Swing-Using-TimerTask.jpg?ssl=1"><img data-recalc-dims="1" decoding="async" class="size-full wp-image-1826" title="Animation of ProgressBar in Swing Using TimerTask" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/03/Animation-of-ProgressBar-Swing-Using-TimerTask.jpg?resize=202%2C103&#038;ssl=1" alt="Animation of ProgressBar in Swing Using TimerTask" width="202" height="103" /></a><figcaption id="caption-attachment-1826" class="wp-caption-text">Animation of ProgressBar in Swing Using TimerTask</figcaption></figure>
<p>In this example we have created a class &#8220;MyTimerTask&#8221;, which extends &#8220;<strong>TimerTask</strong>&#8221; and then created object of &#8220;<strong>Timer</strong>&#8221; by passing the &#8220;MyTimerTask&#8221; and scheduled to run after every 100 msec.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/java-thread-timertask/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1825</post-id>	</item>
		<item>
		<title>XML Tree Viewer using SAX Parser in JAVA with Jtree,JFileChooser component of Swing</title>
		<link>https://www.jitendrazaa.com/blog/java/xml-tree-viewer-using-sax-parser-in-java-with-jtreejfilechooser-component-of-swing/</link>
					<comments>https://www.jitendrazaa.com/blog/java/xml-tree-viewer-using-sax-parser-in-java-with-jtreejfilechooser-component-of-swing/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Tue, 22 Mar 2011 11:16:00 +0000</pubDate>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[XML]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=1767</guid>

					<description><![CDATA[XML Tree Viewer using SAX Parser in JAVA with Jtree,JFileChooser component of Swing, How to refresh Jtree when content changes , Expand or collapse JTree]]></description>
										<content:encoded><![CDATA[<p>I am going to create a utility application in JAVA for reading the XML document using SAX parser. The application will look like:</p>
<figure id="attachment_1769" aria-describedby="caption-attachment-1769" style="width: 351px" class="wp-caption aligncenter"><a href="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/03/XML-Tree-Viewer-using-SAX-Parser-in-JAVA.jpg?ssl=1"><img data-recalc-dims="1" fetchpriority="high" decoding="async" class="size-full wp-image-1769 " title="XML Tree Viewer using SAX Parser in JAVA" alt="XML Tree Viewer using SAX Parser in JAVA" src="https://i0.wp.com/jitendrazaa.com/blog/wp-content/uploads/2011/03/XML-Tree-Viewer-using-SAX-Parser-in-JAVA.jpg?resize=351%2C491&#038;ssl=1" width="351" height="491" /></a><figcaption id="caption-attachment-1769" class="wp-caption-text">XML Tree Viewer using SAX Parser in JAVA</figcaption></figure>
<p><span id="more-1767"></span></p>
<p>Input File :</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;
&lt;Movies&gt;
	&lt;Movie Actor=&quot;Aamir Khan&quot; Name=&quot;Lagaan&quot; Type=&quot;BollyWood&quot;&gt;
		This is node description for Movie Lagaan
	&lt;/Movie&gt;
	&lt;Movie Actor=&quot;Aamir Khan&quot; Name=&quot;Andaaz Apana Apna&quot; Type=&quot;BollyWood&quot; /&gt;
	&lt;Movie Actor=&quot;Salman Khan&quot; Name=&quot;Dabang&quot; Type=&quot;BollyWood&quot; /&gt;
	&lt;Movie Actor=&quot;Salman Khan&quot; Name=&quot;Wanted&quot; Type=&quot;BollyWood&quot; /&gt;
	&lt;Movie Actor=&quot;AKshay Kumar&quot; Name=&quot;Mujhse Shadi karoge&quot; Type=&quot;BollyWood&quot; /&gt;
	&lt;Movies2011&gt;
		&lt;jan&gt; Yamla Pagala Deewana &lt;/jan&gt;
	&lt;/Movies2011&gt;
&lt;/Movies&gt;
</pre>
<p>Code:</p>
<pre class="brush: java; title: ; notranslate">package com.G2.SAX;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class XMLTreeViewer extends DefaultHandler {

	private JTree xmlJTree;
	DefaultTreeModel treeModel;
	int lineCounter;
	DefaultMutableTreeNode base = new DefaultMutableTreeNode(&quot;XML Viewer&quot;);
	static XMLTreeViewer treeViewer = null;
	JTextField txtFile = null;

	@Override
	public void startElement(String uri, String localName, String tagName, Attributes attr) throws SAXException {

		DefaultMutableTreeNode current = new DefaultMutableTreeNode(tagName);

		base.add(current);
		base = current;

		for (int i = 0; i &lt; attr.getLength(); i++) {
			DefaultMutableTreeNode currentAtt = new DefaultMutableTreeNode(attr.getLocalName(i) + &quot; = &quot;
					+ attr.getValue(i));
			base.add(currentAtt);
		}
	}

	public void skippedEntity(String name) throws SAXException {
		System.out.println(&quot;Skipped Entity: '&quot; + name + &quot;'&quot;);
	}

	@Override
	public void startDocument() throws SAXException {
		super.startDocument();
		 base = new DefaultMutableTreeNode(&quot;XML Viewer&quot;);
		((DefaultTreeModel) xmlJTree.getModel()).setRoot(base);
	}

	public void characters(char&#x5B;] ch, int start, int length) throws SAXException {

		String s = new String(ch, start, length).trim();
		if (!s.equals(&quot;&quot;)) {
			DefaultMutableTreeNode current = new DefaultMutableTreeNode(&quot;Descrioption : &quot; + s);
			base.add(current);

		}
	}

	public void endElement(String namespaceURI, String localName, String qName) throws SAXException {

		base = (DefaultMutableTreeNode) base.getParent();
	}

	public static void main(String&#x5B;] args) {
		treeViewer = new XMLTreeViewer();
		// treeViewer.xmlSetUp();
		treeViewer.createUI();

	}

	@Override
	public void endDocument() throws SAXException {
		// Refresh JTree
		((DefaultTreeModel) xmlJTree.getModel()).reload();
		expandAll(xmlJTree);
	}

	public void expandAll(JTree tree) {
		int row = 0;
		while (row &lt; tree.getRowCount()) {
			tree.expandRow(row);
			row++;
		}
	}

	public void xmlSetUp(File xmlFile) {
		try {
			SAXParserFactory fact = SAXParserFactory.newInstance();
			SAXParser parser = fact.newSAXParser();
			parser.parse(xmlFile, this);

		} catch (Exception e) {

		}
	}

	public void createUI() {

		treeModel = new DefaultTreeModel(base);
		xmlJTree = new JTree(treeModel);
		JScrollPane scrollPane = new JScrollPane(xmlJTree);

		JFrame windows = new JFrame();

		windows.setTitle(&quot;XML Tree Viewer using SAX Parser in JAVA&quot;);

		JPanel pnl = new JPanel();
		pnl.setLayout(null);
		JLabel lbl = new JLabel(&quot;File :&quot;);
		txtFile = new JTextField(&quot;Selected File Name Here&quot;);
		JButton btn = new JButton(&quot;Select File&quot;);

		btn.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent evt) {
				JFileChooser fileopen = new JFileChooser();
				FileFilter filter = new FileNameExtensionFilter(&quot;xml files&quot;, &quot;xml&quot;);
				fileopen.addChoosableFileFilter(filter);

				int ret = fileopen.showDialog(null, &quot;Open file&quot;);

				if (ret == JFileChooser.APPROVE_OPTION) {
					File file = fileopen.getSelectedFile();
					txtFile.setText(file.getPath() + File.separator + file.getName());
					xmlSetUp(file);
				}

			}
		});
		lbl.setBounds(0, 0, 100, 30);
		txtFile.setBounds(110, 0, 250, 30);
		btn.setBounds(360, 0, 100, 30);
		scrollPane.setBounds(0, 50, 500, 600);

		pnl.add(lbl);

		pnl.add(txtFile);
		pnl.add(btn);

		pnl.add(scrollPane);

		windows.add(pnl);
		windows.setSize(500, 700);
		windows.setVisible(true);
		windows.setDefaultCloseOperation( windows.EXIT_ON_CLOSE);
	}

}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/xml-tree-viewer-using-sax-parser-in-java-with-jtreejfilechooser-component-of-swing/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1767</post-id>	</item>
		<item>
		<title>JDBC Example with Microsoft Access in Swing, Next and Previous navigation</title>
		<link>https://www.jitendrazaa.com/blog/java/jdbc-example-with-microsoft-access-in-swing/</link>
					<comments>https://www.jitendrazaa.com/blog/java/jdbc-example-with-microsoft-access-in-swing/#comments</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Tue, 31 Aug 2010 14:51:24 +0000</pubDate>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[Swing]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=936</guid>

					<description><![CDATA[JDBC - Java Database Connectivity example in Swing]]></description>
										<content:encoded><![CDATA[<p>To use below example, create a DSN name of &#8220;<span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">ShivaEvening</span>&#8220;, which point the Microsoft access database file provided in this article.</p>
<p>Download below files:</p>
<p><a href="https://jitendrazaa.com/blog/wp-content/uploads/2010/08/JDBCAllinOne.java_.txt">JDBCAllinOne.java</a></p>
<p><a href="https://jitendrazaa.com/blog/wp-content/uploads/2010/08/Employee.mdb">Employee.mdb</a></p>
<p><strong>Code:</strong><br />
<a href="https://jitendrazaa.com/blog/wp-content/uploads/2010/08/JDBC.bmp"><img decoding="async" class="aligncenter size-full wp-image-939" title="Java Database Connectivity -  JDBC" src="https://jitendrazaa.com/blog/wp-content/uploads/2010/08/JDBC.bmp" alt="Java Database Connectivity -  JDBC" /></a></p>
<p><span id="more-936"></span></p>
<pre class="brush: java; title: ; notranslate">
package com.shivasoft.event;

import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class JDBCSwing implements ActionListener {

	JLabel lblFName,lblLname,lblAddress,lblSalary,lblF,lblL,lblA,lblS,
	lblFVal,lblLVal,lblAVal,lblSVal;
	JTextField txtFName,txtLName,txtAddress,txtSalary;
	JButton btnAdd,btnUpdate,btnDelete,btnPrev,btnNext;
	ResultSet rs;
	public static void main(String&#x5B;] args) {
		JDBCSwing obj = new JDBCSwing();
		obj.createUI();
	}
	private void createUI()
	{
		JFrame frame = new JFrame(&quot;JDBC All in One&quot;);

		JPanel pnlInput = new JPanel(new GridLayout(4,2));

		lblFName = new JLabel(&quot;  First Name : &quot;);
		txtFName = new JTextField(15);

		lblLname = new JLabel(&quot;  Last Name : &quot;);
		txtLName = new JTextField();

		lblAddress = new JLabel(&quot;  Address : &quot;);
		txtAddress = new JTextField();

		lblSalary = new JLabel(&quot;  Salary : &quot;);
		txtSalary = new JTextField();

		pnlInput.add(lblFName);
		pnlInput.add(txtFName);

		pnlInput.add(lblLname);
		pnlInput.add(txtLName);

		pnlInput.add(lblAddress);
		pnlInput.add(txtAddress);

		pnlInput.add(lblSalary);
		pnlInput.add(txtSalary);

		JPanel pnlButton = new JPanel(new GridLayout(1,3));

		btnAdd = new JButton(&quot;Add&quot;);
		btnAdd.addActionListener(this);

		btnUpdate = new JButton(&quot;Update&quot;);
		btnUpdate.addActionListener(this);

		btnDelete = new JButton(&quot;Delete&quot;);
		btnDelete.addActionListener(this);

		pnlButton.add(btnAdd);
		pnlButton.add(btnUpdate);
		pnlButton.add(btnDelete);

		JPanel pnlNavigate = new JPanel(new GridLayout(1,2));
		btnPrev = new JButton(&quot; &lt;&lt; &quot;);
		btnPrev.setActionCommand(&quot;Prev&quot;);
		btnPrev.addActionListener(this);

		btnNext = new JButton(&quot; &gt;&gt; &quot;);
		btnNext.setActionCommand(&quot;Next&quot;);
		btnNext.addActionListener(this);

		pnlNavigate.add(btnPrev);
		pnlNavigate.add(btnNext);

		JPanel pnlNavAns = new JPanel(new GridLayout(4,2));

		lblF = new JLabel(&quot;  First Name : &quot;);
		lblFVal = new JLabel(&quot;Val&quot;);

		lblL = new JLabel(&quot;  Last Name : &quot;);
		lblLVal = new JLabel(&quot;Val&quot;);

		lblA = new JLabel(&quot;  Address : &quot;);
		lblAVal = new JLabel(&quot;Val&quot;);

		lblS = new JLabel(&quot;  Salary : &quot;);
		lblSVal = new JLabel(&quot;Val&quot;);

		pnlNavAns.add(lblF);
		pnlNavAns.add(lblFVal);

		pnlNavAns.add(lblL);
		pnlNavAns.add(lblLVal);

		pnlNavAns.add(lblA);
		pnlNavAns.add(lblAVal);

		pnlNavAns.add(lblS);
		pnlNavAns.add(lblSVal);

		Container cn = frame.getContentPane();
		cn.setLayout(new BoxLayout(cn,BoxLayout.Y_AXIS));

		frame.add(pnlInput);
		frame.add(pnlButton);
		frame.add(pnlNavAns);
		frame.add(pnlNavigate);

		//If this will not be written, the only frame will be closed
		// but the application will be active.
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	@Override
	public void actionPerformed(ActionEvent evt) {

		String action = evt.getActionCommand();
		if(action.equals(&quot;Add&quot;))
		{
			addOperation();
		}else if(action.equals(&quot;Update&quot;))
		{
			updateOperation();
		}else if(action.equals(&quot;Delete&quot;))
		{
			deleteOperation();
		}else if(action.equals(&quot;Prev&quot;))
		{
			preNavigation();
		}else if(action.equals(&quot;Next&quot;))
		{
			nextNavigation();
		}
	}
	private void addOperation()
	{
		try
		{
			//Load Jdbc Odbc Driver
			Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);
			Connection con = DriverManager.getConnection(&quot;jdbc:odbc:ShivaEvening&quot;);

			String sql = &quot;INSERT INTO Employee (FName,LName,Address,Salary) &quot; +
					&quot;Values ('&quot;+txtFName.getText()+&quot;',&quot; +
							&quot;'&quot;+txtLName.getText()+&quot;',&quot; +
							&quot;'&quot;+txtAddress.getText()+&quot;',&quot; +
							&quot;'&quot;+txtSalary.getText()+&quot;')&quot;;

			Statement st = con.createStatement();
			st.execute(sql);

			JOptionPane.showMessageDialog(null, &quot;Record Added Succesfully.&quot;,&quot;Record Added&quot;,
                        JOptionPane.INFORMATION_MESSAGE);
			clearControls();
		}catch(Exception e)
		{
			JOptionPane.showMessageDialog(null, e.getMessage(),&quot;Error&quot;,
                        JOptionPane.ERROR_MESSAGE);
		}
	}
	private void updateOperation()
	{
		try
		{
			//Load Jdbc Odbc Driver
			Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);
			Connection con = DriverManager.getConnection(&quot;jdbc:odbc:ShivaEvening&quot;);

			String sql = &quot;Update Employee &quot; +
					        &quot;SET LName = '&quot;+txtLName.getText()+&quot;',&quot; +
							&quot;Address = '&quot;+txtAddress.getText()+&quot;',&quot; +
							&quot;Salary = '&quot;+txtSalary.getText()+&quot;'&quot; +
							&quot;Where FName = '&quot;+txtFName.getText()+&quot;'&quot;;

			JOptionPane.showMessageDialog(null, sql,&quot;Record Updated&quot;,
                        JOptionPane.INFORMATION_MESSAGE);
			Statement st = con.createStatement();
			st.execute(sql);

			JOptionPane.showMessageDialog(null, &quot;Record Update Succesfully.&quot;,
                        &quot;Record Updated&quot;,JOptionPane.INFORMATION_MESSAGE);
			clearControls();
		}catch(Exception e)
		{
			JOptionPane.showMessageDialog(null, e.getMessage(),&quot;Error&quot;,
                        JOptionPane.ERROR_MESSAGE);
		}
	}
	private void deleteOperation()
	{
		int ans = JOptionPane.showConfirmDialog(null,
				&quot;Are you sure to delete the Record ?&quot;, &quot;Delete Record&quot;,
                           JOptionPane.YES_NO_OPTION);
		if(ans == JOptionPane.YES_OPTION)
		{
			try{
			//Load Jdbc Odbc Driver
			Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);
			Connection con = DriverManager.getConnection(&quot;jdbc:odbc:ShivaEvening&quot;);

			String sql = &quot;Delete FROM Employee where FName = '&quot;+txtFName.getText()+&quot;'&quot;;

			Statement st = con.createStatement();
			st.execute(sql);
			}catch(Exception e)
			{
				JOptionPane.showMessageDialog(null, e.getMessage(),&quot;Error&quot;,
                                JOptionPane.ERROR_MESSAGE);
			}
			JOptionPane.showMessageDialog(null, &quot;Record Deleted&quot;,&quot;Success&quot;,
                        JOptionPane.INFORMATION_MESSAGE);
		}
		else
		{
			JOptionPane.showMessageDialog(null, &quot;Operation Canceled&quot;,&quot;Cancel&quot;,
                        JOptionPane.INFORMATION_MESSAGE);
		}
	}
	private void preNavigation()
	{
		try{
			if(rs == null)
			{
			//Load Jdbc Odbc Driver
			Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);
			Connection con = DriverManager.getConnection(&quot;jdbc:odbc:ShivaEvening&quot;);

			String sql = &quot;SELECT * FROM Employee&quot;;

			Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
			rs = st.executeQuery(sql);
			}
			if(rs.previous())
			{
				populateValue();
			}
			}catch(Exception e)
			{
				JOptionPane.showMessageDialog(null, e.getMessage(),&quot;Error&quot;,
                                JOptionPane.ERROR_MESSAGE);
			}
	}
	private void nextNavigation()
	{
		try{
			if(rs == null)
			{
			//Load Jdbc Odbc Driver
			Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);
			Connection con = DriverManager.getConnection(&quot;jdbc:odbc:ShivaEvening&quot;);

			String sql = &quot;SELECT * FROM Employee&quot;;

			Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
			rs = st.executeQuery(sql);
			}
			if(rs.next())
			{
				populateValue();
			}
			}catch(Exception e)
			{
				JOptionPane.showMessageDialog(null, e.getMessage(),&quot;Error&quot;,
                                JOptionPane.ERROR_MESSAGE);
			}
	}
	private void populateValue() throws Exception
	{
		String fName = rs.getString(&quot;FName&quot;);
		String lName = rs.getString(&quot;LName&quot;);
		String add = rs.getString(&quot;Address&quot;);
		String sal = rs.getString(&quot;Salary&quot;);

		lblFVal.setText(fName);
		lblLVal.setText(lName);
		lblAVal.setText(add);
		lblSVal.setText(sal);

		txtFName.setText(fName);
		txtLName.setText(lName);
		txtAddress.setText(add);
		txtSalary.setText(sal);
	}
	private void clearControls()
	{
		txtFName.setText(&quot;&quot;);
		txtLName.setText(&quot;&quot;);
		txtAddress.setText(&quot;&quot;);
		txtSalary.setText(&quot;&quot;);
	}
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/jdbc-example-with-microsoft-access-in-swing/feed/</wfw:commentRss>
			<slash:comments>27</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">936</post-id>	</item>
		<item>
		<title>setBackground not working in Swing or AWT</title>
		<link>https://www.jitendrazaa.com/blog/java/setbackground-not-working-in-swing-or-awt/</link>
					<comments>https://www.jitendrazaa.com/blog/java/setbackground-not-working-in-swing-or-awt/#respond</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Fri, 27 Aug 2010 04:23:49 +0000</pubDate>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[AWT]]></category>
		<category><![CDATA[Swing]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=904</guid>

					<description><![CDATA[setBackground() not working for the JLabel control in JAVA]]></description>
										<content:encoded><![CDATA[<p>I tried to change the background color of the JLabel control.</p>
<p>I tried lots of time, gone through JAVA documentation but it doesn&#8217;t helped much. After digging i found that few controls in JAVA have transparent background color and therefore <strong>controls having transparent background does not work for the setBackground() property.</strong></p>
<p>To set the background color of such controls, we need to explicitly set the Opaque to true.</p>
<blockquote>
<div id="_mcePaste">JLabel lblMousePointer.setBackground(Color.white);</div>
<div id="_mcePaste">lblMousePointer.setOpaque(true);</div>
</blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/setbackground-not-working-in-swing-or-awt/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">904</post-id>	</item>
		<item>
		<title>setBounds method not working</title>
		<link>https://www.jitendrazaa.com/blog/java/setbounds-method-not-working/</link>
					<comments>https://www.jitendrazaa.com/blog/java/setbounds-method-not-working/#respond</comments>
		
		<dc:creator><![CDATA[Jitendra]]></dc:creator>
		<pubDate>Fri, 27 Aug 2010 04:01:16 +0000</pubDate>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[AWT]]></category>
		<category><![CDATA[Swing]]></category>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=901</guid>

					<description><![CDATA[SetBounds method of Swing and AWT controls are not working]]></description>
										<content:encoded><![CDATA[<p>While working on Swings and AWT, i used the setBounds(int x,int y,int width,int height) method of control as per API documentation.<br />
However soon i realized that this method is not working as per expected.<br />
After few try i found that setBounds() method only works if <strong>the Layout of container of control is null.</strong></p>
<p>The layout of the container can be set null like below code:</p>
<blockquote><p>frame.getContentPane().setLayout(null);</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.jitendrazaa.com/blog/java/setbounds-method-not-working/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">901</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: www.jitendrazaa.com @ 2026-05-15 09:22:32 by W3 Total Cache
-->