| 1 | package tmcsim.client; |
|---|
| 2 | |
|---|
| 3 | import java.awt.Color; |
|---|
| 4 | import java.awt.Dimension; |
|---|
| 5 | import java.awt.Font; |
|---|
| 6 | import java.util.logging.Logger; |
|---|
| 7 | import javax.swing.BorderFactory; |
|---|
| 8 | import javax.swing.Box; |
|---|
| 9 | import javax.swing.BoxLayout; |
|---|
| 10 | import javax.swing.JFrame; |
|---|
| 11 | import javax.swing.JLabel; |
|---|
| 12 | import javax.swing.JPanel; |
|---|
| 13 | import javax.swing.WindowConstants; |
|---|
| 14 | |
|---|
| 15 | /** |
|---|
| 16 | * The CADClientView class is the view component to the CAD Client application. |
|---|
| 17 | * |
|---|
| 18 | */ |
|---|
| 19 | @SuppressWarnings("serial") |
|---|
| 20 | public class CADClockView extends JFrame |
|---|
| 21 | { |
|---|
| 22 | /** |
|---|
| 23 | * Error Logger. |
|---|
| 24 | */ |
|---|
| 25 | private static Logger cadLogger = Logger.getLogger("tmcsim.client"); |
|---|
| 26 | private JPanel mainPane; |
|---|
| 27 | private JLabel currentTime; |
|---|
| 28 | |
|---|
| 29 | /** |
|---|
| 30 | * Constructor. Build panes, add key listeners, and set up observer |
|---|
| 31 | * relationship between the footer and main panes. |
|---|
| 32 | * |
|---|
| 33 | * @param position The CAD position for this client terminal. |
|---|
| 34 | */ |
|---|
| 35 | public CADClockView() |
|---|
| 36 | { |
|---|
| 37 | super("Simulation Clock"); |
|---|
| 38 | this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); |
|---|
| 39 | currentTime = new JLabel("00:00:00"); |
|---|
| 40 | currentTime.setAlignmentX(Box.CENTER_ALIGNMENT); |
|---|
| 41 | currentTime.setFont(new Font("Geneva", Font.BOLD, 200)); |
|---|
| 42 | mainPane = new JPanel(); |
|---|
| 43 | setSize(new Dimension(1100, 255)); |
|---|
| 44 | setMaximumSize(new Dimension(1100, 255)); |
|---|
| 45 | setMinimumSize(new Dimension(1100, 255)); |
|---|
| 46 | mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS)); |
|---|
| 47 | mainPane.setBorder(BorderFactory.createLineBorder(Color.black)); |
|---|
| 48 | mainPane.setBackground(new Color(230, 230, 230)); // #E6E6E6 |
|---|
| 49 | mainPane.add(currentTime); |
|---|
| 50 | add(mainPane); |
|---|
| 51 | pack(); |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | public void updateTime(String msg) |
|---|
| 55 | { |
|---|
| 56 | currentTime.setText(msg); |
|---|
| 57 | } |
|---|
| 58 | } |
|---|