Java program doesnt work please help. import java.applet.*; import java.awt.*; import java.awt.event.*; public class Truck extends Applet implement ActionListener { int x,y,z; int t1,t2: Button b1,b2; String msg=" "; void slep() { try { Thread.sleep(100); } catch(Exception ex) { } } public void init() { t1=0; t2=1; X=20; y=60; setLayout(new FlowLayout(FlowLayout.CENTER)); Label 1=new Label("webeduclick"); b1=new Button("Forward"); add(b1); b2=new Button("Stop"); add(b2); b1.addActionListener(this); b2.addActionListener(this); } public void start() { } public void actionPerformed(ActionEvent e) { String s=e.getActionCommand(); if(s.equals("Stop")) { msg=" "; repaint(); } } public void paint(Graphics g) { setBackground(Color.green); z=getWidth(); Color c1=new Color(20.160.200); Color c2=new Color(200.60.200); g.setColor(c1); g.drawline(0,y+75,z,y=75); g.setColor(Color.yellow); g.fillRoundRect(x,y+20,100,40,5,5); g.fillArc(x+90,y+20,20,40,270,180); g.setColor(Color.orange); g.fillRoundRect(x+10,y,70,25,10,10); g.setColor(Color.blue); g.fillRect(x+20,y+5,20,25); g.fillRect(x+50,y+5,20,25); g.setColor(Color.Pink); g.fillRoundRect(x+55,y+10,10,10,20,10,10); g.fillOval(x+10,y+50,25,25); g.fillOval(x+60,y+50,25,25); g.setColor(Color.white); g.fillOval(x+15,y+55,10,10); g.fillOval(x+65,y+55,10,10); x=x+10; slep(); if(msg.equals("Forward")) { if(x+120

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Java program doesnt work please help. import java.applet.*; import java.awt.*; import java.awt.event.*; public class Truck extends Applet implement ActionListener { int x,y,z; int t1,t2: Button b1,b2; String msg=" "; void slep() { try { Thread.sleep(100); } catch(Exception ex) { } } public void init() { t1=0; t2=1; X=20; y=60; setLayout(new FlowLayout(FlowLayout.CENTER)); Label 1=new Label("webeduclick"); b1=new Button("Forward"); add(b1); b2=new Button("Stop"); add(b2); b1.addActionListener(this); b2.addActionListener(this); } public void start() { } public void actionPerformed(ActionEvent e) { String s=e.getActionCommand(); if(s.equals("Stop")) { msg=" "; repaint(); } } public void paint(Graphics g) { setBackground(Color.green); z=getWidth(); Color c1=new Color(20.160.200); Color c2=new Color(200.60.200); g.setColor(c1); g.drawline(0,y+75,z,y=75); g.setColor(Color.yellow); g.fillRoundRect(x,y+20,100,40,5,5); g.fillArc(x+90,y+20,20,40,270,180); g.setColor(Color.orange); g.fillRoundRect(x+10,y,70,25,10,10); g.setColor(Color.blue); g.fillRect(x+20,y+5,20,25); g.fillRect(x+50,y+5,20,25); g.setColor(Color.Pink); g.fillRoundRect(x+55,y+10,10,10,20,10,10); g.fillOval(x+10,y+50,25,25); g.fillOval(x+60,y+50,25,25); g.setColor(Color.white); g.fillOval(x+15,y+55,10,10); g.fillOval(x+65,y+55,10,10); x=x+10; slep(); if(msg.equals("Forward")) { if(x+120<z) { x=x+1; ShowStatus("Press Forward for Starting Truck")); repaint(); } } } } {

O Truck
Your name
Create JavaFX application that displays similar picture.
You can use your own color palette.
You do not have to match sizes exactly.
You are free to add more details, but do not forget to print your name in the lower right angle.
Transcribed Image Text:O Truck Your name Create JavaFX application that displays similar picture. You can use your own color palette. You do not have to match sizes exactly. You are free to add more details, but do not forget to print your name in the lower right angle.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY