From e69a1c9d6415c228daad4e8dc31880f3f122f49a Mon Sep 17 00:00:00 2001 From: Gavin Li Date: Mon, 23 Feb 2015 15:43:18 -0500 Subject: [PATCH] Added TransactionUI class, build skeleton window. --- .../src/view/TransactionUI.java | 86 ++++++++++++++++++- 1 file changed, 84 insertions(+), 2 deletions(-) diff --git a/MerchantRPGCSE2102/src/view/TransactionUI.java b/MerchantRPGCSE2102/src/view/TransactionUI.java index f759984..7d67bda 100644 --- a/MerchantRPGCSE2102/src/view/TransactionUI.java +++ b/MerchantRPGCSE2102/src/view/TransactionUI.java @@ -1,6 +1,88 @@ package view; -public class TransactionUI -{ +import java.awt.BorderLayout; +import java.awt.EventQueue; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JButton; +import javax.swing.JLabel; +import java.awt.Font; +import javax.swing.JTextField; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class TransactionUI extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + TransactionUI frame = new TransactionUI(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public TransactionUI() { + setTitle("Transaction Window"); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 600, 430); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(null); + + JButton btnNewButton = new JButton("BUY"); + btnNewButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + System.out.println("BUY"); //temporary test code + } + }); + btnNewButton.setBounds(58, 155, 169, 105); + contentPane.add(btnNewButton); + + JButton btnSell = new JButton("SELL"); + btnSell.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + System.out.println("SELL"); //temporary test code + } + }); + btnSell.setBounds(351, 155, 169, 105); + contentPane.add(btnSell); + + JButton btnCancel = new JButton("Cancel"); + btnCancel.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + System.out.println("Cancel"); //temporary test code + } + }); + btnCancel.setBounds(246, 344, 89, 23); + contentPane.add(btnCancel); + + JLabel lblWouldYouLike = new JLabel("Would you like to:"); + lblWouldYouLike.setFont(new Font("Tahoma", Font.PLAIN, 15)); + lblWouldYouLike.setBounds(233, 76, 193, 32); + contentPane.add(lblWouldYouLike); + + JLabel lblOr = new JLabel("OR"); + lblOr.setFont(new Font("Tahoma", Font.PLAIN, 15)); + lblOr.setBounds(277, 189, 35, 32); + contentPane.add(lblOr); + } }