File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes YoYo goes up and down on a string but the yoyo doll doesn't display it appears broken in Internet Ex Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "YoYo goes up and down on a string but the yoyo doll doesn Watch "YoYo goes up and down on a string but the yoyo doll doesn New topic
Author

YoYo goes up and down on a string but the yoyo doll doesn't display it appears broken in Internet Ex

Radhika Srinivasan
Ranch Hand

Joined: Jul 28, 2009
Posts: 32
Write an applet that implements Runnable that simulates a yoyo going up and down on a string. Reduce flicker by only repainting the string and yoyo in the background color.



<html>
<head>
<title>YoYo Applet</title>
</head>
<body>
<applet code="YoYo" height="400" width="400">
</applet>
</body></html>


Modify program so that you have two yoyos of different colors and speeds. Create an HTML file that will put both of these yoyos side by side with appropriate headings.






Many thanks,
Radhika
Radhika Srinivasan
Ranch Hand

Joined: Jul 28, 2009
Posts: 32
Radhika Srinivasan wrote:Write an applet that implements . . .
[deleted]
Many thanks,
Radhika
[edit]The deleted text appears identical to the first post.[/edit]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18553
    
  40

Interesting homework problems. What issues are you running into? Meaning do you have a specific problem that you run into. And what have you tried?

We can't give you a hint in the right direction, if we don't know what you did. If you just show us the problem -- then the hint is... to try to attempt the assignment.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Radhika Srinivasan
Ranch Hand

Joined: Jul 28, 2009
Posts: 32
Thank you for the reply, I mean in YoYo.java program doll appears when I run it in Internet Explorer......

Below lines which I've marked it from YoYoB.java appears broken when I run in Internet Explorer........[meaning when I run both programs YoYoA.java and YoYoB.java the YoYo doll appears broken]

public void paint(Graphics g)
{
setBackground(Color.white);
/*
g.setColor(Color.red);
g.drawLine(x,100,x,y);
g.setColor(Color.green);
g.fillOval(x-10,y,20,20);
*/
[b] [/b]
try
{
Thread.sleep(sleep);
}
catch(InterruptedException e)
{}
repaint();


}
}
Kalabaw moo
Ranch Hand

Joined: May 26, 2009
Posts: 61
What do you mean broken? flickery?

I have the same problem in my code posted in applet this section but too bad nobody's replying just yet. I was able to get rid of the flickery by just double buffering, you could google that out - if that's the problem you're having.
Radhika Srinivasan
Ranch Hand

Joined: Jul 28, 2009
Posts: 32
It's appears broken only partially oval appears the complete body of YoYo doll doesn't appear
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38107
    
  22
Please don't quote long stretches of posts identical to previous posts; they are difficult to read. I have had to delete several hundred lines.
Radhika Srinivasan
Ranch Hand

Joined: Jul 28, 2009
Posts: 32
I'm done with this program ............ Thank you all ...........
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38107
    
  22
For the benefit of future readers, how did you sort it out?
Radhika Srinivasan
Ranch Hand

Joined: Jul 28, 2009
Posts: 32
The first applet should draw yoyo one and part of the stick figure arm. The second applet should draw the stick figure connecting the arms to the first and third applet. The third applet should draw yoyo two and part of the stick figure arm.
All I had to do is : I had to remove a thread in yoyo.java, just graphics.
.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38107
    
  22
Thank you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: YoYo goes up and down on a string but the yoyo doll doesn't display it appears broken in Internet Ex
 
Similar Threads
Need help on two compile errors
Start: applet not initialized
Why does this still flicker?
Start: Applet not initialized
custom cursor in XOR mode