javax.swing.JDialog.setOpacity()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中javax.swing.JDialog.setOpacity()方法的一些代码示例,展示了JDialog.setOpacity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.setOpacity()方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:setOpacity

JDialog.setOpacity介绍

暂无

代码示例

代码示例来源:origin: com.jalalkiswani/jk-desktop

@Override
  public void actionPerformed(final ActionEvent e) {
    this.opacity += 0.15f;
    dialog.setOpacity(Math.min(this.opacity, 1));
    if (this.opacity >= 1) {
      timer.stop();
    }
  }
});

代码示例来源:origin: com.jalalkiswani/jk-desktop

@Override
  public void actionPerformed(final ActionEvent e) {
    this.opacity -= 0.15f;
    dialog.setOpacity(Math.max(this.opacity, 0));
    if (this.opacity <= 0) {
      timer.stop();
      dialog.dispose();
    }
  }
});

代码示例来源:origin: com.jalalkiswani/jk-desktop

/**
 * Creates an animation to fade the dialog opacity from 0 to 1.
 *
 * @param dialog
 *            the dialog
 */
public static void fadeIn(final JDialog dialog) {
  final Timer timer = new Timer(10, null);
  timer.setRepeats(true);
  timer.addActionListener(new ActionListener() {
    private float opacity = 0;
    @Override
    public void actionPerformed(final ActionEvent e) {
      this.opacity += 0.15f;
      dialog.setOpacity(Math.min(this.opacity, 1));
      if (this.opacity >= 1) {
        timer.stop();
      }
    }
  });
  dialog.setOpacity(0);
  timer.start();
  dialog.setVisible(true);
}

代码示例来源:origin: com.jalalkiswani/jk-desktop

/**
   * Creates an animation to fade the dialog opacity from 1 to 0.
   *
   * @param dialog
   *            the dialog
   */
  public static void fadeOut(final JDialog dialog) {
    final Timer timer = new Timer(10, null);
    timer.setRepeats(true);
    timer.addActionListener(new ActionListener() {
      private float opacity = 1;

      @Override
      public void actionPerformed(final ActionEvent e) {
        this.opacity -= 0.15f;
        dialog.setOpacity(Math.max(this.opacity, 0));
        if (this.opacity <= 0) {
          timer.stop();
          dialog.dispose();
        }
      }
    });

    dialog.setOpacity(1);
    timer.start();
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
public void setOpacity(float aValue) {
  opacity = aValue;
  if (surface instanceof JDialog) {
    ((JDialog) surface).setOpacity(opacity);
  }
  if (surface instanceof JInternalFrame) {
    ((JInternalFrame) surface).setOpaque(opacity > 0.5f);
  }
  if (surface instanceof JFrame) {
    ((JFrame) surface).setOpacity(opacity);
  }
}

代码示例来源:origin: stackoverflow.com

modalBlocker.setModal(true);
modalBlocker.setUndecorated(true);
modalBlocker.setOpacity(0.0f);
modalBlocker.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
final CountDownLatch modalityLatch = new CountDownLatch(1);

代码示例来源:origin: com.eas.platypus/platypus-js-forms

dialog.setUndecorated(undecorated);
if (dialog.isUndecorated()) {
  dialog.setOpacity(opacity);

相关文章

JDialog类方法