<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Double Buffering [UNSOLVED]' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Double Buffering [UNSOLVED]' posted on the 'Java Beginners' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Wed, 23 May 2012 21:20:37 -0700</pubDate>
    <lastBuildDate>Wed, 23 May 2012 21:20:37 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Double Buffering [UNSOLVED]</title>
      <link>http://www.programmersheaven.com/mb/java_beginners/408790/408790/double-buffering-unsolved/</link>
      <description>I'm new to java and am working my way through a tutorial but I want to know how to add double buffering to the code below. The tutorial's code doesn't work, so how do you guys do it? (commented code is helpful&lt;pre class="sourcecode"&gt;
// DOUBLE BUFFERING

import java.applet.*;
import java.awt.*;




public class Game2p2 extends Applet implements Runnable
{
	int x_pos = 10;
	int y_pos = 100;
	int radius = 20;
	
	public void init() {}
	

	public void start(){
		//define a new thread
		Thread th = new Thread(this);
		// start this thread
		th.start();
	}
	
	
	public void stop() {}
	
	
	public void destroy(){}
	
	public void run() {
		// lower ThreadPriority
		Thread.currentThread().setPriority(Thread.MIN_PRIO
RITY);
		
		// run a long while (true) this means in our case 'allways'
		while(true){
			// repaint the applet
			x_pos++;
			repaint();
			
			try{
				// Stop thread for 20 milliseconds
				Thread.sleep(20);
			}
			catch(InterruptedException ex){
				// do nothing
			}
			
			// set ThreadPriority to maximum value
			Thread.currentThread().setPriority(Thread.MAX_PRIO
RITY);
		}
		
	}
	
	public void paint(Graphics g){
		// set color
		g.setColor(Color.red);
		
		// paint a filled colored circle
		g.fillOval(x_pos - radius, y_pos - radius, 2*radius, 2*radius);
	}
}

&lt;pre class="sourcecode"&gt;&lt;/pre&gt;&lt;/pre&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java_beginners/408790/408790/double-buffering-unsolved/</guid>
      <pubDate>Tue, 03 Nov 2009 18:15:32 -0700</pubDate>
      <category>Java Beginners</category>
    </item>
  </channel>
</rss>
