prompt.java
来自「SRI international 发布的OAA框架软件」· Java 代码 · 共 55 行
JAVA
55 行
/*
#=========================================================================
# Copyright 2003 SRI International. All rights reserved.
#
# The material contained in this file is confidential and proprietary to SRI
# International and may not be reproduced, published, or disclosed to others
# without authorization from SRI International.
#
# DISCLAIMER OF WARRANTIES
#
# SRI International MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
# SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SRI International SHALL NOT BE
# LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
#=========================================================================
Author : shardt
Date: Sep 25, 2003
*/
package com.sri.oaa2.tools.oaatest;
import javax.swing.*;
/** Used for user-assisted testing. Display a dialog telling the tester what
* to do next.
*/
public class Prompt {
public static void prompt(String s) {
// Strip lead and tail whitespace.
int startIndex = 0;
int endIndex = s.length();
for (startIndex = 0; startIndex < s.length(); startIndex++) {
if (!Character.isWhitespace(s.charAt(startIndex))) {
break;
}
}
for (endIndex = s.length(); endIndex > startIndex; endIndex--) {
if (!Character.isWhitespace(s.charAt(endIndex - 1))) {
break;
}
}
String message = s.substring(startIndex,endIndex);
JTextArea textArea = new JTextArea(message);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setBounds(0,0,400,1000);
JOptionPane.showMessageDialog(null,textArea,
"User-Assisted Testing",JOptionPane.INFORMATION_MESSAGE);
}
static final String ERR_DUPLICATE_MESSAGE = "<prompt> can have \"message\" attribute or text contents, but not both.";
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?