Java Code Examples for java.awt.AWTException#printStackTrace()

The following examples show how to use java.awt.AWTException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoPrayFlickPlugin.java    From ExternalPlugins with GNU General Public License v3.0 6 votes vote down vote up
private void simLeftClick()
{
	if (config.mouseEvents())
	{
		extUtils.click(bounds);
		return;
	}

	try
	{
		Robot leftClk = new Robot();
		leftClk.mousePress(BUTTON1_DOWN_MASK);
		leftClk.mouseRelease(BUTTON1_DOWN_MASK);
	}
	catch (AWTException e)
	{
		e.printStackTrace();
	}
}
 
Example 2
Source File: AmbilightHandler.java    From nanoleaf-desktop with MIT License 6 votes vote down vote up
public AmbilightHandler(Aurora[] auroras,
                        PanelCanvas canvas, AmbilightPanel parent) {
    this.auroras = auroras;
    this.canvas = canvas;
    this.parent = parent;
    delay = parent.getUpdateDelay();
    transTime = parent.getTransitionTime();
    brightness = parent.getBrightness();
    captureArea = parent.getCaptureArea();
    mode = parent.getMode();

    try {
        robot = new Robot();
    } catch (AWTException awte) {
        awte.printStackTrace();
    }
}
 
Example 3
Source File: Guide.java    From SikuliX1 with MIT License 6 votes vote down vote up
private void init(Region region) {
  try {
    robot = new Robot();
  } catch (AWTException e1) {
    e1.printStackTrace();
  }
  content = getJPanel();
  _region = region;
  Rectangle rect = _region.getRect();
  content.setPreferredSize(rect.getSize());
  add(content);
  setBounds(rect);
  getRootPane().putClientProperty("Window.shadow", Boolean.FALSE);
  ((JPanel) getContentPane()).setDoubleBuffered(true);
  setVisible(false);
  setFocusableWindowState(false);
}
 
Example 4
Source File: Demo_SpeechRecognitionCopypasta.java    From haxademic with MIT License 6 votes vote down vote up
protected void firstFrame() {
	Demo_SpeechRecognitionCopypasta thiss = this;
	java.awt.EventQueue.invokeLater(new Runnable() {
		public void run() {
			frame = new FrameWithBorderLayout();
			frame.initWithDelegate(thiss);
			frame.setVisible(false);
		}
	});
	
	try {
		robot = new Robot();
	} catch (AWTException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
Example 5
Source File: Manager.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
private void start(String[] args) {
    SystemTray tray = SystemTray.getSystemTray();
    TrayIcon icon = new TrayIcon(Toolkit.getDefaultToolkit().createImage(
            getClass().getResource(
                    "/com/ramussoft/gui/server/application.png")),
            getString("Server") + " " + Metadata.getApplicationName(),
            createPopupMenu());
    icon.setImageAutoSize(true);
    try {
        tray.add(icon);
    } catch (AWTException e) {
        e.printStackTrace();
    }
}
 
Example 6
Source File: VSyncedBufferStrategyTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}
 
Example 7
Source File: VSyncedBufferStrategyTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}
 
Example 8
Source File: Screen.java    From PengueeBot with GNU General Public License v3.0 5 votes vote down vote up
public Screen() {
	cache = new HashMap<Frag, Position>();
	try {
		robot = new Robot();
	} catch (AWTException e) {
		e.printStackTrace();
	}
}
 
Example 9
Source File: VSyncedBufferStrategyTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}
 
Example 10
Source File: RobotDevice.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public RobotDevice() {
    try {
        this.robot = new Robot();
        robotXsetAutoWaitForIdle(true);
        robotXsetAutoDelay();
    } catch (AWTException e) {
        e.printStackTrace();
    }
}
 
Example 11
Source File: JavaAgent.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public byte[] getScreenShot() throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        BufferedImage bufferedImage;
        Dimension windowSize = Toolkit.getDefaultToolkit().getScreenSize();
        bufferedImage = new Robot().createScreenCapture(new Rectangle(0, 0, windowSize.width, windowSize.height));
        ImageIO.write(bufferedImage, "png", baos);
    } catch (AWTException e) {
        e.printStackTrace();
    }
    return baos.toByteArray();
}
 
Example 12
Source File: AwtMouse.java    From phoenix.webui.framework with Apache License 2.0 5 votes vote down vote up
@Override
public void click()
{
	try
	{
		Robot robot = new Robot();
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
	}
	catch (AWTException e)
	{
		e.printStackTrace();
	}
}
 
Example 13
Source File: VSyncedBufferStrategyTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}
 
Example 14
Source File: VSyncedBufferStrategyTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}
 
Example 15
Source File: VSyncedBufferStrategyTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}
 
Example 16
Source File: VSyncedBufferStrategyTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}
 
Example 17
Source File: VSyncedBufferStrategyTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}
 
Example 18
Source File: PopupMenuLeakTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void createSystemTrayIcon() {
    final TrayIcon trayIcon = new TrayIcon(createTrayIconImage());
    trayIcon.setImageAutoSize(true);

    try {
        // Add tray icon to system tray *before* adding popup menu to demonstrate buggy behaviour
        trayIcon.setPopupMenu(createTrayIconPopupMenu());
        SystemTray.getSystemTray().add(trayIcon);
        iconWeakReference.set(new WeakReference<>(trayIcon));
        popupWeakReference.set(new WeakReference<>(trayIcon.getPopupMenu()));
    } catch (final AWTException awte) {
        awte.printStackTrace();
    }
}
 
Example 19
Source File: TrayUI.java    From karamel with Apache License 2.0 5 votes vote down vote up
private void createGui() {

    setJPopupMenu(createJPopupMenu());
    try {
            // TODO: Bug in setting transparency of SystemTray Icon in 
      // Linux - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6453521
      SystemTray.getSystemTray().add(this);
    } catch (AWTException e) {
      e.printStackTrace();
    }
  }
 
Example 20
Source File: VSyncedBufferStrategyTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}