Skip to content

Commit

Permalink
Added TransactionUI class, build skeleton window.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Li committed Feb 23, 2015
1 parent 8c1d35a commit e69a1c9
Showing 1 changed file with 84 additions and 2 deletions.
86 changes: 84 additions & 2 deletions MerchantRPGCSE2102/src/view/TransactionUI.java
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit e69a1c9

Please sign in to comment.