JavaFx Basics! We made it to Graphical programming and Event Driven Programming using JavaFx. NOTE: Chapter 14 and 15 wi

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

JavaFx Basics! We made it to Graphical programming and Event Driven Programming using JavaFx. NOTE: Chapter 14 and 15 wi

Post by answerhappygod »

Javafx Basics We Made It To Graphical Programming And Event Driven Programming Using Javafx Note Chapter 14 And 15 Wi 1
Javafx Basics We Made It To Graphical Programming And Event Driven Programming Using Javafx Note Chapter 14 And 15 Wi 1 (344.54 KiB) Viewed 47 times
this is the code, add on to this
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.CullFace;
import javafx.scene.shape.Line;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Sphere;
import javafx.stage.Stage;
/**
*
* @author Administrator
*/
public class MyFirstJavaFx extends Application {
@Override
public void start(Stage stage) {
initUI(stage);
}
private void initUI(Stage stage) {
Sphere sphere = new Sphere();
sphere.setRadius(50.0);
sphere.setTranslateX(500);
sphere.setTranslateY(150);
sphere.setCullFace(CullFace.NONE);
Rectangle rectangle = new Rectangle(50, 50, 100, 75);
rectangle.setFill(Color.CYAN);
rectangle.setStroke(Color.BLACK);
Line line = new Line(160, 75, 230, 40);
line.setStroke(Color.BLACK);
Circle circle = new Circle(130, 160, 30);
circle.setFill(Color.CHOCOLATE);
Pane root1=new Pane();
root1.getChildren().addAll(sphere,rectangle,line,circle);
Scene scene = new Scene(root1, 600, 300);
stage.setTitle("Basic Graphical Java Program");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
JavaFx Basics! We made it to Graphical programming and Event Driven Programming using JavaFx. NOTE: Chapter 14 and 15 will not be covered on the FINAL EXAM, so have fun and practice programming in Graphical. Since we have experience now with Object Oriented Programming, we are able to use the Java APIs from the JavaFx libraries and we are inheriting from base classes to create our GUI Programs. Create a Graphical Event Driven Program using JavaFx. Some reference material if you want to get fancy and have a lot of fun: https://javadoc.io/doc/org.openjfx/java ... p-doc.html https://openjfx.io/javadoc/11/javafx.gr ... ation.html Note: You can add on Event Driven to your Chapter 14 submission or create a new GUI application for Chapter 15. 1. [15 points] Submit MyFirst JavaFxEvent.java - create a basic Graphical Event-Driven Java Program using Application, Scene, Pane, and one or 2 other objects such as Color and/or Image, and Events from the Mouse and/or Keyboard.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply