Skip to content
Snippets Groups Projects
Commit 04d60140 authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
# Mac file finder metadata
.DS_Store
# Windows file metadata
._*
# Thumbnail image caches
Thumbs.db
ethumbs.db
# MS Office temporary file
~*
# Emacs backup file
*~
# Common
[Bb]in/
[Bb]uild/
[Oo]bj/
[Oo]ut/
[Tt]mp/
[Xx]86/
[Ii][Aa]32/
[Xx]64/
[Xx]86_64/
[Xx]86-64/
[Aa]rm
[Aa]32
[Tt]32
[Aa]64
*.tmp
*.bak
*.bk
*.swp
# Java files
*.class
javadoc/
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# JetBrains (IntelliJ IDEA, PyCharm, etc) files
.idea/
cmake-build-*/
*.iml
*.iws
*.ipr
# Eclipse files
.settings/
.project
.classpath
.buildpath
.loadpath
.factorypath
local.properties
pom.xml 0 → 100644
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.unl.cse.soft161.event_driven</groupId>
<artifactId>event_driven</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>event_driven</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
</dependencies>
</project>
package edu.unl.cse.soft161.event_driven;
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class PurchasingApp extends Application {
@Override
public void start(Stage stage) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("/edu/unl/cse/soft161/event_driven/PurchasingApp.fxml"));
stage.setTitle("Purchasing App");
stage.setScene(new Scene(root));
stage.show();
}
public static void main(String... arguments) {
Application.launch(PurchasingApp.class, arguments);
}
}
package edu.unl.cse.soft161.event_driven;
import java.io.IOException;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Parent;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
public class PurchasingAppController {
private int[] amounts = new int[4];
@FXML
private Parent mainPage;
@FXML
private Parent amountPage;
@FXML
private Label cart;
@FXML
private TextField amountField;
@FXML
private Label errorMessage;
public void initialize() {
mainPage.toFront();
cart.setText("You have 0 item(s) in your cart.");
System.out.println("ran initialize");
}
@FXML
private void onFirstProduct(ActionEvent event) {
System.out.println("ran onFirstProduct");
}
@FXML
private void onSecondProduct(ActionEvent event) {
System.out.println("ran onSecondProduct");
}
@FXML
private void onThirdProduct(ActionEvent event) {
System.out.println("ran onThirdProduct");
}
@FXML
private void onFourthProduct(ActionEvent event) {
System.out.println("ran onFourthProduct");
}
@FXML
private void onCancel(ActionEvent event) {
System.out.println("ran onCancel");
}
@FXML
private void onOK(ActionEvent event) {
System.out.println("ran onOK");
}
@FXML
private void onCheckout(ActionEvent event) {
System.out.println("ran onCheckout");
System.exit(0);
}
}
* {
-fx-font-size: 16pt;
}
.page {
-fx-padding: 24px;
-fx-background-color: WHITE;
}
.header {
-fx-alignment: CENTER;
}
.header * {
-fx-font-size: 20pt;
}
.form {
-fx-alignment: CENTER;
-fx-padding: 64 0;
}
.form .column {
-fx-spacing: 8;
}
.form .row {
-fx-alignment: BASELINE_RIGHT;
-fx-spacing: 8;
}
.form .row .product {
-fx-pref-width: 192;
}
.form .row .field {
-fx-pref-width: 192;
}
.form .wrapping {
-fx-wrap-text: true;
}
.form .error {
-fx-text-fill: RED;
}
.footer {
-fx-alignment: BASELINE_RIGHT;
-fx-spacing: 4;
}
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.URL?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<StackPane
xmlns:fx="http://javafx.com/fxml"
fx:controller="edu.unl.cse.soft161.event_driven.PurchasingAppController">
<BorderPane styleClass="page" fx:id="mainPage">
<top>
<HBox styleClass="header">
<Label text="Select a Product"/>
</HBox>
</top>
<center>
<HBox styleClass="form">
<VBox styleClass="column">
<HBox styleClass="row">
<Label styleClass="wrapping" fx:id="cart"/>
</HBox>
<HBox styleClass="row">
<Button styleClass="product" text="First Product" onAction="#onFirstProduct"/>
<Button styleClass="product" text="Second Product" onAction="#onSecondProduct"/>
</HBox>
<HBox styleClass="row">
<Button styleClass="product" text="Third Product" onAction="#onThirdProduct"/>
<Button styleClass="product" text="Fourth Product" onAction="#onFourthProduct"/>
</HBox>
</VBox>
</HBox>
</center>
<bottom>
<HBox styleClass="footer">
<Button onAction="#onCheckout" text="To Checkout"/>
</HBox>
</bottom>
</BorderPane>
<BorderPane styleClass="page" fx:id="amountPage">
<top>
<HBox styleClass="header">
<Label text="Enter an Amount"/>
</HBox>
</top>
<center>
<HBox styleClass="form">
<VBox styleClass="column">
<HBox styleClass="row">
<Label text="Amount: "/>
<TextField styleClass="field" fx:id="amountField"/>
</HBox>
<HBox>
<Label styleClass="error" fx:id="errorMessage"/>
</HBox>
</VBox>
</HBox>
</center>
<bottom>
<HBox styleClass="footer">
<Button onAction="#onCancel" text="Cancel"/>
<Button onAction="#onOK" text="OK"/>
</HBox>
</bottom>
</BorderPane>
<stylesheets>
<URL value="@PurchasingApp.css"/>
</stylesheets>
</StackPane>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment