Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TextField yourTextField; // <-- global variable (initialized somewhere)
- public void keyPressed(KeyEvent e) {
- // ... all the other stuff
- textField.setText( Double.toString(velx) );
- }
- void updateUI() {
- // ... whatever else needs doing
- if( !textField.getText().equals( Double.toString(velx) ) ) {
- textField.setText( Double.toString(velx) );
- }
- }
- void mainLoop() {
- updateUI()
- }
- boolean velx_changed = false;
- velx++;
- velx_changed = true;
- void mainLoop() {
- if( velx_changed ) {
- textField.setText( Double.toString(velx) );
- }
- }
Add Comment
Please, Sign In to add comment