Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package layout_managers;
- import java.awt.*;
- import javax.swing.*;
- import java.awt.event.*;
- import java.util.Calendar;
- public class GUI_Clock extends JFrame {
- JPanel timeDisplay;
- JLabel hours, minutes, seconds, am_pm;
- public GUI_Clock() {
- setLayout(new GridLayout(2, 1));
- hours = new JLabel();
- hours.setBackground(Color.RED);
- hours.setVisible(true);
- minutes = new JLabel();
- minutes.setBackground(Color.BLUE);
- minutes.setVisible(true);
- seconds = new JLabel();
- seconds.setBackground(Color.GREEN);
- seconds.setVisible(true);
- am_pm = new JLabel();
- am_pm.setBackground(Color.WHITE);
- am_pm.setVisible(true);
- timeDisplay = new JPanel(new GridLayout(1, 3));
- timeDisplay.add(hours);
- timeDisplay.add(minutes);
- timeDisplay.add(seconds);
- //timeDisplay.add(am_pm);
- add(timeDisplay);
- add(am_pm);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement