Exemplo n.º 1
0
  public static void translateToScreen(Event event) {
    Assert.isTrue(event.target instanceof Component);

    Frame frame = getFrame((Component) event.target);
    event.translate(
        frame.getLocation().x + frame.getInsets().left,
        frame.getLocation().y + frame.getInsets().top);
  }
Exemplo n.º 2
0
  public static void wallPaper(Component component, Graphics g, Image image) {
    Dimension compsize = component.getSize();
    Util.waitForImage(component, image);

    int patchW = image.getWidth(component);
    int patchH = image.getHeight(component);

    Assert.isTrue(patchW != -1 && patchH != -1);

    for (int r = 0; r < compsize.width; r += patchW) {
      for (int c = 0; c < compsize.height; c += patchH) g.drawImage(image, r, c, component);
    }
  }