Swing Explorer 1.0发布

SwingExplorer是一款用于开发Swing应用程序的工具,它能够以可视化的形式展示Swing应用程序的内部结构,并能监测所有事件及组件属性变化。
 Swing Explorer是一个用于开发Swing的工具.它通过可视的方式展示基于Swing的应用程序的内部结构.Swing Explorer能够将一个Swing应用中所有的组件按组织关系通过树的形式表现出来,对于树中的每一个组件,都可以在Swing Explorer的工作区域中显示出来.
 Swing Explorer能够监测到Swing应用中的所有事件以及组件的属性.并且能够像DebugGraphics一样观察Swing中的图形操作事件.下面的截图展示了Swing Explorer的工作界面:
 清点左边广告
关于MyExplorer MyExplorer是一款模仿Mircrosoft Windows 的资源管理器,使用JAVA编写,目前支持中文,日文,英文三个语言版本,供大家学习参考之用。 开发环境:Microsoft Windows XP SP2 + JDK 1.5.0 + Eclipse 3.3 使用说明: ⋆ 1.MyExplorer启动时默认设置为系统所使用的语言,目前提供中文,日文,英文三种语言版本。 ⋆ 2.选择语言后可进入下一界面,默认显示为Windows桌面。 ⋆ 3.向上功能:当所访问的目录不是桌面时,该按钮可用,可以用来访问父目录。 ⋆ 4.搜索功能:可以通过搜索按钮,在指定的目录下,搜索指定的文件,支持模糊搜索。 ⋆ 5.关于MyExplorer功能,可通过点击该按钮查看作者以及联系方式和版本信息。 ⋆ 6.转到功能:可在地址栏中输入目录名或文件名,点击“转到”按钮,访问相应的目录或文件。 ⋆ 7.执行功能,可在右侧List中双击访问该目录或双击运行某一文件。也可在左侧Tree上点击访问某一目录。 ⋆ 8.右键功能,可在某一目录或文件上单击右键,在弹出的右键菜单上使用相应的功能。目前提供复制,粘贴,刷新,重命名,删除(会彻底删除文件,不会移动到回收站,使用时请注意),新建,属性查看功能。 ♦ 复制功能:可复制一个文件,也可复制多个文件。 ♦ 粘贴功能:在需要粘贴的目录中粘贴所复制的文件。 ♦ 重命名功能 ♦ 删除功能 ♦ 新建功能:可新建文件夹,txt文档,doc文档,xls文档 ♦ 属性查看功能
package A; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; public class Carculator extends JFrame implements ActionListener { /*****北面的控件******/ private JPanel jp_north = new JPanel();//设置了一个面板(面板没有设置布局是一个流式布局) private JTextField input_text = new JTextField(); // private JButton c_Btn=new JButton("c");//北面的两个控件 /*****中间的控件******/ private JPanel jp_Center = new JPanel(); public Carculator() throws HeadlessException { this.init(); this.addnorth(); this.addCenterButton(); } //初始化的方法 public void init() { this.setTitle("计算器"); this.setSize(600, 600); this.setLayout(new BorderLayout()); this.setResizable(false);//窗体不可以随便拉 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } //添加北面的控件 public void addnorth() { this.input_text.setPreferredSize(new Dimension(280, 30)); jp_north.add(input_text); this.add(jp_north, BorderLayout.NORTH);//把面板加载到窗体里面(北面) } //添加中间的按钮 public void addCenterButton() { String[] string = {"1", "2", "3", "+", "C", "4", "5", "6", "-", "←", "7", "8", "9", "*", "1/x", "0", "+/-", ".", "/", "="}; this.jp_Center.setLayout(new GridLayout(4, 5));//网格布局4行5列 //加了二十个按钮到中间面板中 for (int i = 0; i < 20; i++) { //字符串取出添加到了按钮中去 String text = string[i]; JButton btn = new JButton(text); if (text.equals("+") || text.equals("-") || text.equals("*") || text.equals("/") || text.equals("C") || text.equals("←") || text.equals("1/x") || text.equals("+/-") || text.equals(".") || text.equals("=")) { btn.setForeground(Color.red); } btn.addActionListener(this);//监听 jp_Center.add(btn); } this.add(jp_Center, BorderLayout.CENTER);//把中间面板加载到整个窗体的中间(因为窗体是一个borderLayout) } public static void main(String[] args) { Carculator carculator = new Carculator(); carculator.setVisible(true); } private String firstInput = null; private String operator = null; public void actionPerformed(ActionEvent e) { //数字的监听 String clickStr = e.getActionCommand(); if (clickStr.equals("C")) { input_text.setText(""); firstInput = null; operator = null; } else if (clickStr.equals("1/x")) { this.input_text.setText(1.0 / Double.valueOf(this.input_text.getText())+""); } else if (clickStr.equals("+/-")) { if (this.input_text.getText().indexOf('+') != -1 || this.input_text.getText().indexOf('-') != -1) { System.out.println(clickStr); if (this.input_text.getText().indexOf('+') != -1) { // System.out.println("+在里面"); this.input_text.setText(this.input_text.getText().substring(1)); this.input_text.setText("-" + input_text.getText());//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } else if (this.input_text.getText().indexOf('-') != -1) { // System.out.println("-在里面"); this.input_text.setText(this.input_text.getText().substring(1)); this.input_text.setText("+" + input_text.getText());//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else { this.input_text.setText("+" + input_text.getText());//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else if (clickStr.equals("←")) { if (!this.input_text.getText().isEmpty()) { this.input_text.setText(this.input_text.getText().substring(0, this.input_text.getText().length() - 1)); } } else if (".0123456789".indexOf(clickStr) != -1) { if (".".equals(clickStr)) { if (input_text.getText().indexOf('.') == -1) { this.input_text.setText(input_text.getText() + clickStr);//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else { this.input_text.setText(input_text.getText() + clickStr);//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else if (clickStr.matches("[\\+\\-*/]{1}")) { // 存储+-*/ operator = clickStr; // 存储前值 firstInput = this.input_text.getText(); this.input_text.setText(""); } else if (clickStr.equals("=")) { Double a = Double.valueOf(firstInput); Double b = Double.valueOf(this.input_text.getText()); Double result = null; switch (operator) { case "+": result = a + b; break; case "-": result = a - b; break; case "*": result = a * b; break; case "/": if (b != 0) { result = a / b; } break; } this.input_text.setText(result.toString()); } } } package A; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; public class Carculator extends JFrame implements ActionListener { /*****北面的控件******/ private JPanel jp_north = new JPanel();//设置了一个面板(面板没有设置布局是一个流式布局) private JTextField input_text = new JTextField(); // private JButton c_Btn=new JButton("c");//北面的两个控件 /*****中间的控件******/ private JPanel jp_Center = new JPanel(); public Carculator() throws HeadlessException { this.init(); this.addnorth(); this.addCenterButton(); } //初始化的方法 public void init() { this.setTitle("计算器"); this.setSize(600, 600); this.setLayout(new BorderLayout()); this.setResizable(false);//窗体不可以随便拉 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } //添加北面的控件 public void addnorth() { this.input_text.setPreferredSize(new Dimension(280, 30)); jp_north.add(input_text); this.add(jp_north, BorderLayout.NORTH);//把面板加载到窗体里面(北面) } //添加中间的按钮 public void addCenterButton() { String[] string = {"1", "2", "3", "+", "C", "4", "5", "6", "-", "←", "7", "8", "9", "*", "1/x", "0", "+/-", ".", "/", "="}; this.jp_Center.setLayout(new GridLayout(4, 5));//网格布局4行5列 //加了二十个按钮到中间面板中 for (int i = 0; i < 20; i++) { //字符串取出添加到了按钮中去 String text = string[i]; JButton btn = new JButton(text); if (text.equals("+") || text.equals("-") || text.equals("*") || text.equals("/") || text.equals("C") || text.equals("←") || text.equals("1/x") || text.equals("+/-") || text.equals(".") || text.equals("=")) { btn.setForeground(Color.red); } btn.addActionListener(this);//监听 jp_Center.add(btn); } this.add(jp_Center, BorderLayout.CENTER);//把中间面板加载到整个窗体的中间(因为窗体是一个borderLayout) } public static void main(String[] args) { Carculator carculator = new Carculator(); carculator.setVisible(true); } private String firstInput = null; private String operator = null; public void actionPerformed(ActionEvent e) { //数字的监听 String clickStr = e.getActionCommand(); if (clickStr.equals("C")) { input_text.setText(""); firstInput = null; operator = null; } else if (clickStr.equals("1/x")) { this.input_text.setText(1.0 / Double.valueOf(this.input_text.getText())+""); } else if (clickStr.equals("+/-")) { if (this.input_text.getText().indexOf('+') != -1 || this.input_text.getText().indexOf('-') != -1) { System.out.println(clickStr); if (this.input_text.getText().indexOf('+') != -1) { // System.out.println("+在里面"); this.input_text.setText(this.input_text.getText().substring(1)); this.input_text.setText("-" + input_text.getText());//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } else if (this.input_text.getText().indexOf('-') != -1) { // System.out.println("-在里面"); this.input_text.setText(this.input_text.getText().substring(1)); this.input_text.setText("+" + input_text.getText());//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else { this.input_text.setText("+" + input_text.getText());//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else if (clickStr.equals("←")) { if (!this.input_text.getText().isEmpty()) { this.input_text.setText(this.input_text.getText().substring(0, this.input_text.getText().length() - 1)); } } else if (".0123456789".indexOf(clickStr) != -1) { if (".".equals(clickStr)) { if (input_text.getText().indexOf('.') == -1) { this.input_text.setText(input_text.getText() + clickStr);//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else { this.input_text.setText(input_text.getText() + clickStr);//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else if (clickStr.matches("[\\+\\-*/]{1}")) { // 存储+-*/ operator = clickStr; // 存储前值 firstInput = this.input_text.getText(); this.input_text.setText(""); } else if (clickStr.equals("=")) { Double a = Double.valueOf(firstInput); Double b = Double.valueOf(this.input_text.getText()); Double result = null; switch (operator) { case "+": result = a + b; break; case "-": result = a - b; break; case "*": result = a * b; break; case "/": if (b != 0) { result = a / b; } break; } this.input_text.setText(result.toString()); } } } package A; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; public class Carculator extends JFrame implements ActionListener { /*****北面的控件******/ private JPanel jp_north = new JPanel();//设置了一个面板(面板没有设置布局是一个流式布局) private JTextField input_text = new JTextField(); // private JButton c_Btn=new JButton("c");//北面的两个控件 /*****中间的控件******/ private JPanel jp_Center = new JPanel(); public Carculator() throws HeadlessException { this.init(); this.addnorth(); this.addCenterButton(); } //初始化的方法 public void init() { this.setTitle("计算器"); this.setSize(600, 600); this.setLayout(new BorderLayout()); this.setResizable(false);//窗体不可以随便拉 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } //添加北面的控件 public void addnorth() { this.input_text.setPreferredSize(new Dimension(280, 30)); jp_north.add(input_text); this.add(jp_north, BorderLayout.NORTH);//把面板加载到窗体里面(北面) } //添加中间的按钮 public void addCenterButton() { String[] string = {"1", "2", "3", "+", "C", "4", "5", "6", "-", "←", "7", "8", "9", "*", "1/x", "0", "+/-", ".", "/", "="}; this.jp_Center.setLayout(new GridLayout(4, 5));//网格布局4行5列 //加了二十个按钮到中间面板中 for (int i = 0; i < 20; i++) { //字符串取出添加到了按钮中去 String text = string[i]; JButton btn = new JButton(text); if (text.equals("+") || text.equals("-") || text.equals("*") || text.equals("/") || text.equals("C") || text.equals("←") || text.equals("1/x") || text.equals("+/-") || text.equals(".") || text.equals("=")) { btn.setForeground(Color.red); } btn.addActionListener(this);//监听 jp_Center.add(btn); } this.add(jp_Center, BorderLayout.CENTER);//把中间面板加载到整个窗体的中间(因为窗体是一个borderLayout) } public static void main(String[] args) { Carculator carculator = new Carculator(); carculator.setVisible(true); } private String firstInput = null; private String operator = null; public void actionPerformed(ActionEvent e) { //数字的监听 String clickStr = e.getActionCommand(); if (clickStr.equals("C")) { input_text.setText(""); firstInput = null; operator = null; } else if (clickStr.equals("1/x")) { this.input_text.setText(1.0 / Double.valueOf(this.input_text.getText())+""); } else if (clickStr.equals("+/-")) { if (this.input_text.getText().indexOf('+') != -1 || this.input_text.getText().indexOf('-') != -1) { System.out.println(clickStr); if (this.input_text.getText().indexOf('+') != -1) { // System.out.println("+在里面"); this.input_text.setText(this.input_text.getText().substring(1)); this.input_text.setText("-" + input_text.getText());//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } else if (this.input_text.getText().indexOf('-') != -1) { // System.out.println("-在里面"); this.input_text.setText(this.input_text.getText().substring(1)); this.input_text.setText("+" + input_text.getText());//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else { this.input_text.setText("+" + input_text.getText());//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else if (clickStr.equals("←")) { if (!this.input_text.getText().isEmpty()) { this.input_text.setText(this.input_text.getText().substring(0, this.input_text.getText().length() - 1)); } } else if (".0123456789".indexOf(clickStr) != -1) { if (".".equals(clickStr)) { if (input_text.getText().indexOf('.') == -1) { this.input_text.setText(input_text.getText() + clickStr);//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else { this.input_text.setText(input_text.getText() + clickStr);//后输入的值显示在前面 this.input_text.setHorizontalAlignment(JTextField.RIGHT);//文本框从右边往左显示 } } else if (clickStr.matches("[\\+\\-*/]{1}")) { // 存储+-*/ operator = clickStr; // 存储前值 firstInput = this.input_text.getText(); this.input_text.setText(""); } else if (clickStr.equals("=")) { Double a = Double.valueOf(firstInput); Double b = Double.valueOf(this.input_text.getText()); Double result = null; switch (operator) { case "+": result = a + b; break; case "-": result = a - b; break; case "*": result = a * b; break; case "/": if (b != 0) { result = a / b; } break; } this.input_text.setText(result.toString()); } } } 根据代码帮我画一个uml类图
06-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值