Example usage for java.awt AWTException printStackTrace

List of usage examples for java.awt AWTException printStackTrace

Introduction

In this page you can find the example usage for java.awt AWTException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.puzzle.gui.MainFrame.java

public void tray() {//-----ljs
    tray = SystemTray.getSystemTray(); // ?     
    PopupMenu pop = new PopupMenu(); // ????  
    final MenuItem show = new MenuItem("?");
    final MenuItem exit = new MenuItem("?");
    pop.add(show);/*  w  ww .  ja va 2  s .  c  o m*/
    pop.add(exit);
    show.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showMouseClick(e);
        }
    });
    exit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            exitMouseClick(e);
        }
    });

    trayIcon = new TrayIcon(
            Toolkit.getDefaultToolkit().getImage(MainFrame.class.getResource("/images/flag.png")),
            "??V1.0", pop);//  
    trayIcon.setImageAutoSize(true);
    //?  
    trayIcon.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            trayIconMouseClick(e);
        }
    });

    try {
        tray.add(trayIcon); //   
    } catch (AWTException ex) {
        log.error(ex.getMessage(), ex);
        ex.printStackTrace();
    }

}

From source file:faa.cucumber.pages.FaaHomePage.java

public void closeFaaBrowserTabs() {
    waitABit(2000);//from  w  w  w .j a v  a2  s.com
    Robot robot;
    try {
        robot = new Robot();
        System.out.println("Close Tab");
        robot.keyPress(java.awt.event.KeyEvent.VK_CONTROL);
        System.out.println("Control Key Pressed");
        robot.keyPress(java.awt.event.KeyEvent.VK_W);
        System.out.println("W Key Pressed");
        robot.keyRelease(java.awt.event.KeyEvent.VK_W);
        System.out.println("W Key Released");
        System.out.println("Control Key Released");
        robot.keyRelease(java.awt.event.KeyEvent.VK_CONTROL);
    } catch (AWTException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:faa.cucumber.pages.FaaHomePage.java

public void pressShiftKey() {
    waitABit(2000);//from  w w w  .j a  v a2 s.c  o m
    Robot robot;
    try {
        robot = new Robot();
        System.out.println("Keypress Shift Key to Open a New Browser");
        robot.keyPress(KeyEvent.VK_SHIFT);
        System.out.println("Shift Key Pressed");
        //         robot.keyPress(KeyEvent.VK_TAB);   
        //         System.out.println("Shift Key Pressed" );
        //         robot.keyRelease(KeyEvent.VK_CONTROL);
        //         System.out.println("Control Key Released" );
        //         robot.keyRelease(KeyEvent.VK_TAB);   
        //         System.out.println("TAB Key Released" );
        //         System.out.println("Browser Tabs have been switched.");

    } catch (AWTException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:faa.cucumber.pages.FaaHomePage.java

public void switchPressControlTab() {
    waitABit(2000);/*  ww w  .j ava 2s  . co m*/
    Robot robot;
    try {
        robot = new Robot();
        System.out.println("Switching Tabs, Keypress Control Tab");
        robot.keyPress(KeyEvent.VK_CONTROL);
        System.out.println("Control Key Pressed");
        robot.keyPress(KeyEvent.VK_TAB);
        System.out.println("TAB Key Pressed");
        //         robot.keyRelease(KeyEvent.VK_CONTROL);
        //         System.out.println("Control Key Released" );
        //         robot.keyRelease(KeyEvent.VK_TAB);   
        //         System.out.println("TAB Key Released" );
        //         System.out.println("Browser Tabs have been switched.");

    } catch (AWTException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:faa.cucumber.pages.FaaHomePage.java

public void switchBrowserTabs() {
    waitABit(2000);/*w  w  w.  java  2  s. c  om*/
    Robot robot;
    try {
        robot = new Robot();
        System.out.println("Switching Tabs");
        robot.keyPress(KeyEvent.VK_CONTROL);
        System.out.println("Control Key Pressed");
        robot.keyPress(KeyEvent.VK_TAB);
        System.out.println("TAB Key Pressed");
        robot.keyRelease(KeyEvent.VK_CONTROL);
        System.out.println("Control Key Released");
        robot.keyRelease(KeyEvent.VK_TAB);
        System.out.println("TAB Key Released");
        System.out.println("Browser Tabs have been switched.");

    } catch (AWTException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:faa.cucumber.pages.FaaHomePage.java

public void switchToNextTab() {
    waitABit(2000);//from  w  ww  . j  a va2  s .  com
    Robot robot;
    try {
        robot = new Robot();
        System.out.println("Switch to the Next Tab");
        robot.keyPress(KeyEvent.VK_CONTROL);
        System.out.println("Control Key Pressed");
        robot.keyPress(KeyEvent.VK_PAGE_DOWN);
        System.out.println("Page Down Key Pressed");
        robot.keyRelease(KeyEvent.VK_CONTROL);
        System.out.println("Control Key Released");
        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
        System.out.println("Page Down Key Released");
        System.out.println("Next Browser Tab has been switched.");

    } catch (AWTException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:faa.cucumber.pages.FaaHomePage.java

public void switchReleaseControlTab() {
    waitABit(2000);//from  ww  w.  ja  v a2 s .  co  m
    Robot robot;
    try {
        robot = new Robot();
        System.out.println("Release Control Tab Keys");
        System.out.println("TAB Key keyRelease");
        robot.keyRelease(KeyEvent.VK_TAB);
        System.out.println("TAB Key keyRelease");
        robot.keyRelease(KeyEvent.VK_CONTROL);
        System.out.println("Control Key keyRelease");
        //         robot.keyRelease(KeyEvent.VK_TAB);   
        //         System.out.println("TAB Key keyRelease" );
        //   robot.keyRelease(KeyEvent.VK_CONTROL);
        //   System.out.println("Control Key Released" );
        //   robot.keyRelease(KeyEvent.VK_TAB);   
        //   System.out.println("TAB Key Released" );
        //   System.out.println("Browser Tabs have been switched.");

    } catch (AWTException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:faa.cucumber.pages.FaaHomePage.java

public void wKeyPress() {
    waitABit(2000);/*from   www. j  a va  2s.  co  m*/
    Robot robot;
    try {

        robot = new Robot();
        System.out.println("Press W Key");
        robot.keyPress(java.awt.event.KeyEvent.VK_W);
        System.out.println("W Key Pressed");
        waitABit(1000);
    } catch (AWTException e) {
        System.out.println("Error has occured when attempting to Refresh Browser Window!!");
        e.printStackTrace();
    }
}

From source file:faa.cucumber.pages.FaaHomePage.java

public void wKeyRelease() {
    waitABit(2000);//from w w w .  ja  va2 s  . c  o  m
    Robot robot;
    try {

        robot = new Robot();
        System.out.println("Release W Key");
        robot.keyRelease(java.awt.event.KeyEvent.VK_W);
        System.out.println("W Key Release");
        waitABit(1000);
    } catch (AWTException e) {
        System.out.println("Error has occured when attempting to Refresh Browser Window!!");
        e.printStackTrace();
    }
}

From source file:faa.cucumber.pages.FaaHomePage.java

public void switchFaaBrowserRefresh() {
    waitABit(2000);//w  w  w . ja v  a 2  s.c  o  m
    Robot robot;
    try {

        robot = new Robot();
        System.out.println("Refresh Browser Window");
        robot.keyPress(java.awt.event.KeyEvent.VK_F5);
        System.out.println("F5 Key Pressed");
        waitABit(1000);
        robot.keyRelease(java.awt.event.KeyEvent.VK_F5);
        System.out.println("F5 Key Released");
    } catch (AWTException e) {
        System.out.println("Error has occured when attempting to Refresh Browser Window!!");
        e.printStackTrace();
    }
}