List of usage examples for java.awt AWTException printStackTrace
public void printStackTrace()
From source file:RobotTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { // make frame with a button panel ButtonFrame frame = new ButtonFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);/*from w w w .j a v a 2 s . c o m*/ // attach a robot to the screen device GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice screen = environment.getDefaultScreenDevice(); try { Robot robot = new Robot(screen); runTest(robot); } catch (AWTException e) { e.printStackTrace(); } } }); }
From source file:PNGDecoder.java
/** Static method performing screen capture into PNG image format file with given fileName. * @param rect Rectangle of screen to be captured * @param mode image color mode//www.jav a 2 s . c om * @param fileName file name for screen capture PNG image file */ public static void captureScreen(Rectangle rect, String fileName, byte mode) { try { BufferedImage capture = new Robot().createScreenCapture(rect); BufferedOutputStream file = new BufferedOutputStream(new FileOutputStream(fileName)); PNGEncoder encoder = new PNGEncoder(file, mode); encoder.encode(capture); } catch (AWTException awte) { awte.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } }
From source file:com.thoughtworks.selenium.SeleneseTestNgHelperVir.java
/** * Inits the robot.//from w w w. ja v a 2s . co m */ public static synchronized void initRobot() { try { robot = new Robot(); } catch (AWTException e) { e.printStackTrace(); } }
From source file:org.suren.autotest.web.framework.awt.AwtKeyboard.java
@Override public void enter() { try {/*w w w .jav a 2s.com*/ Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); } catch (AWTException e) { e.printStackTrace(); } }
From source file:org.suren.autotest.web.framework.awt.AwtKeyboard.java
@Override public void space() { try {//from www.j av a 2 s . co m Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_SPACE); robot.keyRelease(KeyEvent.VK_SPACE); } catch (AWTException e) { e.printStackTrace(); } }
From source file:org.suren.autotest.web.framework.awt.AwtMouse.java
@Override public void wheel(int num) { try {//from w ww .j a v a2 s . c om new Robot().mouseWheel(num); } catch (AWTException e) { e.printStackTrace(); } }
From source file:org.suren.autotest.web.framework.awt.AwtMouse.java
@Override public void click() { try {/*from ww w. j a va 2s .co m*/ Robot robot = new Robot(); robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); } catch (AWTException e) { e.printStackTrace(); } }
From source file:fxts.stations.trader.ui.ABaseDialog.java
public void componentShown(ComponentEvent aEvent) { try {/*from w w w .ja v a2 s. co m*/ UserPreferences preferences = UserPreferences.getUserPreferences(TradeDesk.getInst().getUserName()); JButton button = getRootPane().getDefaultButton(); if (preferences.getBoolean("Mouse.snapDefaultButton") && button != null) { // snap mouse to middle of default button Robot robot = new Robot(); int x = (int) button.getLocationOnScreen().getX(); int y = (int) button.getLocationOnScreen().getY(); int width = (int) button.getSize().getWidth(); int height = (int) button.getSize().getHeight(); int x1 = x + width / 2; int y1 = y + height / 2; robot.mouseMove(x1, y1); } } catch (AWTException e) { e.printStackTrace(); } }
From source file:com.wet.wired.jsr.recorder.DesktopScreenRecorder.java
public Rectangle initialiseScreenCapture() { try {//from w w w. ja v a2s. c o m robot = new Robot(); } catch (AWTException awe) { awe.printStackTrace(); return null; } return new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); }
From source file:org.suren.autotest.web.framework.selenium.action.SeleniumHover.java
@Override public void hover(Element ele) { WebElement webEle = searchStrategyUtils.findStrategy(WebElement.class, ele).search(ele); if (webEle == null) { logger.warn("can not found element."); return;/*from w w w .j a v a 2 s . c o m*/ } if (!(ele instanceof FileUpload)) { Dimension size = webEle.getSize(); Point loc = webEle.getLocation(); int toolbarHeight = engine.getToolbarHeight(); int x = size.getWidth() / 2 + loc.getX(); int y = size.getHeight() / 2 + loc.getY() + toolbarHeight; try { new Robot().mouseMove(x, y); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }