Created
May 23, 2014 17:38
-
-
Save firejox/adc075d4458c92261a1d to your computer and use it in GitHub Desktop.
ce1002.a12.s101201046
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ce1002.a12.s101201046; | |
import java.awt.event.*; | |
import java.awt.*; | |
import javax.swing.*; | |
public class A12 extends KeyAdapter { | |
static JFrame jf; | |
static { //initial JFrame | |
jf = new JFrame("A12"); | |
jf.getContentPane().setLayout(null); | |
jf.getContentPane().setPreferredSize(new Dimension(500, 500)); | |
jf.setLocation(300, 300); | |
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
jf.setVisible(true); | |
jf.requestFocusInWindow(); | |
jf.pack(); | |
} | |
public static void main(String[] args) { | |
jf.addKeyListener(new A12()); //set keylistener | |
} | |
public void keyPressed(KeyEvent e) { | |
new Thread(new MovingButton()).start(); //create thread | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment