sucede que tengo el siguiente codigo para empezar un thread pero no me deja pues cuando lo llamo con .start() me dice que no puedo hacer:
Cannot make a static reference to the non-static method start() from the type Thread
Código PHP:
private JFrame getVentana() {
if (ventana == null) {
ventana = new JFrame();
ventana.setSize(new Dimension(242, 216));
ventana.setTitle("QuicktoBless");
ventana.setContentPane(getCont());
ventana.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent e) {
if(e.getKeyCode()==112+getKeys().getSelectedIndex()){
if(getRun().getText()=="Stoped"){
getRun().setText("Running");
hacerPoder.start();// aki dice: Cannot make a static reference to the non-static method start() from the type Thread
}
else if(getRun().getText()=="Running"){
}
}
}
});
}
return ventana;
}
el run no se peude poner estatico tampoco y lo raroe s que mi jaframe no es estatico entonces nos e por que no me deja :(
aki pongo el del thread
Código PHP:
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
public class hacerPoder extends Thread{
public void run(){
try {
Robot atk = new Robot();
atk.mousePress(InputEvent.BUTTON3_MASK);
atk.mouseRelease(InputEvent.BUTTON3_MASK);
} catch (AWTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
si alguien peude hecharme una ayudita para poder correr el thread le agradeceria :(
Gracias de antemano... eos de los threads como ke no es para mi xD