Witam! Chodzi o to, że chcę zrobić pewien program... I... Chodzi o to, że normalnie zaraz po uruchomieniu robi to co ma robić (później będzie robić coś innego). Ale gdy kliknę gdziekolwiek czy coś, to już program nie jest aktywny i nic nie sprawdza ;-;. Jak można to zmienić?
Tu kod:
import java.awt.Color;
import java.awt.Window.Type;
import java.awt.event.*;
import javax.swing.JFrame;
public class TestClass implements KeyListener{
JFrame f;
public static void main(String[] args){
new TestClass();
}
public TestClass() {
f = new JFrame();
f.setSize(0,0);
f.setUndecorated(true);
f.setBackground(new Color(1.0f,1.0f,1.0f,0f));
f.setAutoRequestFocus(true);
f.setAlwaysOnTop(true);
f.addKeyListener(this);
f.setType(Type.UTILITY);
f.setVisible(true);
}
public void keyPressed(KeyEvent e) {
System.out.println(e.getKeyCode());
}
public void keyReleased(KeyEvent arg0) {}
public void keyTyped(KeyEvent arg0) {}
}