windowinterceptortestcase.java
来自「基于Junit的 功能和单元测试的的测试工具。只支持Swing.」· Java 代码 · 共 51 行
JAVA
51 行
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 + =
减小字号Ctrl + -
显示快捷键?