Exemplo n.º 1
0
  public void setOpaque(boolean isOpaque) {
    synchronized (getStateLock()) {
      if (this.isOpaque == isOpaque) {
        return;
      }
    }

    Window target = (Window) getTarget();

    if (!isOpaque) {
      SunToolkit sunToolkit = (SunToolkit) target.getToolkit();
      if (!sunToolkit.isWindowTranslucencySupported()
          || !sunToolkit.isTranslucencyCapable(target.getGraphicsConfiguration())) {
        return;
      }
    }

    boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS();

    if (this.isOpaque != isOpaque && !isVistaOS) {
      // non-Vista OS: only replace the surface data if the opacity
      // status changed (see WComponentPeer.isAccelCapable() for more)
      replaceSurfaceDataRecursively(target);
    }

    synchronized (getStateLock()) {
      this.isOpaque = isOpaque;
      setOpaqueImpl(isOpaque);
      if (isOpaque) {
        TranslucentWindowPainter currentPainter = painter;
        if (currentPainter != null) {
          currentPainter.flush();
          painter = null;
        }
      } else {
        painter = TranslucentWindowPainter.createInstance(this);
      }
    }

    if (isVistaOS) {
      // On Vista: setting the window non-opaque makes the window look
      // rectangular, though still catching the mouse clicks within
      // its shape only. To restore the correct visual appearance
      // of the window (i.e. w/ the correct shape) we have to reset
      // the shape.
      Shape shape = target.getShape();
      if (shape != null) {
        target.setShape(shape);
      }
    }

    if (target.isVisible()) {
      updateWindow(true);
    }
  }
Exemplo n.º 2
0
 public static Image getGameIcon(final Window frame) {
   Image img = null;
   try {
     img = frame.getToolkit().getImage(GameRunner2.class.getResource("ta_icon.png"));
   } catch (final Exception ex) {
     System.out.println("icon not loaded");
   }
   final MediaTracker tracker = new MediaTracker(frame);
   tracker.addImage(img, 0);
   try {
     tracker.waitForAll();
   } catch (final InterruptedException ex) {
     ex.printStackTrace();
   }
   return img;
 }
Exemplo n.º 3
0
 public void invisibleCursor() {
   Image curs;
   curs = new ImageIcon("Textures\\Cross.png").getImage();
   Window w = s.getFullScreenWindow();
   w.setCursor(w.getToolkit().createCustomCursor(curs, new Point(0, 0), "null"));
 }