User Tools

Site Tools


writing_classes_practice

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
writing_classes_practice [2022/10/01 13:58] frchriswriting_classes_practice [2022/10/01 14:04] frchris
Line 22: Line 22:
 import javax.swing.Timer; import javax.swing.Timer;
  
-public class ClockTester extends JPanel implements KeyListener, ActionListener+public class ClockTester extends JPanel implements  ActionListener
 { {
  public static int WIDTH=800;  public static int WIDTH=800;
Line 53: Line 53:
  window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  window.getContentPane().add(app);  window.getContentPane().add(app);
- window.addKeyListener(app); 
- //window.pack(); 
  window.setVisible(true);  window.setVisible(true);
  
Line 75: Line 73:
  
  }  }
- // update is a workaround to cure Windows screen flicker problem +  
- public void update(Graphics g){ +
- paint(g); +
-+
- +
- // These 3 methods need to be declares to implement the KeyListener Interface +
- @Override +
- public void keyTyped(KeyEvent e) {} +
- +
- @Override +
- public void keyPressed(KeyEvent e) {} +
- +
- @Override +
- public void keyReleased(KeyEvent e) {} +
- @Override+
  public void actionPerformed(ActionEvent e) {  public void actionPerformed(ActionEvent e) {
  
writing_classes_practice.txt · Last modified: 2022/10/01 14:45 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki