Package org.netbeans.jemmy

Examples of org.netbeans.jemmy.JemmyException


        ww.setOutput(getOutput());
        ww.setTimeouts(getTimeouts());
  try {
      return(ww.waitWindow((Window)getSource(), chooser, index));
  } catch (InterruptedException e) {
      throw(new JemmyException("Waiting for \"" + chooser.getDescription() +
             "\" window has been interrupted", e));
  }
    }
View Full Code Here


     */
    public static BufferedImage getImage(Rectangle rect) {
        try {
            return(new Robot().createScreenCapture(rect));
        } catch(AWTException e) {
            throw(new JemmyException("Exception during screen capturing", e));
        }
    }
View Full Code Here

        }
        try {
            robotReference.invokeMethod(method, params, paramClasses);
            synchronizeRobot();
        } catch(InvocationTargetException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(IllegalStateException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(NoSuchMethodException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(IllegalAccessException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        }
    }
View Full Code Here

                    new Object[] {new Integer((int)((autoDelay != null) ?
                        autoDelay.getValue() :
                        0))},
                    new Class[] {Integer.TYPE});
        } catch(InvocationTargetException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(IllegalStateException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(NoSuchMethodException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(IllegalAccessException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(ClassNotFoundException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(InstantiationException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        }
    }
View Full Code Here

        return(true);
    }

    void checkEquality(byte[] b1, byte[] b2) {
        if(!compare(b1, b2)) {
            throw(new JemmyException("Format error"));
        }
    }
View Full Code Here

        } else if(compare(head, new byte[]{8, 0, 0, 0, 0})) {
            mode = PNGEncoder.GREYSCALE_MODE;
        } else if(compare(head, new byte[]{8, 2, 0, 0, 0})) {
            mode = PNGEncoder.COLOR_MODE;
        } else {
            throw(new JemmyException("Format error"));
        }

        readInt();//!!crc

        int size = readInt();

        byte[] idat = read(4);
        checkEquality(idat, "IDAT".getBytes());

        byte[] data = read(size);


        Inflater inflater = new Inflater();
        inflater.setInput(data, 0, size);

        int color;

        try {
            switch (mode) {
            case PNGEncoder.BW_MODE:
                {
                    int bytes = (int)(width / 8);
                    if((width % 8) != 0) {
                        bytes++;
                    }
                    byte colorset;
                    byte[] row = new byte[bytes];
                    for (int y = 0; y < height; y++) {
                        inflater.inflate(new byte[1]);
                        inflater.inflate(row);
                        for (int x = 0; x < bytes; x++) {
                            colorset = row[x];
                            for (int sh = 0; sh < 8; sh++) {
                                if(x * 8 + sh >= width) {
                                    break;
                                }
                                if((colorset & 0x80) == 0x80) {
                                    result.setRGB(x * 8 + sh, y, Color.white.getRGB());
                                } else {
                                    result.setRGB(x * 8 + sh, y, Color.black.getRGB());
                                }
                                colorset <<= 1;
                            }
                        }
                    }
                }
                break;
            case PNGEncoder.GREYSCALE_MODE:
                {
                    byte[] row = new byte[width];
                    for (int y = 0; y < height; y++) {
                        inflater.inflate(new byte[1]);
                        inflater.inflate(row);
                        for (int x = 0; x < width; x++) {
                            color = row[x];
                            result.setRGB(x, y, (color << 16) + (color << 8) + color);
                        }
                    }
                }
                break;
            case PNGEncoder.COLOR_MODE:
                {
                    byte[] row = new byte[width * 3];
                    for (int y = 0; y < height; y++) {
                        inflater.inflate(new byte[1]);
                        inflater.inflate(row);
                        for (int x = 0; x < width; x++) {
                            result.setRGB(x, y,
                                          ((row[x * 3 + 0]&0xff) << 16) +
                                          ((row[x * 3 + 1]&0xff) << 8) +
                                          ((row[x * 3 + 2]&0xff)));
                        }
                    }
                }
            }
        } catch(DataFormatException e) {
            throw(new JemmyException("ZIP error", e));
        }

        readInt();//!!crc
        readInt();//0

View Full Code Here

     */
    public static BufferedImage decode(String fileName) {
        try {
            return(new PNGDecoder(new FileInputStream(fileName)).decode());
        } catch(IOException e) {
            throw(new JemmyException("IOException during image reading", e));
        }
    }
View Full Code Here

        //end of 1.5 workaround
        try {
            return((JMenuItem)waiter.waitAction(null));
        } catch(InterruptedException e) {
            action.stop();
            throw(new JemmyException("Waiting has been interrupted", e));
        }
    }
View Full Code Here

                if(element instanceof JMenu) {
                    JMenuOperator subMenuOper = new JMenuOperator((JMenu)element);
                    subMenuOper.copyEnvironment(env);
                    mousePressed = inTheMiddle(subMenuOper, mousePressed);
                } else {
                    throw(new JemmyException("Menu path too long"));
                }
            }
        }
View Full Code Here

     * @see #setDriver
     */
    public static Object getDriver(String id, Class operatorClass) {
  Object result = getADriver(id, operatorClass, JemmyProperties.getProperties());
  if(result == null) {
      throw(new JemmyException("No \"" + id + "\" driver registered for " +
             operatorClass.getName() + " class!"));
  } else {
      return(result);
  }
    }
View Full Code Here

TOP

Related Classes of org.netbeans.jemmy.JemmyException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.