Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Name: Nick Conklin
- Course: CNT 4714 – Spring 2018
- Assignment title: Program 1 – Event-driven Programming
- Date: Sunday January 28, 2018
- */
- package com.conklin;
- import javax.swing.*;
- import java.awt.event.*;
- import java.io.*;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- import java.util.List;
- import java.util.ArrayList;
- public class App extends JFrame {
- private JPanel pnlMain;
- private JButton btnProcess;
- private JButton btnConfirm;
- private JButton btnViewOrder;
- private JButton btnFinishOrder;
- private JButton btnNewOrder;
- private JButton btnExit;
- private JTextField txtOrderQty;
- private JTextField txtBookId;
- private JTextField txtBookQty;
- private JTextField txtItemInfo;
- private JTextField txtSubtotal;
- private JLabel lblOrderQty;
- private JLabel lblBookId;
- private JLabel lblBookQty;
- private JLabel lblItemInfo;
- private JLabel lblSubtotal;
- public App() {
- public static void updateLabelsAndButtons() {
- }
- // Action Listener for the Exit button
- btnExit.addActionListener(e -> System.exit(0));
- // Key Listener Event for the Order Qty Text Field
- txtOrderQty.addKeyListener(new KeyAdapter() {
- @Override
- public void keyPressed(KeyEvent e) {
- // Get the string value of what was entered into the order qty text field
- String strOrderQty = txtOrderQty.getText();
- // Convert it into an integer for use later
- int orderQty = 0;
- try {
- orderQty = Integer.parseInt(txtOrderQty.getText());
- } catch (NumberFormatException nfe) {
- JOptionPane.showMessageDialog(null, "Please input a number!");
- }
- }
- });
- btnProcess.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- }
- });
- }
- public static void main(String[] args) {
- List<String> bookIDList = new ArrayList<String>();
- Path fileName = Paths.get("inventory.txt");
- try (InputStream in = Files.newInputStream(fileName);
- BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
- String line = null;
- while ((line = reader.readLine()) != null) {
- System.out.println(line);
- }
- } catch (IOException x) {
- System.err.println(x);
- }
- JFrame frame = new JFrame("App");
- frame.setContentPane(new App().pnlMain);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.pack();
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement