From 1b7904d2578e735e44d7b6307e9833bd9069142c Mon Sep 17 00:00:00 2001 From: Gavin Li Date: Fri, 27 Feb 2015 22:46:42 -0500 Subject: [PATCH] Made some aesthetic changes --- MerchantRPGCSE2102/src/view/Test.java | 2 +- .../src/view/TransactionUI.java | 23 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/MerchantRPGCSE2102/src/view/Test.java b/MerchantRPGCSE2102/src/view/Test.java index 470a1a6..25daf01 100644 --- a/MerchantRPGCSE2102/src/view/Test.java +++ b/MerchantRPGCSE2102/src/view/Test.java @@ -71,7 +71,7 @@ public Test() { textField.setColumns(10); JLabel lblYouHave = new JLabel("You have:"); - lblYouHave.setBounds(61, 27, 86, 14); + lblYouHave.setBounds(61, 27, 299, 14); contentPane.add(lblYouHave); JButton btnCancel = new JButton("Cancel"); diff --git a/MerchantRPGCSE2102/src/view/TransactionUI.java b/MerchantRPGCSE2102/src/view/TransactionUI.java index b7990d0..aaa2875 100644 --- a/MerchantRPGCSE2102/src/view/TransactionUI.java +++ b/MerchantRPGCSE2102/src/view/TransactionUI.java @@ -8,6 +8,7 @@ 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; @@ -62,7 +63,7 @@ public TransactionUI(Transaction master) { setContentPane(contentPane); contentPane.setLayout(null); - JButton btnBuy = new JButton("BUY"); + JButton btnBuy = new JButton("BUY"); //creates a "Buy" button btnBuy.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } @@ -71,26 +72,26 @@ public void actionPerformed(ActionEvent arg0) { @Override public void mouseClicked(MouseEvent arg0) { System.out.println("BUY"); //temporary test code - if(!_inTransaction) + if(!_inTransaction) //checks if there is another transaction window open if not, then creates a buy transaction window createBuyWindow(); } }); btnBuy.setBounds(58, 155, 169, 105); contentPane.add(btnBuy); - JButton btnSell = new JButton("SELL"); + JButton btnSell = new JButton("SELL"); //creates a "Sell" button btnSell.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.out.println("SELL"); //temporary test code - if(!_inTransaction) + if(!_inTransaction) //checks if there is another transaction window open, if not creates a sell transaction window createSellWindow(); } }); btnSell.setBounds(351, 155, 169, 105); contentPane.add(btnSell); - JButton btnCancel = new JButton("Cancel"); + JButton btnCancel = new JButton("End Transaction"); //creates a button to end the transaction btnCancel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -98,11 +99,11 @@ public void mouseClicked(MouseEvent e) { if(!_inTransaction) { MASTER.actionCancel(); - exitWindow(); + exitWindow(); //Will end the transaction main screen but only if player does not have another transaction screen open } } }); - btnCancel.setBounds(246, 344, 89, 23); + btnCancel.setBounds(210, 310, 160, 50); contentPane.add(btnCancel); JLabel lblWouldYouLike = new JLabel("Would you like to:"); @@ -135,6 +136,8 @@ public static void createBuyWindow() final JFrame frame = new JFrame("Buy"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setBounds(100, 100, 400, 400); + frame.setUndecorated(true); + frame.getRootPane().setWindowDecorationStyle(JRootPane.NONE); JPanel contentPane = new JPanel(); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); @@ -220,6 +223,8 @@ public static void createSellWindow() final JFrame frame = new JFrame("Sell"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setBounds(100, 100, 400, 400); + frame.setUndecorated(true); + frame.getRootPane().setWindowDecorationStyle(JRootPane.NONE); JPanel contentPane = new JPanel(); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); @@ -232,6 +237,10 @@ public static void createSellWindow() itemList[i] = MASTER.getPlayer().getInventory()[i].getItemName(); itemList[i] = itemList[i] + " (x" + MASTER.getPlayer().getInventory()[i].getQuantity() + ")"; } + + JLabel lblYouHave = new JLabel(MASTER.getTargetMerchant().getName() + " has: $" + MASTER.getTargetMerchant().getCurrentCash()); + lblYouHave.setBounds(61, 27, 299, 14); + contentPane.add(lblYouHave); final JComboBox comboBox = new JComboBox(itemList); //create a drop-down menu for the player to choose from comboBox.setBounds(61, 141, 131, 20);