***Please keep given code intact***
Write a JavaFX application that displays a label and a Button to
a frame in the FXBookQuote2 program. When the user clicks the
button, display the title of the book that contains the opening
sentence or two from your favorite book in the label.
FXBookQuote2.java
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fxbookquote2;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
* @author profs
*/
public class FXBookQuote2 extends Application {
@Override
public void start(Stage stage) throws Exception {
// your code here
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
FXMLDocument.fxml
FXMLDocumentController.java
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fxbookquote2;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
/**
*
* @author profs
*/
public class FXMLDocumentController implements Initializable
{
// your code here
@FXML
private void handleButtonAction(ActionEvent event) {
// your code here
}
@Override
public void initialize(URL url, ResourceBundle rb) {
// Leave empty
}
}
FXBookQuote2.java (Main class)
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fxbookquote2;
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
* @author profs
*/
public class FXBookQuote2 extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root =
FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setTitle("Book Quote");
stage.setScene(scene);
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
FXMLDocumentController,java
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fxbookquote2;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.Region;
/**
*
* @author profs
*/
public class FXMLDocumentController implements Initializable
{
@FXML private Label bookQuteLabel;
@FXML private Button displayButton;
private String quoteMessage;
@FXML
private void handleButtonAction(ActionEvent event) {
bookQuteLabel.setMinHeight(Region.USE_PREF_SIZE);
// to make the display button multi-functional: Display and
Reset
if(displayButton.getText().equals("Display"))
{
// this message can be changed
quoteMessage = "\"Tiny bumps in time shape our lives, even though
we spend hours trying to make long-term plans.\"\n"
+ "\nBook Title: Half Girlfriend";
bookQuteLabel.setText(quoteMessage);
displayButton.setText("Reset");
}
else if(displayButton.getText().equals("Reset"))
{
quoteMessage = "Book Quote";
bookQuteLabel.setText(quoteMessage);
displayButton.setText("Display");
}
}
@Override
public void initialize(URL url, ResourceBundle rb) {
// Leave Empty
}
}
FXMLDocument.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.text.Font?>
<AnchorPane id="AnchorPane" prefHeight="279.0"
prefWidth="448.0" xmlns:fx="http://javafx.com/fxml/1"
xmlns="http://javafx.com/javafx/8.0.171"
fx:controller="fxbookquote2.FXMLDocumentController">
<children>
<HBox alignment="CENTER" layoutX="14.0" layoutY="24.0"
prefHeight="100.0" prefWidth="421.0">
<children>
<Label fx:id="bookQuteLabel" text="Book Quote"
textAlignment="CENTER" wrapText="true">
<font>
<Font size="16.0" />
</font>
</Label>
</children>
</HBox>
<Button fx:id="displayButton" layoutX="197.0" layoutY="202.0"
mnemonicParsing="false" onAction="#handleButtonAction"
text="Display">
<font>
<Font size="15.0" />
</font>
</Button>
</children>
</AnchorPane>
****************************************************************** SCREENSHOT *********************************************************


***Please keep given code intact*** Write a JavaFX application that displays a label and a Button...
I receive an error illegal start of expression starting at "public class Ingredient {". How would I fix this error? * * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package SteppingStones; /** * * * * @author jennifer.cook_snhu * */ public class SteppingStone2_IngredientCalculator { /** * * @param args the command line arguments ...
1. Write a Java program to count all words in a string. User inputs a string sentence and your program should count the number of words in that string. Test Data: Input the string: The quick brown fox jumps over the lazy dog. Expected Output: Number of words in the string: 9 2. Write a class called ATMTransaction. This class has a variable balance and account number. It has three methods, checkBalance, deposit and withdraws along with constructors getters and...
Hello, How can I make the program print out "Invalid data!!" and nothing else if the file has a grade that is not an A, B, C, D, E, or F or a percentage below zero? I need this done by tomorrow if possible please. The program should sort a file containing data about students like this for five columns: one for last name, one for first name, one for student ID, one for student grade percentage, one for student...
Java Homework Problems: 4. • Examine AddImport.java. – Perform the following: – Replace the fully qualified name to access the Jlabel component with an import statement. – To import classes from the util package, replace multiple import statements with a single import statement. /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Calendar; import java.util.Date; public...
Course,java
import java.util.ArrayList;
import java.util.Arrays;
/*
* To change this license header, choose License Headers in
Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author fenghui
*/
public class Course {
private String cName;
private ArrayList<Subject>
cores;
private ArrayList<Major>
majors;
private ArrayList<Subject>
electives;
private int cCredit;
public Course(String n, int cc){
cName = n;
cCredit =
cc;
cores = new
ArrayList<Subject>(0);
majors =...
Modify the JavaFX TipCalculator application program to allow the user to enter the number of persons in the party through a text field. Calculate and display the amount owed by each person in the party if the bill is to be split evenly among the party members. /////////// TipCalculatorController.java: import java.math.BigDecimal; import java.math.RoundingMode; import java.text.NumberFormat; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.control.Slider; import javafx.scene.control.TextField; public class TipCalculatorController { // formatters for currency and percentages private...
//No JPanel please: Write a javafx application that displays an image and //plays a sound effect with each mouse click. Rotate through four images and //five sound effects, so the image/sound effect pairing is different each time. //What my problem is on is actually getting the pictures to switch. The x variable //works perfect for the sound change but I am unsure what to do with y for the //image change. Also I dont know if I should put this...
Examine the following code and complete missing parts:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class NtoThePowerOfN extends Application{
@Override
public void start(Stage primaryStage) throws Exception {
TextField inputField;
TextField outputField;
VBox base = new VBox(10);
base.setPadding(new Insets(10));
base.setAlignment(Pos.CENTER);
//
// A: input components - label and text field
//
//
// B: button - to compute the value
//
//
//...
JavaFX! Just need to fill several lanes of code please!!!
CSE205 OOP and Data Structure Quiz #15 Last Name (print) First Name (print) Write a JavaFX GUI application program that simulates a timer. The timer should show "count: the beginning and increase the number by 1 in every one second, and so on. o" at .3 A Timer - × A Timer Count: 0 Count: 1 (B) After 1 second, the GUI Window (A) Initial GUI Window According to the...