Skip to content

Commit

Permalink
Made some aesthetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Li committed Feb 28, 2015
1 parent 1db941b commit 1b7904d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MerchantRPGCSE2102/src/view/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
23 changes: 16 additions & 7 deletions MerchantRPGCSE2102/src/view/TransactionUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
}
Expand All @@ -71,38 +72,38 @@ 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) {
System.out.println("Cancel"); //temporary test code
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:");
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand All @@ -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);
Expand Down

0 comments on commit 1b7904d

Please sign in to comment.