Advanced Java Chapter 14 Assignment

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Predict the output of the following program, how will the buttons be arranged? import javafx.application.Application; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.stage.Stage; import javafx.scene.layout.VBox; public class VBoxExample extends Application { @Override public void start(Stage stage) { //creating a button field Button btn1 = new Button("Button1"); //creating a button field Button btn2 = new Button("Button2"); //creating a button field Button btn3 = new Button("Button3"); //Instantiating the HBox class VBox vbox = new VBox(); //Setting the space between the nodes of a HBox pane vbox.setSpacing(10); //Setting the margin to the nodes vbox.setMargin(btn1, new Insets(20, 20, 20, 20)); vbox.setMargin(btn2, new Insets(20, 20, 20, 20)); vbox.setMargin(btn3, new Insets(20, 20, 20, 20)); //retrieving the observable list of the HBox ObservableList list = vbox.getChildren(); //Adding all the nodes to the observable list (HBox) list.addAll(btn1, btn2, btn3); //Creating a scene object Scene scene = new Scene(vbox); //Setting title to the Stage stage.setTitle("Hbox Example"); //Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); } public static void main(String args[]){ launch(args); } }

All the buttons will be placed in a single column one after another

Using JavaFx Line Class, what properties do you need to set to draw a line?

Line ln = new Line(); line.setStartX(numeric value); line.setStartY(numeric value); line.setEndX(numeric value); line.setEndY(numeric value);

JavaFx Application has three major components?

Stage Scene Nodes

Predict the output of the below program? import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleDoubleProperty; public class BidirectionalBindingDemo { public static void main(String[] args) { DoubleProperty d1 = new SimpleDoubleProperty(1); DoubleProperty d2 = new SimpleDoubleProperty(2); d1.bindBidirectional(d2); d1.setValue(50.1); System.out.println("d1 is " + d1.getValue() + " and d2 is " + d2.getValue()); } }

d1 is 50.1 and d2 is 50.1

Predict the output of the following program? import javafx.application.Application; import javafx.stage.Stage; public class Test extends Application { public Test() { System.out.println("Test constructor is invoked"); } @Override // Override the start method in the Application class public void start(Stage primaryStage) { System.out.println("start method is invoked"); } public static void main(String[] args) { System.out.println("launch application"); Application.launch(args); } }

launch application Test constructor is invoked Start method is invoked


Kaugnay na mga set ng pag-aaral

General Science II - Unit 3: Structure of Matter (Part 2) QUIZ 3: BASES

View Set

Mental: Ch 21 Somatic Symptom Disorders, Ch 21- Somatic Symptom Illnesses, NU245- Chapter 21: Somatic Symptom Illnesses, ch 21 NCLEX questions, Psychiatric - Chp 21

View Set

NU220 pharmacology chapter 2: basic concepts and processes

View Set