I want display 2nd cycle after sleeping 1st cycle time 1 second after that display 2nd ,3rd and so on....

I bold my thread code in above program....

public class MainDrawCycle extends JPanel implements ActionListener ,Runnable
{

	JButton button;
	JLabel lblclkValue,lbldispValue,lblTitle;
	JTextField textField;
	JScrollPane pane;
	JPanel panel;
	JFrame frame;
	Container c;
	static int val;
	static int incValue=1;
	int xa,ya,xb,yb,x1,y1;
	int xc,yc,xd,yd;
	int lsb=0,msb=7;
	int maxValue=20*incValue;
	char val1='A',val2='B';
	Thread runner;
	JComboBox cmb; 
	Font f,f2,xyFont;
[B]	Thread t1;[/B]
	public  MainDrawCycle() 
	{

		setLayout(null);
		f=new Font("SansSerif",Font.BOLD,15);
		[B]t1=new Thread(this);
		t1.start();[/B]
		textField=new JTextField();
		lblclkValue=new JLabel("Enter Clock value: ");
		lbldispValue=new JLabel("Select zoom size: ");
		lblTitle=new JLabel("Timming Analysis");
		lblTitle.setForeground(Color.blue);
		lblTitle.setFont(f);
		button=new JButton("Ok");
		cmb=new JComboBox();
		cmb.addItem("1");
		cmb.addItem("2");
		cmb.addItem("3");
		cmb.addItem("4");

		lblTitle.setBounds(450,30,200,20);
		lblclkValue.setBounds(280,550,120,20);
		textField.setBounds(410,550,50,25);
		button.setBounds(480,550,70,25);
		cmb.setBounds(410,580,70,25);
		lbldispValue.setBounds(280,580,120,20);
		this.setBounds(50,50,500,500);

		add(button);
		add(textField);
		add(lblclkValue);
		add(lbldispValue);
		add(lblTitle);
		add(cmb);

		button.addActionListener(this);
		cmb.addActionListener(this);

	}

	public void paintComponent(Graphics g) 
	{
		super.paintComponent(g);

		xa=100;ya=120;
		xb=xa+maxValue/2;yb=ya;
		xc=xb;yc=yb+maxValue/2;
		xd=xa+maxValue;yd=yc;

		maxValue=20*incValue;

		System.out.println("maxvalu with incValu>>"+maxValue);
		Font f=new Font("serif", Font.BOLD,20);

		g.setColor(Color.BLACK);
		g.drawLine(100,100,100,530);  			// Draw Y axis.

		g.drawString("CLK",xa-40 ,ya);
		g.drawString("DATA", xa-40, 300);
		g.drawString("["+msb+":"+lsb+"]", xa-40, 312);

		System.out.println("incvlaue :"+incValue);
		g.setFont(f);
		g.setColor(Color.red);
		//g.drawString("Timing Analysis", 500,30);


		Graphics2D g2d = (Graphics2D)g;
		Stroke stroke=new BasicStroke(1f, BasicStroke.CAP_ROUND,BasicStroke.JOIN_BEVEL,1f, new float[] {2f}, 0f);
		Stroke drawingStroke = new BasicStroke(2);

		for(int i=1;i<=val;i++)
		{
			//t1.start();
			Font f2=new Font("serif",Font.PLAIN,8+incValue);
			g2d.setColor(Color.black);
			g2d.setStroke(stroke);
			Line2D line = new Line2D.Double(xb,yb,xb,500);
			g2d.draw (line);
			Line2D line2 = new Line2D.Double(xd,yd-50,xd,500);
			g2d.draw (line2); 
			g2d.setStroke(drawingStroke);

			if(xa<xd)
			{
				x1=xd;
				g.setColor(Color.black);
				g.drawLine(50,500,x1,500);  //Draw X axis.
			}
			//g.drawString("t"+i,xa+15,ya-5);
			g.setFont(f2);
			g.drawString("T"+i,xa+15,ya-5);

			g.setColor(Color.blue);
			g.drawLine(xa,ya,xb,yb);		//h1
			g.setColor(Color.blue);         
			g.drawLine(xb,yb,xc,yc);  		//v1
			g.setColor(Color.blue);  
			g.drawLine(xc,yc,xd,yd);     	//h2

			if(i%2==0)
				g.drawString(""+val1,(xa+xd)/2, 300);
			else
				g.drawString(""+val2,(xa+xd)/2 , 300);

			g.drawLine(xa, 300, (xa+xb)/2, 275);
			g.drawLine((xa+xb)/2, 275, (xc+xd)/2, 275);
			g.drawLine((xc+xd)/2, 275, xd, 300);
			g.drawLine((xa+xb)/2, 325, (xc+xd)/2, 325);
			g.drawLine(xa, 300, (xa+xb)/2, 325);
			g.drawLine((xc+xd)/2, 325, xd, 300);

			xa=xa+maxValue;
			xb=xa+maxValue/2;
			yb=ya;
			xc=xb;

			yc=yb+maxValue/2;
			xd=xa+maxValue;
			yd=yc;
			setPreferredSize(new Dimension(xd,650));

		}
	}

	public static void main(String[] args) 
	{
		JFrame frame = new JFrame();


		try {
			//UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
			UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		//frame.setLayout(null);
		frame.setBackground(Color.darkGray);
		JPanel jp=new  MainDrawCycle();
		jp.setPreferredSize(new Dimension(500,500));
		//jp.setBounds(20, 20, 500, 500);

		JScrollPane pane=new JScrollPane(jp,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		pane.setPreferredSize(jp.getPreferredSize());

		frame.add(pane);
		
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		frame.setSize(900,700);
		//frame.setExtendedState(frame.MAXIMIZED_BOTH);
		frame.setResizable(false);

		frame.setVisible(true);

	}

	@Override

	public void actionPerformed(ActionEvent e) 
	{

		if(e.getSource()==button)
		{
			val=Integer.parseInt(textField.getText());
			repaint();
			setSize(550, 600);
			setSize(500, 500);

		}
		if(e.getSource()==cmb)
		{
			if(cmb.getSelectedItem().toString()=="1")
			{

				incValue=1;

			}
			if(cmb.getSelectedItem().toString()=="2")
			{
				incValue=4;

			}
			if(cmb.getSelectedItem().toString()=="3")
			{
				incValue=6;

			}
			if(cmb.getSelectedItem().toString()=="4")
			{
				incValue=8;

			}

		}
	}

	@Override
[B]	public void run() 
	{
		while(true)
		{
			super.repaint();
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
[/B]//	public void start()
//	{
//		if(t1==null)
//		{
//			t1=new Thread(this);
//			t1.start();
//		}
//	}	

}

For animation or other time-based Swing code do not use a loop/sleep - you;'ll have all sorts of problems and sooner or later will block Swing's own thread so everything stops.
The correct approach is to use a javax.swing.Timer. You create a Timer that fires every 1000 millisecs and calls an actionPeformed method to update your animation.
Here's a good tutorial on how to do it:
http://download.oracle.com/javase/tutorial/uiswing/misc/timer.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.