From 1a897e996f76413b8ac715b00e542b5c71e3304b Mon Sep 17 00:00:00 2001 From: Gavin Li Date: Fri, 27 Feb 2015 22:53:03 -0500 Subject: [PATCH] Updated TransactionUI and removed unnecessary Test class --- MerchantRPGCSE2102/src/view/Test.java | 86 ------------------- .../src/view/TransactionUI.java | 8 +- 2 files changed, 2 insertions(+), 92 deletions(-) delete mode 100644 MerchantRPGCSE2102/src/view/Test.java diff --git a/MerchantRPGCSE2102/src/view/Test.java b/MerchantRPGCSE2102/src/view/Test.java deleted file mode 100644 index 25daf01..0000000 --- a/MerchantRPGCSE2102/src/view/Test.java +++ /dev/null @@ -1,86 +0,0 @@ -package view; - -import java.awt.BorderLayout; -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import javax.swing.JComboBox; -import javax.swing.JTextField; -import javax.swing.JSlider; -import javax.swing.JLabel; -import javax.swing.JButton; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import javax.swing.JTextPane; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -public class Test extends JFrame { - - private JPanel contentPane; - private JTextField textField; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - Test frame = new Test(); - frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the frame. - */ - public Test() { - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setBounds(100, 100, 400, 400); - contentPane = new JPanel(); - contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); - setContentPane(contentPane); - contentPane.setLayout(null); - - JComboBox comboBox = new JComboBox(); - comboBox.setBounds(61, 141, 131, 20); - contentPane.add(comboBox); - - JLabel lblSelectTheItem = new JLabel("Select the Item you want:"); - lblSelectTheItem.setBounds(61, 105, 168, 14); - contentPane.add(lblSelectTheItem); - - JLabel lblSelectTheAmount = new JLabel("Enter the amount you wish to sell:"); - lblSelectTheAmount.setBounds(61, 197, 275, 30); - contentPane.add(lblSelectTheAmount); - - JButton btnAccept = new JButton("Accept"); - btnAccept.setBounds(247, 306, 89, 23); - contentPane.add(btnAccept); - - textField = new JTextField(); - textField.setBounds(61, 238, 86, 20); - contentPane.add(textField); - textField.setColumns(10); - - JLabel lblYouHave = new JLabel("You have:"); - lblYouHave.setBounds(61, 27, 299, 14); - contentPane.add(lblYouHave); - - JButton btnCancel = new JButton("Cancel"); - btnCancel.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - } - }); - btnCancel.setBounds(61, 306, 89, 23); - contentPane.add(btnCancel); - } -} diff --git a/MerchantRPGCSE2102/src/view/TransactionUI.java b/MerchantRPGCSE2102/src/view/TransactionUI.java index aaa2875..8d1be0e 100644 --- a/MerchantRPGCSE2102/src/view/TransactionUI.java +++ b/MerchantRPGCSE2102/src/view/TransactionUI.java @@ -1,15 +1,11 @@ package view; -import java.awt.BorderLayout; import java.awt.EventQueue; -import javax.swing.BoxLayout; -import javax.swing.ComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JRootPane; -import javax.swing.JSlider; import javax.swing.border.EmptyBorder; import javax.swing.JButton; import javax.swing.JLabel; @@ -26,9 +22,9 @@ import java.awt.event.ActionListener; import java.awt.event.ActionEvent; +@SuppressWarnings("serial") public class TransactionUI extends JFrame { - private static final ComboBoxModel[] Item = null; private JPanel contentPane; private static Transaction MASTER; //TransactionUI class will hold the instance of the Transaction that created it private static boolean _inTransaction; //Prevents the user from making multiple transaction windows @@ -144,7 +140,7 @@ public static void createBuyWindow() frame.setContentPane(contentPane); contentPane.setLayout(null); - String[] itemList = new String[MASTER.getTargetMerchant().getInventory().length]; //create a new array of strings with the length of the player's inventory //item that the player chooses from the combobox + String[] itemList = new String[MASTER.getTargetMerchant().getInventory().length]; //create a new array of strings with the length of the player's inventory for(int i = 0; i < itemList.length; i++) //adds all the item names to the item list { itemList[i] = MASTER.getTargetMerchant().getInventory()[i].getItemName();