source: tmcsimulator/trunk/src/tmcsim/client/CADClockView.java @ 62

Revision 62, 1.7 KB checked in by jdalbey, 9 years ago (diff)

Clock Client version 1 done.

Line 
1package tmcsim.client;
2
3import java.awt.Color;
4import java.awt.Dimension;
5import java.awt.Font;
6import java.util.logging.Logger;
7import javax.swing.BorderFactory;
8import javax.swing.Box;
9import javax.swing.BoxLayout;
10import javax.swing.JFrame;
11import javax.swing.JLabel;
12import javax.swing.JPanel;
13import javax.swing.WindowConstants;
14
15/**
16 * The CADClientView class is the view component to the CAD Client application.
17 *
18 */
19@SuppressWarnings("serial")
20public 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}
Note: See TracBrowser for help on using the repository browser.