java.awt.AWTException Java Examples
The following examples show how to use
java.awt.AWTException.
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: FilterSave.java From jeveassets with GNU General Public License v2.0 | 7 votes |
@Override protected void save() { if (validate()) { returnString = (String) jName.getSelectedItem(); setVisible(false); } //XXX - Workaround for strange bug: // 1. Tricker validation by pressing enter in the jName JComboBox // 2. Doing validate JOptionPane is shown and lose focus (to another program) // 3. JOptionPane is hidden (by mouse click) // 4. jName is not responding (string is locked) try { Robot robot = new Robot(); robot.keyRelease(KeyEvent.VK_ENTER); } catch (AWTException e) { } }
Example #2
Source File: ExecutableInputMethodManager.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
ExecutableInputMethodManager() { // set up host adapter locator Toolkit toolkit = Toolkit.getDefaultToolkit(); try { if (toolkit instanceof InputMethodSupport) { InputMethodDescriptor hostAdapterDescriptor = ((InputMethodSupport)toolkit) .getInputMethodAdapterDescriptor(); if (hostAdapterDescriptor != null) { hostAdapterLocator = new InputMethodLocator(hostAdapterDescriptor, null, null); } } } catch (AWTException e) { // if we can't get a descriptor, we'll just have to do without native input methods } javaInputMethodLocatorList = new Vector<InputMethodLocator>(); initializeInputMethodLocatorList(); }
Example #3
Source File: bug6415145.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void test() throws AWTException { try { moveMouseTo(robot, button); robot.mousePress(InputEvent.BUTTON1_MASK); robot.waitForIdle(); moveMouseTo(robot, item1); robot.waitForIdle(); moveMouseTo(robot, item2); robot.waitForIdle(); if ( (item1.isArmed()) || (!item2.isArmed()) ) { throw new RuntimeException("Selected item is not being updated" + " while dragging above popup menu."); } } finally { robot.mouseRelease(InputEvent.BUTTON1_MASK); } }
Example #4
Source File: WGLGraphicsConfig.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Checks that the requested configuration is natively supported; if not, * an AWTException is thrown. */ @Override public void assertOperationSupported(Component target, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #5
Source File: DisposeFrameOnDragTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { constructTestUI(); } }); Util.waitForIdle(null); try { Point loc = textArea.getLocationOnScreen(); Util.drag(new Robot(), new Point((int) loc.x + 3, (int) loc.y + 3), new Point((int) loc.x + 40, (int) loc.y + 40), InputEvent.BUTTON1_MASK); } catch (AWTException ex) { throw new RuntimeException("Could not initiate a drag operation"); } Util.waitForIdle(null); }
Example #6
Source File: D3DGraphicsConfig.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Checks that the requested configuration is natively supported; if not, * an AWTException is thrown. */ @Override public void assertOperationSupported(Component target, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers < 2 || numBuffers > 4) { throw new AWTException("Only 2-4 buffers supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.COPIED && numBuffers != 2) { throw new AWTException("FlipContents.COPIED is only" + "supported for 2 buffers"); } }
Example #7
Source File: D3DGraphicsConfig.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Checks that the requested configuration is natively supported; if not, * an AWTException is thrown. */ @Override public void assertOperationSupported(Component target, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers < 2 || numBuffers > 4) { throw new AWTException("Only 2-4 buffers supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.COPIED && numBuffers != 2) { throw new AWTException("FlipContents.COPIED is only" + "supported for 2 buffers"); } }
Example #8
Source File: CGLGraphicsConfig.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public void assertOperationSupported(final int numBuffers, final BufferCapabilities caps) throws AWTException { // Assume this method is never called with numBuffers != 2, as 0 is // unsupported, and 1 corresponds to a SingleBufferStrategy which // doesn't depend on the peer. Screen is considered as a separate // "buffer". if (numBuffers != 2) { throw new AWTException("Only double buffering is supported"); } final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #9
Source File: DisposeFrameOnDragTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { constructTestUI(); } }); Util.waitForIdle(null); try { Point loc = textArea.getLocationOnScreen(); Util.drag(new Robot(), new Point((int) loc.x + 3, (int) loc.y + 3), new Point((int) loc.x + 40, (int) loc.y + 40), InputEvent.BUTTON1_MASK); } catch (AWTException ex) { throw new RuntimeException("Could not initiate a drag operation"); } Util.waitForIdle(null); }
Example #10
Source File: CGLGraphicsConfig.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public void assertOperationSupported(final int numBuffers, final BufferCapabilities caps) throws AWTException { // Assume this method is never called with numBuffers != 2, as 0 is // unsupported, and 1 corresponds to a SingleBufferStrategy which // doesn't depend on the peer. Screen is considered as a separate // "buffer". if (numBuffers != 2) { throw new AWTException("Only double buffering is supported"); } final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #11
Source File: CGLGraphicsConfig.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public void assertOperationSupported(final int numBuffers, final BufferCapabilities caps) throws AWTException { // Assume this method is never called with numBuffers != 2, as 0 is // unsupported, and 1 corresponds to a SingleBufferStrategy which // doesn't depend on the peer. Screen is considered as a separate // "buffer". if (numBuffers != 2) { throw new AWTException("Only double buffering is supported"); } final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #12
Source File: SpecializedScreenRecorder.java From candybean with GNU Affero General Public License v3.0 | 6 votes |
public SpecializedScreenRecorder(GraphicsConfiguration cfg, String name, Configuration config) throws IOException, AWTException { super(cfg, new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, config.getValue("video.format", MIME_QUICKTIME)), new Format( MediaTypeKey, MediaType.VIDEO, EncodingKey, config.getValue("video.encoding", ENCODING_QUICKTIME_CINEPAK), CompressorNameKey, config.getValue("video.compression", COMPRESSOR_NAME_QUICKTIME_CINEPAK), DepthKey, (int) 24, FrameRateKey, Rational.valueOf(Integer .parseInt(config.getValue("video.format.frameRate", "15"))), QualityKey, 1.0f, KeyFrameIntervalKey, (int) (15 * 60)), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black", FrameRateKey, Rational.valueOf(30)), null); this.name = name; this.config = config; this.setMaxFileSize(Long.parseLong(config.getValue("maxFileSize",MAX_SIZE_DEFAULT_KB))); this.setMaxRecordingTime(Long.parseLong(config.getValue("maxRecordingTime",MAX_DURATION_DEFAULT_MS))); }
Example #13
Source File: Test6541987.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws AWTException { robot = new Robot(); // test escape after selection start(); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // test double escape after editing start(); click(KeyEvent.VK_1); click(KeyEvent.VK_0); click(KeyEvent.VK_ESCAPE); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // all windows should be closed for (Window window : Window.getWindows()) { if (window.isVisible()) { throw new Error("found visible window: " + window.getName()); } } }
Example #14
Source File: D3DGraphicsConfig.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Checks that the requested configuration is natively supported; if not, * an AWTException is thrown. */ @Override public void assertOperationSupported(Component target, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers < 2 || numBuffers > 4) { throw new AWTException("Only 2-4 buffers supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.COPIED && numBuffers != 2) { throw new AWTException("FlipContents.COPIED is only" + "supported for 2 buffers"); } }
Example #15
Source File: Test6541987.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws AWTException { robot = new Robot(); // test escape after selection start(); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // test double escape after editing start(); click(KeyEvent.VK_1); click(KeyEvent.VK_0); click(KeyEvent.VK_ESCAPE); click(KeyEvent.VK_ESCAPE); toolkit.realSync(); // all windows should be closed for (Window window : Window.getWindows()) { if (window.isVisible()) { throw new Error("found visible window: " + window.getName()); } } }
Example #16
Source File: X11GraphicsConfig.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Attempts to create an XDBE-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * handle to the native backbuffer is returned. */ public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (!X11GraphicsDevice.isDBESupported()) { throw new AWTException("Page flipping is not supported"); } if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } long window = peer.getContentWindow(); int swapAction = getSwapAction(caps.getFlipContents()); return createBackBuffer(window, swapAction); }
Example #17
Source File: Guide.java From SikuliX1 with MIT License | 6 votes |
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 #18
Source File: X11GraphicsConfig.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Attempts to create an XDBE-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * handle to the native backbuffer is returned. */ public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (!X11GraphicsDevice.isDBESupported()) { throw new AWTException("Page flipping is not supported"); } if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } long window = peer.getContentWindow(); int swapAction = getSwapAction(caps.getFlipContents()); return createBackBuffer(window, swapAction); }
Example #19
Source File: bug7097771.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws AWTException { final bug7097771 frame = new bug7097771(); frame.setSize(300, 300); frame.setLocationRelativeTo(null); final Button button = new Button(); button.addActionListener(frame); frame.add(button); frame.setVisible(true); sleep(); frame.setEnabled(false); button.setEnabled(false); button.setEnabled(true); sleep(); Util.clickOnComp(button, new Robot()); sleep(); frame.dispose(); if (action) { throw new RuntimeException("Button is not disabled."); } }
Example #20
Source File: BackgroundIsNotUpdated.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws AWTException { final Window window = new BackgroundIsNotUpdated(null); window.setSize(300, 300); window.setLocationRelativeTo(null); window.setVisible(true); sleep(); window.setBackground(Color.GREEN); sleep(); final Robot robot = new Robot(); robot.setAutoDelay(200); Point point = window.getLocationOnScreen(); Color color = robot.getPixelColor(point.x + window.getWidth() / 2, point.y + window.getHeight() / 2); window.dispose(); if (!color.equals(Color.GREEN)) { throw new RuntimeException( "Expected: " + Color.GREEN + " , Actual: " + color); } }
Example #21
Source File: X11GraphicsConfig.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Attempts to create an XDBE-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * handle to the native backbuffer is returned. */ public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (!X11GraphicsDevice.isDBESupported()) { throw new AWTException("Page flipping is not supported"); } if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } long window = peer.getContentWindow(); int swapAction = getSwapAction(caps.getFlipContents()); return createBackBuffer(window, swapAction); }
Example #22
Source File: PressedButtonRightClickTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { constructTestUI(); } }); try { testRobot = new Robot(); } catch (AWTException ex) { throw new RuntimeException("Exception in Robot creation"); } testRobot.waitForIdle(); // Method performing auto test operation test(); disposeTestUI(); }
Example #23
Source File: GLXGraphicsConfig.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Attempts to create a GLX-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * value of 1 is returned. */ @Override public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } // non-zero return value means backbuffer creation was successful // (checked in X11ComponentPeer.flip(), etc.) return 1; }
Example #24
Source File: BackgroundIsNotUpdated.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws AWTException { final Window window = new BackgroundIsNotUpdated(null); window.setSize(300, 300); window.setLocationRelativeTo(null); window.setVisible(true); sleep(); window.setBackground(Color.GREEN); sleep(); final Robot robot = new Robot(); robot.setAutoDelay(200); Point point = window.getLocationOnScreen(); Color color = robot.getPixelColor(point.x + window.getWidth() / 2, point.y + window.getHeight() / 2); window.dispose(); if (!color.equals(Color.GREEN)) { throw new RuntimeException( "Expected: " + Color.GREEN + " , Actual: " + color); } }
Example #25
Source File: X11InputMethod.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Constructs an X11InputMethod instance. It initializes the XIM * environment if it's not done yet. * * @exception AWTException if XOpenIM() failed. */ public X11InputMethod() throws AWTException { // supports only the locale in which the VM is started locale = X11InputMethodDescriptor.getSupportedLocale(); if (initXIM() == false) { throw new AWTException("Cannot open X Input Method"); } }
Example #26
Source File: XComponentPeer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException { if (buffersLog.isLoggable(PlatformLogger.Level.FINE)) { buffersLog.fine("createBuffers(" + numBuffers + ", " + caps + ")"); } // set the caps first, they're used when creating the bb backBufferCaps = caps; backBuffer = graphicsConfig.createBackBuffer(this, numBuffers, caps); xBackBuffer = graphicsConfig.createBackBufferImage(target, backBuffer); }
Example #27
Source File: X11InputMethod.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Constructs an X11InputMethod instance. It initializes the XIM * environment if it's not done yet. * * @exception AWTException if XOpenIM() failed. */ public X11InputMethod() throws AWTException { // supports only the locale in which the VM is started locale = X11InputMethodDescriptor.getSupportedLocale(); if (initXIM() == false) { throw new AWTException("Cannot open X Input Method"); } }
Example #28
Source File: AWTTest.java From SWET with MIT License | 5 votes |
@Ignore @Test public void basicTest() throws AWTException, InterruptedException { for (int cnt = 0; cnt != rawKeys.length; cnt++) { robot.keyPress(rawKeys[cnt]); Thread.sleep(delay); } writeString("Hello AWT!"); }
Example #29
Source File: InputMethodPopupMenu.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example #30
Source File: CustomCompositeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void testVolatileImage(GraphicsConfiguration cfg, boolean accelerated) { VolatileImage dst = null; try { dst = cfg.createCompatibleVolatileImage(640, 480, new ImageCapabilities(accelerated)); } catch (AWTException e) { System.out.println("Unable to create volatile image, skip the test."); return; } renderToVolatileImage(dst); }