📄 testsystem.java
字号:
package jm.form.msn.form;import java.awt.BorderLayout;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.io.File;import javax.imageio.ImageIO;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;import jm.JM;import jm.form.msn.bean.BusinessUser;import jm.form.msn.config.JMMRConfigConstants;import jm.form.msn.ctrl.MsnMessageCenter;import jm.form.msn.util.Manager;/** * 系统测试 * 梦界家园MSNP15 * @author ISHome * @since 0.5.0.2 * @version 0.5.0.2.1 */public class TestSystem extends javax.swing.JDialog implements JMMRConfigConstants { private JButton test; private JPanel commandPanel; private JScrollPane inputScrollPane; private JScrollPane outputScrollPane; private JTextArea output; private JTextArea input; private JPanel testPanel; private JButton clear; private Manager manager = null; public TestSystem(JFrame form, Manager server) { super(form, true); manager = server; initGUI(); } public TestSystem(JDialog form, Manager server) { super(form, true); manager = server; initGUI(); } private void initGUI() { try { { commandPanel = new JPanel(); GridLayout commandPanelLayout = new GridLayout(1, 1); commandPanelLayout.setColumns(1); commandPanelLayout.setHgap(5); commandPanelLayout.setVgap(5); commandPanel.setLayout(commandPanelLayout); getContentPane().add(commandPanel, BorderLayout.NORTH); commandPanel.setPreferredSize(new java.awt.Dimension(392, 30)); { clear = new JButton(); commandPanel.add(clear); clear.setFont(BUTTON_FOUNT); clear.setText(manager.getConfigMap().get(LANG_TEST_BUTTON_CLEAR_TEXT)); clear.setToolTipText(manager.getConfigMap().get(LANG_TEST_BUTTON_CLEAR_HELP)); clear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { reLoad(); } }); } { test = new JButton(); commandPanel.add(test); test.setFont(BUTTON_FOUNT); test.setText(manager.getConfigMap().get(LANG_TEST_BUTTON_TEST_TEXT)); test.setToolTipText(manager.getConfigMap().get(LANG_TEST_BUTTON_TEST_HELP)); test.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { testSystem(); } }); } } { testPanel = new JPanel(); getContentPane().add(testPanel, BorderLayout.CENTER); BorderLayout bottomPanelLayout = new BorderLayout(); testPanel.setPreferredSize(new java.awt.Dimension(138, 99)); testPanel.setLayout(bottomPanelLayout); { inputScrollPane = new JScrollPane(); testPanel.add(inputScrollPane, BorderLayout.NORTH); inputScrollPane.setPreferredSize(new java.awt.Dimension(392, 55)); { input = new JTextArea(); inputScrollPane.setViewportView(input); } } { outputScrollPane = new JScrollPane(); testPanel.add(outputScrollPane, BorderLayout.CENTER); { output = new JTextArea(); outputScrollPane.setViewportView(output); } } } { this.setTitle(manager.getConfigMap().get(LANG_TEST_FORM_TITLE)); this.addWindowListener(new WindowAdapter() { /** * 窗口正处在关闭过程中时调用。此时可重写关闭操作。 * * @param e */ public void windowClosing(WindowEvent e) { dispose();// 关闭画面 } }); this.reLoad(); // 配置系统图标 this.setIconImage(ImageIO.read(new File(manager.getConfigMap().get(STYLES_MAIN_FORM_TEST)))); this.pack(); this.setSize(640, 480); } } catch (Exception e) { e.printStackTrace(); } } /** * reLoad */ public void reLoad(){ input.setText(manager.getConfigMap().get(LANG_TEST_TEXT_INPUT_VALUE)); output.setText(manager.getConfigMap().get(LANG_TEST_TEXT_OUTPUT_VALUE)); } /** * 脱机状态下系统测试 */ public void testSystem(){ try { // 取得命令 String command = input.getText(); String sessionID = JM.Author; BusinessUser u = manager.getUserList().get(sessionID); if (u == null) { u = new BusinessUser(); } u.setMsnID(JM.Group); u.setUserID(JM.Author); u.setCommand(command); manager.getUserList().put(sessionID, u); output.setText((new MsnMessageCenter(manager)).invoker(u)); } catch (Exception ex) { ex.printStackTrace(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -