예제 #1
2
  public DisplayClock() {
    // Create an analog clock for the current time
    StillClock clock = new StillClock();

    // Display hour, minute, and seconds in the message panel
    MessagePanel messagePanel =
        new MessagePanel(clock.getHour() + ":" + clock.getMinute() + ":" + clock.getSecond());
    messagePanel.setCentered(true);
    messagePanel.setForeground(Color.blue);
    messagePanel.setFont(new Font("Courie", Font.BOLD, 16));

    // Add the clock and message panel to the frame
    add(clock);
    add(messagePanel, BorderLayout.SOUTH);
  }
예제 #2
0
	public TestFontMetrics () {
		MessagePanel messagePanel = new MessagePanel ("");
      
		messagePanel.setFont(new Font("SansSerif", Font.BOLD, 20));
      
		messagePanel.setCentered(true);
      
		getContentPane().add(messagePanel);
		getContentPane().add(jbtRefresh);
				
	        //ButtonListener btListener = new ButtonLIstener();

		//jbtRefresh.addActionListener(btListener);
	}