Example #1
0
 @SuppressWarnings("deprecation")
 public CPlatformWindow convertJComponentToTarget(final JRootPane p) {
   Component root = SwingUtilities.getRoot(p);
   final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
   if (root == null || acc.getPeer(root) == null) return null;
   return (CPlatformWindow) ((LWWindowPeer) acc.getPeer(root)).getPlatformWindow();
 }
Example #2
0
  @Override
  public void setOpaque(boolean isOpaque) {
    CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
    boolean isTextured = (peer == null) ? false : peer.isTextured();
    if (!isTextured) {
      if (!isOpaque) {
        CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), 0);
      } else if (peer != null) {
        Color color = peer.getBackground();
        if (color != null) {
          int rgb = color.getRGB();
          CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), rgb);
        }
      }
    }

    // This is a temporary workaround. Looks like after 7124236 will be fixed
    // the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
    SwingUtilities.invokeLater(this::invalidateShadow);
  }