⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windowinterceptortestcase.java

📁 基于Junit的 功能和单元测试的的测试工具。只支持Swing.
💻 JAVA
字号:
package org.uispec4j.interception;

import org.uispec4j.Trigger;

import javax.swing.*;
import java.awt.event.ActionEvent;

public abstract class WindowInterceptorTestCase extends InterceptionTestCase {
  protected Trigger getShowFirstDialogTrigger() {
    return new Trigger() {
      public void run() throws Exception {
        JDialog firstDialog = createDialogs();
        logger.log("trigger");
        firstDialog.show();
      }
    };
  }

  private JDialog createDialogs() {
    final JFrame frame = new JFrame();

    final JDialog firstDialog = new JDialog(frame, "first dialog", true);
    addHideButton(firstDialog, "Dispose");

    JDialog secondDialog = new JDialog(frame, "second dialog", true);
    addShowDialogAndCloseButton(firstDialog, "OK", secondDialog);
    addHideButton(secondDialog, "Dispose");

    JDialog thirdDialog = new JDialog(frame, "third dialog", true);
    addHideButton(thirdDialog, "Dispose");
    addShowDialogAndCloseButton(secondDialog, "OK", thirdDialog);
    return firstDialog;
  }

  protected static class ShowDialogAction extends AbstractAction {
    private boolean modal;

    public ShowDialogAction(boolean modal) {
      super("Run");
      this.modal = modal;
    }

    public void actionPerformed(ActionEvent e) {
      JDialog dialog = new JDialog();
      dialog.setModal(modal);
      dialog.setTitle("MyDialog");
      dialog.show();
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -