Please help me figure out how to complete this code. I am obviously lost in the
ID: 3823364 • Letter: P
Question
Please help me figure out how to complete this code. I am obviously lost in the world of Java. Thank you!
import java.awt.*;
public class Marquee extends Applet
{
String s = new String("Event Handlers Incorporated - Choose " +
"us for your party needs");
int b = 0;
int e = 0;
int x = 300;
public void paint(Graphics g)
{
g.drawString(s.substring(b,e),x,100);
e++;
x = x - 5;
if(e == (s.length() + 1))
{
e = 0;
//Insert missing code here.
}
try
{
Thread.sleep(300);
}
catch(Exception e)
{
}
repaint();
}
}
Explanation / Answer
Marquee.java
import java.applet.Applet;
import java.awt.Graphics;
public class Marquee extends Applet
{
String s = new String("Event Handlers Incorporated - Choose " +
"us for your party needs");
int b = 0;
int e = 0;
int x = 300;
public void paint(Graphics g)
{
g.drawString(s.substring(b,e),x,100);
e++;
x = x - 5;
if(e == (s.length() + 1))
{
e = 0;
x = 300;
//Insert missing code here.
}
try
{
Thread.sleep(300);
}
catch(Exception e)
{
}
repaint();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.