sabj!
"if the platform configuration does not allow low-level input control"
а как можно ?
Существует ли такой "platform configuration" для работы робота?
"Note that some platforms require special privileges or extensions to access
low-level input control. If the current platform configuration does not allow
input control, an AWTException will be thrown when trying to construct Robot
objects. For example, X-Window systems will throw the exception if the XTEST
2.2 standard extension is not supported (or not enabled) by the X server. "
у меня вин98/Ява sdk 1.4
SPU> Здpавствуй очень уважаемый All ...
SPU> sabj!
SPU> "if the platform configuration does not allow low-level input control"
SPU> а как можно ?
SPU> Существует ли такой "platform configuration" для работы робота?
SPU> "Note that some platforms require special privileges or extensions to
SPU> access low-level input control. If the current platform configuration
SPU> does not allow input control, an AWTException will be thrown when trying
SPU> to construct Robot objects. For example, X-Window systems will throw the
SPU> exception if the XTEST 2.2 standard extension is not supported (or not
SPU> enabled) by the X server. "
SPU> у меня вин98/Ява sdk 1.4
Код в студию! Есть у меня подозоение что ты пытаешься это дело из апплета
запользовать :)
With best regards, Alexander Zuev.
И в мыслях не было.
Hарушать принцип о невозможности зловредного кода, тем более в форме атлета.
Целью было автоматизация - эмулятор пользователя (макросы), на основе
кросс-платформенной технологии.
public class Butonoroboto {
public static Robot robot;
public Butonoroboto() {
try {
robot = new Robot();
} catch (AWTException e) {
e.printStackTrace();
robot = null;
}
robot.setAutoWaitForIdle(true);
robot.setAutoDelay(500);
}
public static void main(String s[]) {
kombButonoj(KeyEvent.VK_ALT,KeyEvent.VK_TAB);
}
public static void kombButonoj(int key0, int key1) {
robot.keyPress(key0);
robot.keyPress(key1);
robot.keyRelease(key1);
robot.keyRelease(key0);
}
}
Угк, продолжим апроксимацию. А что печатает
System.out.println("isHeadless? : "+GraphicsEnvironment.isHeadless());
Если true то либо инсталляция JDK битая либо сконфигурена она как-то
крововато...
SU> И в мыслях не было.
SU> Hарушать принцип о невозможности зловредного кода, тем более в форме
SU> атлета. Целью было автоматизация - эмулятор пользователя (макросы), на
SU> основе кросс-платформенной технологии.
Eсли убрать явный NullPointerException, то у меня работает (WinXP SP2/JRE
1.5.0_12).