Question
Create a Java program that Applies techniques involved in GUI design Keeps track of items in a list Instructions For this assignment, you will be
Create a Java program that
Applies techniques involved in GUI design
Keeps track of items in a list Instructions
For this assignment, you will be building a basic Shopping List application. The application should have a list with the items displayed, a textbox for adding new items to the list, and four buttons: Add, Remove,Load, and Save.
The Add button takes the contents of the text field (textbox) and adds the item in it to the list.
Your code must trim the whitespace in front of or at the end of the input in the text field. Infix whitespace is okay (e.g., honey mustard
the trim method will not remove the space between the words honey and mustard.)
Also, the text in the textbox should be converted to a lowercase representation (e.g., Honey Ham is converted to honey ham.)
The Remove button removes a selected item from the list.
The list should allow the user to select more than one item at a time.
If no items are selected when the user clicks this remove button, then the application should pop up a message box saying, Please select an item to delete! The Load button loads the previously saved grocery list into the list widget on your interface.
The Save button saves a copy of the grocery list to a file, named list.txt. If the list.txt file doesnt exist, this operation creates it. If it does exist, it will simply overwrite it.
Do not Use Joption Pane.
Here is the beganing of my program:
I have created a project on Net Beans with FXML Document.
The Gui interface is done. I need the code to complement the project
my FXMLDocumentController class is:
package myitemslistgui;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
public class FXMLDocumentController implements Initializable {
@FXML
private Label label;
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
label.setText("Hello World!");
}
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
}
My main Class is:
package myitemslistgui;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MyItemsListGUI extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
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