List of usage examples for javax.swing Timer Timer
public Timer(int delay, ActionListener listener)
From source file:FontSizeAnimation.java
public FontSizeAnimation() { timer = new Timer(8, this); timer.setInitialDelay(190); timer.start(); }
From source file:Main.java
public Main() { this.setLayout(null); jlabel4.setBounds(0, 0, 100, 30);//w ww .ja v a 2 s .c o m this.add(jlabel4); this.pack(); t = new Timer(1000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { jlabel4.setText(new SimpleDateFormat("HH:mm:ss", Locale.FRANCE).format(new Date())); } }); t.start(); setSize(new Dimension(200, 60)); setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
From source file:Main.java
public Main() { setSize(250, 100);/* ww w . j a v a 2 s . co m*/ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Timer timer = new Timer(500, this); timer.start(); setVisible(true); }
From source file:Clipping.java
public Clipping() { timer = new Timer(15, this); timer.start(); }
From source file:MainClass.java
public MainClass() { super("Progress Monitor Demo"); setSize(250, 100);// w w w . j a v a 2 s . c o m setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Timer timer = new Timer(500, this); timer.start(); setVisible(true); }
From source file:SwingTimerBasedAnimationScaleRotate.java
public SwingTimerBasedAnimationScaleRotate() { timer = new Timer(10, this); timer.start(); }
From source file:MainClass.java
MainClass(String title) { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ActionListener a = new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Counter = " + counter); if (++counter > 10) { timer.stop();/* w w w . jav a 2 s . c om*/ System.exit(0); } } }; timer = new Timer(300, a); timer.start(); pack(); setVisible(true); }
From source file:Main.java
public TestPane() { Timer timer = new Timer(40, new ActionListener() { @Override//from w w w. ja v a2 s . com public void actionPerformed(ActionEvent e) { x += xDelta; if (x + (radius * 2) > getWidth()) { x = getWidth() - (radius * 2); xDelta *= -1; } else if (x < 0) { x = 0; xDelta *= -1; } repaint(); } }); timer.start(); }
From source file:Main.java
public Main() { setSize(250, 100);/*from ww w . j a v a2 s.c o m*/ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pbar = new ProgressMonitor(null, "Monitoring Progress", "Initializing . . .", 0, 100); // Fire a timer every once in a while to update the progress. Timer timer = new Timer(500, this); timer.start(); setVisible(true); }
From source file:Main.java
public Main() { try {/*from w w w . ja v a 2 s .c o m*/ robot = new Robot(); } catch (Exception e1) { e1.printStackTrace(); } timer = new Timer(3000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Rectangle size = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); Image image = robot.createScreenCapture(size); label.setIcon(new ImageIcon(image)); frame.setVisible(true); } }); timer.setRepeats(false); button.addActionListener(e -> { frame.setVisible(false); timer.start(); }); frame.add(button, BorderLayout.NORTH); frame.add(label, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1024, 768); frame.setVisible(true); }