import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Date; import java.text.SimpleDateFormat; public class Ora extends JFrame { final static long serialVersionUID = 1; OraFelirat of = new OraFelirat(); public Ora() { of.setLocation(50, 0); this.getContentPane().setBackground(Color.BLACK); this.add(of); this.setLayout(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(370, 150); this.setVisible(true); } public static void main(String[] args) { new Ora(); } } class OraFelirat extends JLabel implements ActionListener { final static long serialVersionUID=1; SimpleDateFormat sdf; public OraFelirat() { this.setForeground(Color.GREEN); this.setSize(350, 120); this.setFont(new Font("sans-serif", Font.PLAIN, 60)); sdf = new SimpleDateFormat("HH:mm:ss"); Timer t = new Timer(1000, this); t.start(); } public void actionPerformed(ActionEvent e) { Date d = new Date(); this.setText(sdf.format(d)); } }