Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.applet.*;
- import java.awt.*;
- import java.awt.event.KeyEvent;
- import java.awt.event.KeyListener;
- public class PrimarySC extends Applet implements Runnable, KeyListener {
- private static final long serialVersionUID = 1L;
- public void init() {
- setSize(400,400);
- setBackground(Color.white);
- }
- public void start() {
- Thread th = new Thread(this);
- th.start();
- }
- public void stop() {
- }
- public void run() {
- Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
- while(true) {
- repaint();
- try {
- Thread.sleep(20);
- } catch (InterruptedException ex) {
- }
- }
- }
- public void paint (Graphics g) {
- g.setColor(Color.gray);
- g.fillRect(10, 400, 30, 100);
- }
- public void keyPressed(KeyEvent e) {
- }
- public void keyReleased(KeyEvent e) {
- }
- public void keyTyped(KeyEvent e) {
- int c = e.getKeyChar();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement