Quantcast
Channel: Programação - GUJ
Viewing all articles
Browse latest Browse all 33093

CTRL+ARROW && Quando pressionar F10 show mouse infos

$
0
0

@ladyforest escreveu:

Eu tava tentando fazer um codigo simples, mas tive 2 problemas:

    public static void idle() throws AWTException, InterruptedException
{
    Robot r;
    r = new Robot();
    r.keyPress(KeyEvent.VK_CONTROL);
    r.keyPress(KeyEvent.VK_RIGHT);
    r.keyRelease(KeyEvent.VK_RIGHT);
    r.keyRelease(KeyEvent.VK_CONTROL);
    r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_DOWN);
r.keyRelease(KeyEvent.VK_DOWN);
r.keyRelease(KeyEvent.VK_CONTROL);
}

Isso era para pressionar ctrl, apertar seta para direita, e apertar seta para baixo (com ctrl pressionado)
Mas não está funcionando, parece q está indo só para direita e para baixo sem o ctrl pressionado..

E o outro problema era, ao pressionar F10, mostrar informações do mouse:

    public static void mousehelp() throws AWTException
{
    PointerInfo a = MouseInfo.getPointerInfo();
    Point b = a.getLocation();
    int x = (int) b.getX();
    int y = (int) b.getY();
    System.out.println("Pos Y   = " + y);
    System.out.println("Pos X   = " + x);
    Robot r;
r = new Robot();
Color color = r.getPixelColor(x, y);
System.out.println("Red   = " + color.getRed());
System.out.println("Green = " + color.getGreen());
System.out.println("Blue  = " + color.getBlue());
}

Full Code:
http://hastebin.com/xecayuwoga.swift

Mensagens: 1

Participantes: 1

Ler tópico completo


Viewing all articles
Browse latest Browse all 33093


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>