Question
Create a GUI using Java FX for one of the previous programming projects. Convert all console input/output to be used in a GUI. Follow standard
Create a GUI using Java FX for one of the previous programming projects. Convert all console input/output to be used in a GUI. Follow standard programming practices for the design of the GUI. See this link for more details (Links to an external site.)Links to an external site.. (http://usabilitypost.com/2009/04/15/8-characteristics-of-successful-user-interfaces/)
Have fun with it.
Submission:
Submit the executable jar file so that I can run your program. See this link on how to make an executable jar file. (Links to an external site.)Links to an external site.
*********************************************************************************************************************************************************************************************************************
package runnable; public class MainClass { public static void main(String args[]) { Food food = new Food(); Animal turtle = new Animal("Donatello the Turtle", 0, 3, 100, food);// the smartest ninja turtle Animal rabbit = new Animal("Fluffy the Rabbit", 0, 5, 150, food);// :) Thread turtleThread = new Thread(turtle); Thread rabbitThread = new Thread(rabbit); turtleThread.start(); rabbitThread.start(); } }
*********************************************************************************************************************************************************************************************************************
package runnable; public class Animal implements Runnable{ static boolean isGameDone; String name; int position; int speed; int maxRest; Food food; public Animal(String name, int pos, int speed, int maxrest, Food food) { isGameDone = false; this.name = name; this.position = pos; this.speed = speed; this.maxRest = maxrest; this.food = food; }
public void run() { while(position<100 && !isGameDone) { position += speed; System.out.println(this); food.eat(maxRest); } isGameDone = true; System.exit(0); } public int getPosition() { return position; } public String toString() { return "Player:" + name + "Current Standing in race: " + position; } }
*********************************************************************************************************************************************************************************************************************
package runnable; public class Food { public synchronized void eat(int time) { try { System.out.println(" I'm currently eating."); Thread.sleep(time*10); System.out.println(" I'm offically done eating."); } catch (InterruptedException e) { e.printStackTrace(); }}}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started