提交 8362c218 编写于 作者: T tianqiao

转义console的代码到test中,增加test中resource的资源

上级 0cf7effd
package com.ql.util.express.console; package com.ql.util.express.console;
import java.awt.Toolkit; import javax.swing.*;
import javax.swing.SwingUtilities; import java.awt.*;
import javax.swing.UIManager;
import java.awt.Dimension;
public class Console { public class Console {
boolean packFrame = false; boolean packFrame = false;
......
package com.ql.util.express.console; package com.ql.util.express.console;
import java.awt.BorderLayout; import com.ql.util.express.DefaultContext;
import java.awt.Dimension; import com.ql.util.express.ExpressRunner;
import com.ql.util.express.console.FileTree.PathNode;
import javax.swing.*;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.ByteArrayOutputStream; import java.io.*;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map; import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
import javax.swing.tree.TreePath;
import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;
import com.ql.util.express.console.FileTree.PathNode;
public class ConsoleFrame public class ConsoleFrame
extends JFrame { extends JFrame {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -42,7 +23,7 @@ public class ConsoleFrame ...@@ -42,7 +23,7 @@ public class ConsoleFrame
JMenuItem jMenuFileExit = new JMenuItem(); JMenuItem jMenuFileExit = new JMenuItem();
JToolBar jToolBar = new JToolBar(); JToolBar jToolBar = new JToolBar();
JButton jButton1 = new JButton(); JButton jButton1 = new JButton();
ImageIcon image1 = new ImageIcon(com.ql.util.express.console.ConsoleFrame.class. ImageIcon image1 = new ImageIcon(ConsoleFrame.class.
getResource("run.png")); getResource("run.png"));
JLabel statusBar = new JLabel(); JLabel statusBar = new JLabel();
JTabbedPane jTabbedPaneContent = new JTabbedPane(); JTabbedPane jTabbedPaneContent = new JTabbedPane();
...@@ -81,7 +62,7 @@ public class ConsoleFrame ...@@ -81,7 +62,7 @@ public class ConsoleFrame
/** /**
* Component initialization. * Component initialization.
* *
* @throws java.lang.Exception * @throws Exception
*/ */
private void jbInit() throws Exception { private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane(); contentPane = (JPanel) getContentPane();
...@@ -115,16 +96,16 @@ public class ConsoleFrame ...@@ -115,16 +96,16 @@ public class ConsoleFrame
jButton1.setToolTipText("执行"); jButton1.setToolTipText("执行");
jToolBar.add(jButton1); jToolBar.add(jButton1);
contentPane.add(statusBar, BorderLayout.SOUTH); contentPane.add(statusBar, BorderLayout.SOUTH);
jPanelResult.add(jScrollPaneResult, java.awt.BorderLayout.CENTER); jPanelResult.add(jScrollPaneResult, BorderLayout.CENTER);
jPanelResult.add(jLabelResult, java.awt.BorderLayout.NORTH); jPanelResult.add(jLabelResult, BorderLayout.NORTH);
jSplitPaneRun.add(jSplitPaneS_C, JSplitPane.TOP); jSplitPaneRun.add(jSplitPaneS_C, JSplitPane.TOP);
jScrollPaneResult.getViewport().add(jTextAreaResult); jScrollPaneResult.getViewport().add(jTextAreaResult);
jPanelScript.add(jLabelScript, java.awt.BorderLayout.NORTH); jPanelScript.add(jLabelScript, BorderLayout.NORTH);
jPanelScript.add(jScrollPaneScript, java.awt.BorderLayout.CENTER); jPanelScript.add(jScrollPaneScript, BorderLayout.CENTER);
jScrollPaneScript.getViewport().add(jTextAreaScript); jScrollPaneScript.getViewport().add(jTextAreaScript);
jPanelContext.add(jLabelContext, java.awt.BorderLayout.NORTH); jPanelContext.add(jLabelContext, BorderLayout.NORTH);
jPanelContext.add(jScrollPaneContext, java.awt.BorderLayout.CENTER); jPanelContext.add(jScrollPaneContext, BorderLayout.CENTER);
jSplitPaneS_C.add(jPanelScript, JSplitPane.LEFT); jSplitPaneS_C.add(jPanelScript, JSplitPane.LEFT);
jScrollPaneContext.getViewport().add(jTextAreaContext); jScrollPaneContext.getViewport().add(jTextAreaContext);
jSplitPaneS_C.setDividerSize(2); jSplitPaneS_C.setDividerSize(2);
...@@ -133,9 +114,9 @@ public class ConsoleFrame ...@@ -133,9 +114,9 @@ public class ConsoleFrame
jSplitPaneS_C.setDividerLocation(500); jSplitPaneS_C.setDividerLocation(500);
jSplitPaneRun.add(jPanelResult, JSplitPane.RIGHT); jSplitPaneRun.add(jPanelResult, JSplitPane.RIGHT);
jTabbedPaneContent.add(jPaneRunner, "\u6267\u884c\u4ee3\u7801"); jTabbedPaneContent.add(jPaneRunner, "\u6267\u884c\u4ee3\u7801");
jPaneRunner.add(jSplitPaneRun, java.awt.BorderLayout.CENTER); jPaneRunner.add(jSplitPaneRun, BorderLayout.CENTER);
contentPane.add(jTabbedPaneContent, java.awt.BorderLayout.CENTER); contentPane.add(jTabbedPaneContent, BorderLayout.CENTER);
contentPane.add(jToolBar, java.awt.BorderLayout.NORTH); contentPane.add(jToolBar, BorderLayout.NORTH);
jSplitPaneRun.setDividerLocation(200); jSplitPaneRun.setDividerLocation(200);
} }
......
package com.ql.util.express.console; package com.ql.util.express.console;
import java.awt.BorderLayout; import com.ql.util.express.DefaultContext;
import java.awt.Dimension; import com.ql.util.express.ExpressRunner;
import com.ql.util.express.console.FileTree.PathNode;
import javax.swing.*;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
...@@ -10,25 +15,6 @@ import java.io.PrintWriter; ...@@ -10,25 +15,6 @@ import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.Map; import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
import javax.swing.tree.TreePath;
import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;
import com.ql.util.express.console.FileTree.PathNode;
public class ConsoleFrame2 public class ConsoleFrame2
extends JFrame { extends JFrame {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -39,7 +25,7 @@ public class ConsoleFrame2 ...@@ -39,7 +25,7 @@ public class ConsoleFrame2
JMenuItem jMenuFileExit = new JMenuItem(); JMenuItem jMenuFileExit = new JMenuItem();
JToolBar jToolBar = new JToolBar(); JToolBar jToolBar = new JToolBar();
JButton jButton1 = new JButton(); JButton jButton1 = new JButton();
ImageIcon image1 = new ImageIcon(com.ql.util.express.console.ConsoleFrame2.class. ImageIcon image1 = new ImageIcon(ConsoleFrame2.class.
getResource("run.png")); getResource("run.png"));
JLabel statusBar = new JLabel(); JLabel statusBar = new JLabel();
JSplitPane jSplitPaneMain = new JSplitPane(); JSplitPane jSplitPaneMain = new JSplitPane();
...@@ -86,7 +72,7 @@ public class ConsoleFrame2 ...@@ -86,7 +72,7 @@ public class ConsoleFrame2
/** /**
* Component initialization. * Component initialization.
* *
* @throws java.lang.Exception * @throws Exception
*/ */
private void jbInit() throws Exception { private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane(); contentPane = (JPanel) getContentPane();
...@@ -125,21 +111,21 @@ public class ConsoleFrame2 ...@@ -125,21 +111,21 @@ public class ConsoleFrame2
jButton1.setToolTipText("执行"); jButton1.setToolTipText("执行");
jToolBar.add(jButton1); jToolBar.add(jButton1);
contentPane.add(statusBar, BorderLayout.SOUTH); contentPane.add(statusBar, BorderLayout.SOUTH);
contentPane.add(jSplitPaneMain, java.awt.BorderLayout.CENTER); contentPane.add(jSplitPaneMain, BorderLayout.CENTER);
jTabbedPaneContent.add(jPaneRunner, "执行代码"); jTabbedPaneContent.add(jPaneRunner, "执行代码");
jTabbedPaneContent.add(jPanelHelp, "关键字"); jTabbedPaneContent.add(jPanelHelp, "关键字");
jTabbedPaneContent.add(jPanel3, "帮助"); jTabbedPaneContent.add(jPanel3, "帮助");
jPaneRunner.add(jSplitPaneRun, java.awt.BorderLayout.CENTER); jPaneRunner.add(jSplitPaneRun, BorderLayout.CENTER);
jScrollPaneTree.getViewport().add(this.jTreeFileSelect); jScrollPaneTree.getViewport().add(this.jTreeFileSelect);
jScrollPaneContext.getViewport().add(jTextAreaContext); jScrollPaneContext.getViewport().add(jTextAreaContext);
jScrollPaneResult.getViewport().add(jTextAreaResult); jScrollPaneResult.getViewport().add(jTextAreaResult);
jPanelResult.add(jScrollPaneResult, java.awt.BorderLayout.CENTER); jPanelResult.add(jScrollPaneResult, BorderLayout.CENTER);
jPanelResult.add(jLabelResult, java.awt.BorderLayout.NORTH); jPanelResult.add(jLabelResult, BorderLayout.NORTH);
jPanelScript.add(jLabelScript, java.awt.BorderLayout.NORTH); jPanelScript.add(jLabelScript, BorderLayout.NORTH);
jPanelScript.add(jScrollPaneScript, java.awt.BorderLayout.CENTER); jPanelScript.add(jScrollPaneScript, BorderLayout.CENTER);
jScrollPaneScript.getViewport().add(jTextAreaScript); jScrollPaneScript.getViewport().add(jTextAreaScript);
jPanelContext.add(jLabelContext, java.awt.BorderLayout.NORTH); jPanelContext.add(jLabelContext, BorderLayout.NORTH);
jPanelContext.add(jScrollPaneContext, java.awt.BorderLayout.CENTER); jPanelContext.add(jScrollPaneContext, BorderLayout.CENTER);
jSplitPaneS_C.setDividerSize(2); jSplitPaneS_C.setDividerSize(2);
jSplitPaneS_C.setLastDividerLocation(200); jSplitPaneS_C.setLastDividerLocation(200);
jSplitPaneS_C.add(jPanelContext, JSplitPane.RIGHT); jSplitPaneS_C.add(jPanelContext, JSplitPane.RIGHT);
...@@ -147,8 +133,8 @@ public class ConsoleFrame2 ...@@ -147,8 +133,8 @@ public class ConsoleFrame2
jSplitPaneS_C.setDividerLocation(500); jSplitPaneS_C.setDividerLocation(500);
jSplitPaneRun.add(jPanelResult, JSplitPane.RIGHT); jSplitPaneRun.add(jPanelResult, JSplitPane.RIGHT);
jSplitPaneRun.add(jSplitPaneS_C, JSplitPane.TOP); jSplitPaneRun.add(jSplitPaneS_C, JSplitPane.TOP);
contentPane.add(jToolBar, java.awt.BorderLayout.NORTH); contentPane.add(jToolBar, BorderLayout.NORTH);
contentPane.add(jScrollPaneTree, java.awt.BorderLayout.WEST); contentPane.add(jScrollPaneTree, BorderLayout.WEST);
jScrollPaneTree.getViewport().add(jTreeFileSelect); jScrollPaneTree.getViewport().add(jTreeFileSelect);
jSplitPaneRun.setDividerLocation(200); jSplitPaneRun.setDividerLocation(200);
jSplitPaneMain.setDividerLocation(400); jSplitPaneMain.setDividerLocation(400);
......
package com.ql.util.express.console; package com.ql.util.express.console;
import java.awt.Component; import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
/** /**
* <p>Description: 系统目录树,动态生成,解决载入慢的问题 </p> * <p>Description: 系统目录树,动态生成,解决载入慢的问题 </p>
*/ */
......
package com.ql.util.express.console; package com.ql.util.express.console;
import java.io.FileInputStream; import org.w3c.dom.Document;
import java.io.InputStream; import org.w3c.dom.Node;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath; import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory; import javax.xml.xpath.XPathFactory;
import java.io.FileInputStream;
import org.w3c.dom.Document; import java.io.InputStream;
import org.w3c.dom.Node;
public class ReadExample { public class ReadExample {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册