Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/04/2007, 08:46
Avatar de Asgaroth
Asgaroth
 
Fecha de Ingreso: abril-2007
Mensajes: 79
Antigüedad: 17 años, 1 mes
Puntos: 4
problema con threads... raro en mi ajjajaja

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(242216));
            
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