Esempio 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);
  }
Esempio n. 2
0
 public static void waitForImage(Component component, Image image) {
   MediaTracker tracker = new MediaTracker(component);
   try {
     tracker.addImage(image, 0);
     tracker.waitForID(0);
   } catch (InterruptedException e) {
     Assert.isNotNull(null);
   }
 }
Esempio n. 3
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);
    }
  }