<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: Bouncing ball animation in Applet	</title>
	<atom:link href="https://www.jitendrazaa.com/blog/java/mouse-handling-in-applets-using-this/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.jitendrazaa.com/blog/java/mouse-handling-in-applets-using-this/</link>
	<description>AI, Salesforce, ServiceNow &#38; Enterprise Tech Guides</description>
	<lastBuildDate>Thu, 22 Sep 2016 04:19:00 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>
	<item>
		<title>
		By: jobs		</title>
		<link>https://www.jitendrazaa.com/blog/java/mouse-handling-in-applets-using-this/#comment-3453</link>

		<dc:creator><![CDATA[jobs]]></dc:creator>
		<pubDate>Thu, 22 Sep 2016 04:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=847#comment-3453</guid>

					<description><![CDATA[how to insert a background color o image?]]></description>
			<content:encoded><![CDATA[<p>how to insert a background color o image?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: asha		</title>
		<link>https://www.jitendrazaa.com/blog/java/mouse-handling-in-applets-using-this/#comment-2268</link>

		<dc:creator><![CDATA[asha]]></dc:creator>
		<pubDate>Tue, 09 Sep 2014 20:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=847#comment-2268</guid>

					<description><![CDATA[Hi , After a lot of effort I managed to make it work like I expected. Some additions and some changes to the original code.
added...
 boolean active;//instance variable@Override
 public void start() {
 	super.start();
 	System.out.println(&quot;start&quot;);
 	synchronized (this) {
  	active=true;
  	notify();
 	} 	}
 @Override
 public void stop() {
 	super.stop();
 	System.out.println(&quot;stop&quot;);
 	synchronized (this) {
  	active=false;
  	notify();
 	}	}

changed...
@Override
 public void run() {
 do{
   do{
    displacementOperation(redBall);
    displacementOperation(blackBall);
 	   repaint();
 	try {  	Thread.sleep(100); 	} catch (InterruptedException e) { 	e.printStackTrace(); 	}
    	System.out.println(&quot;requested repaint&quot;);
     }while(active==true);
   synchronized (this) {
    	System.out.println(&quot;entering wait&quot;);
    	try { 	wait();	} catch (InterruptedException e) {	e.printStackTrace();	}
 	  System.out.println(&quot;out of wait&quot;);
     }
     System.out.println(&quot;thread is still running....&quot;);
      	}while(true);
 }]]></description>
			<content:encoded><![CDATA[<p>Hi , After a lot of effort I managed to make it work like I expected. Some additions and some changes to the original code.<br />
added&#8230;<br />
 boolean active;//instance variable@Override<br />
 public void start() {<br />
 	super.start();<br />
 	System.out.println(&#8220;start&#8221;);<br />
 	synchronized (this) {<br />
  	active=true;<br />
  	notify();<br />
 	} 	}<br />
 @Override<br />
 public void stop() {<br />
 	super.stop();<br />
 	System.out.println(&#8220;stop&#8221;);<br />
 	synchronized (this) {<br />
  	active=false;<br />
  	notify();<br />
 	}	}</p>
<p>changed&#8230;<br />
@Override<br />
 public void run() {<br />
 do{<br />
   do{<br />
    displacementOperation(redBall);<br />
    displacementOperation(blackBall);<br />
 	   repaint();<br />
 	try {  	Thread.sleep(100); 	} catch (InterruptedException e) { 	e.printStackTrace(); 	}<br />
    	System.out.println(&#8220;requested repaint&#8221;);<br />
     }while(active==true);<br />
   synchronized (this) {<br />
    	System.out.println(&#8220;entering wait&#8221;);<br />
    	try { 	wait();	} catch (InterruptedException e) {	e.printStackTrace();	}<br />
 	  System.out.println(&#8220;out of wait&#8221;);<br />
     }<br />
     System.out.println(&#8220;thread is still running&#8230;.&#8221;);<br />
      	}while(true);<br />
 }</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: asha		</title>
		<link>https://www.jitendrazaa.com/blog/java/mouse-handling-in-applets-using-this/#comment-2267</link>

		<dc:creator><![CDATA[asha]]></dc:creator>
		<pubDate>Tue, 09 Sep 2014 00:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=847#comment-2267</guid>

					<description><![CDATA[Hi Shiva, works beautifully. But I was puzzled by it.
Please try...
public void paint(Graphics g)
  {   System.out.println(&quot;repaint called paint method of component&quot;);
 g.setColor(redBall.BallColor);
.other code that is already there...}
 public void run()
   {.....
repaint();
 System.out.println(&quot;thread is still running .&quot;);
......
.other code that is already there...}
Run the applet you will see that the first message stops and starts as the applet is minimized and maximized as applets should do...
But looks like that it is so because repaint() does not call paint(Graphics g) when the frame is minimized. The second message still prints out and CPU cycle is consumed. Maybe thread synchronization should be used in start and stop methods to actually pause the execution for it to work like a true applet?Anyways it works beautifully for the present purpose.]]></description>
			<content:encoded><![CDATA[<p>Hi Shiva, works beautifully. But I was puzzled by it.<br />
Please try&#8230;<br />
public void paint(Graphics g)<br />
  {   System.out.println(&#8220;repaint called paint method of component&#8221;);<br />
 g.setColor(redBall.BallColor);<br />
.other code that is already there&#8230;}<br />
 public void run()<br />
   {&#8230;..<br />
repaint();<br />
 System.out.println(&#8220;thread is still running .&#8221;);<br />
&#8230;&#8230;<br />
.other code that is already there&#8230;}<br />
Run the applet you will see that the first message stops and starts as the applet is minimized and maximized as applets should do&#8230;<br />
But looks like that it is so because repaint() does not call paint(Graphics g) when the frame is minimized. The second message still prints out and CPU cycle is consumed. Maybe thread synchronization should be used in start and stop methods to actually pause the execution for it to work like a true applet?Anyways it works beautifully for the present purpose.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: admin		</title>
		<link>https://www.jitendrazaa.com/blog/java/mouse-handling-in-applets-using-this/#comment-281</link>

		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 06 Oct 2010 17:25:58 +0000</pubDate>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=847#comment-281</guid>

					<description><![CDATA[Hi Muzaffar,
displacementOperation() method checks the boundary condition for ball object. lets say if balls x coordinate is crossing the maximum allowed values it should be re bounce.]]></description>
			<content:encoded><![CDATA[<p>Hi Muzaffar,<br />
displacementOperation() method checks the boundary condition for ball object. lets say if balls x coordinate is crossing the maximum allowed values it should be re bounce.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Muzaffar Shah Khan		</title>
		<link>https://www.jitendrazaa.com/blog/java/mouse-handling-in-applets-using-this/#comment-280</link>

		<dc:creator><![CDATA[Muzaffar Shah Khan]]></dc:creator>
		<pubDate>Wed, 06 Oct 2010 16:47:52 +0000</pubDate>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=847#comment-280</guid>

					<description><![CDATA[Can u explain me the logic in method below please!! thanks in advance

public void  displacementOperation(Ball ball)]]></description>
			<content:encoded><![CDATA[<p>Can u explain me the logic in method below please!! thanks in advance</p>
<p>public void  displacementOperation(Ball ball)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Bouncing ball applet - Create Balls on Mouse click of random color and random size &#124; Shiva Blog		</title>
		<link>https://www.jitendrazaa.com/blog/java/mouse-handling-in-applets-using-this/#comment-279</link>

		<dc:creator><![CDATA[Bouncing ball applet - Create Balls on Mouse click of random color and random size &#124; Shiva Blog]]></dc:creator>
		<pubDate>Thu, 09 Sep 2010 06:13:14 +0000</pubDate>
		<guid isPermaLink="false">http://JitendraZaa.com/blog/?p=847#comment-279</guid>

					<description><![CDATA[[...] Bouncing ball applet &#8211; Create Balls on Mouse click of random color and random size Posted by admin on September 9th, 2010       In previous example, we have seen that how to animate two balls around the applet border. [...]]]></description>
			<content:encoded><![CDATA[<p>[&#8230;] Bouncing ball applet &#8211; Create Balls on Mouse click of random color and random size Posted by admin on September 9th, 2010       In previous example, we have seen that how to animate two balls around the applet border. [&#8230;]</p>
]]></content:encoded>
		
			</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-11-29 05:53:14 by W3 Total Cache
-->