如何用java code打开和关闭Window 8 Charms Bar?

时间:2014-05-08 13:01:44

标签: java windows-8

是否可以使用java程序打开和关闭Windows 8魅力吧? enter image description here

1 个答案:

答案 0 :(得分:1)

让我来点一下:

如果您在应用程序中模拟按键操作没有问题,可以执行以下操作:

package robot;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

public class KeyPresser {

    public static void main(String[] args) 
    {
         try {
                Robot robot = new Robot();

                // Simulate the charms shortcut: WIN key+C
                robot.keyPress(KeyEvent.VK_WINDOWS);
                robot.keyPress(KeyEvent.VK_C);
                robot.keyRelease(KeyEvent.VK_WINDOWS);
                robot.keyRelease(KeyEvent.VK_C);
            } catch (AWTException e) {
                e.printStackTrace();
            }
        // TODO Auto-generated method stub

    }

}