⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jad_gui.java

📁 jad是一款JAVA的反编译软件.. 但是所有的操作只能在DOS下进行,我在这里为其增加了GUI功能.操作相对比较简单.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	 * This method initializes jButton2
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJButton2() {
		if (jButton2 == null) {
			jButton2 = new JButton();
			jButton2.setBounds(new Rectangle(359, 54, 69, 18));
			jButton2.setFont(new Font("Dialog", Font.PLAIN, 12));
			jButton2.setText("浏览...");
			jButton2.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					openFile("class");
				}
			});
		}
		return jButton2;
	}

	/**
	 * This method initializes jButton5
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJButton5() {
		if (jButton5 == null) {
			jButton5 = new JButton();
			jButton5.setBounds(new Rectangle(358, 82, 69, 18));
			jButton5.setFont(new Font("Dialog", Font.PLAIN, 12));
			jButton5.setText("浏览...");
			jButton5.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					System.out.println("actionPerformed()"); // TODO
					openDir();											// Auto-generated
																// Event stub
																// actionPerformed()
				}
			});
		}
		return jButton5;
	}

	/**
	 * This method initializes jPanel1	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel1() {
		if (jPanel1 == null) {
			jPanel1 = new JPanel();
			jPanel1.setLayout(null);
			jPanel1.setBounds(new Rectangle(12, 254, 452, 55));
			jPanel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED), "\u9009\u9879\u5361", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.PLAIN, 12), SystemColor.controlText));
			jPanel1.add(getJRadioButton2(), null);
			jPanel1.add(getJRadioButton3(), null);
			jPanel1.add(getJTextField(), null);
		}
		return jPanel1;
	}

	/**
	 * This method initializes jRadioButton2	
	 * 	
	 * @return javax.swing.JRadioButton	
	 */
	private JRadioButton getJRadioButton2() {
		if (jRadioButton2 == null) {
			jRadioButton2 = new JRadioButton();
			jRadioButton2.setText("保存到系统默认目录");
			jRadioButton2.setSize(new Dimension(142, 18));
			jRadioButton2.setFont(new Font("Dialog", Font.PLAIN, 12));
			jRadioButton2.setLocation(new Point(16, 25));
			jRadioButton2.setSelected(true);
			jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					jTextField.setEditable(false);
				}
			});
			buttons1.add(jRadioButton2);
			
		}
		return jRadioButton2;
	}
private ButtonGroup buttons1=new ButtonGroup();

private JTextPane jTextPane = null;

private JButton jButton = null;

/**
	 * This method initializes jRadioButton3	
	 * 	
	 * @return javax.swing.JRadioButton	
	 */
	private JRadioButton getJRadioButton3() {
		if (jRadioButton3 == null) {
			jRadioButton3 = new JRadioButton();
			jRadioButton3.setPreferredSize(new Dimension(77, 18));
			jRadioButton3.setLocation(new Point(216, 25));
			jRadioButton3.setSize(new Dimension(77, 18));
			jRadioButton3.setFont(new Font("Dialog", Font.PLAIN, 12));
			jRadioButton3.setText("自己命名");
			jRadioButton3.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					jTextField.setEditable(true);
				}
			});
			buttons1.add(jRadioButton3);
		}
		return jRadioButton3;
	}

	/**
	 * This method initializes jTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField() {
		if (jTextField == null) {
			jTextField = new JTextField();
			jTextField.setSize(new Dimension(125, 18));
			jTextField.setLocation(new Point(300, 25));
			if(jRadioButton2.isSelected())
					jTextField.setEditable(false);
		}
		return jTextField;
	}

	/**
	 * This method initializes jTextPane	
	 * 	
	 * @return javax.swing.JTextPane	
	 */
	private JTextPane getJTextPane() {
		if (jTextPane == null) {
			jTextPane = new JTextPane();
			jTextPane.setBounds(new Rectangle(13, 7, 453, 83));
			jTextPane.setFont(new Font("Dialog", Font.PLAIN, 12));
			jTextPane.setText("软件说明:该软件对sun公司的jad反编译软件进行的修补.为其提供了GUI支持。版权所有:shuxudong345@163.com.需要帮助请联系:114942333(QQ)");
		}
		return jTextPane;
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			jButton.setBounds(new Rectangle(435, 95, 34, 10));
		}
		return jButton;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		jad_gui jad = new jad_gui(null);
		jad.show();
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/**
	 * @param owner
	 */
	public jad_gui(Frame owner) {
		super(owner);
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(490, 390);
		this.setTitle("jad_gui反编译");
		this.setResizable(false);
		this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		this.setContentPane(getJContentPane());
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jLabel = new JLabel();
			jLabel.setBounds(new Rectangle(12, 107, 136, 18));
			jLabel.setFont(new Font("Dialog", Font.PLAIN, 12));
			jLabel.setText("反编译程序(jad.exe):");
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.setSize(new Dimension(473, 301));
			jContentPane.add(getJButton3(), null);
			jContentPane.add(getJButton(), null);
			jContentPane.add(getJButton4(), null);
			jContentPane.add(getJPanel(), null);
			jContentPane.add(jLabel, null);
			jContentPane.add(getJadpath(), null);
			jContentPane.add(getJButton1(), null);
			jContentPane.add(getJPanel1(), null);
			jContentPane.add(getJTextPane(), null);
		}
		return jContentPane;
	}

	private File createBATFile(String defaultPath) {
		System.out.println("file created:" + defaultPath);
		File batFile = new File(defaultPath);
		try {
			batFile.createNewFile();
			batFile.deleteOnExit();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			JOptionPane.showMessageDialog(jad_gui.this, e.getMessage());
		}
		return batFile;

	}
	public String getDisk(String jadPath) {
		return jadPath == null ? "" : (jadPath.substring(0, 2));
	}

	public String getJadDir(String jadPath) {
		return jadPath == null ? "" : (jadPath.substring(3, jadPath
				.lastIndexOf(File.separator)));
	}

	public void writeFromBuffer(StringBuffer buffer, OutputStream os) {
		// 用 PrintStream 可以方便的把内容输出到输出流中
		// 其对象的用法和 System.out 一样
		// (System.out 本身就是 PrintStream 对象)
		PrintStream ps = new PrintStream(os);
		ps.print(buffer.toString());
	}

	public void openDir() {
		JFileChooser   chooser   =   new   JFileChooser();   
	    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);//
	    int option=chooser.showOpenDialog(jad_gui.this);
	    if (option == JFileChooser.APPROVE_OPTION) {
	    	classdirPath.setText(chooser.getSelectedFile().getAbsolutePath());
			
		}
	}

	public String openFile(final String filterType) {
		JFileChooser fc = new JFileChooser();
		fc.setFileFilter(new javax.swing.filechooser.FileFilter() {
			public boolean accept(java.io.File f) {
				if (f.isDirectory())
					return true;
				if (f.getName().endsWith("." + filterType)
						|| f.getName().endsWith(".EXE"))
					return true; // INN
				return false;
			}

			// The description of this filter
			public String getDescription() {
				return filterType + "文件";
			}
		});
		int option = fc.showOpenDialog(jad_gui.this);
		if (option == JFileChooser.APPROVE_OPTION) {
			if (filterType == "exe")
				getJadpath().setText(fc.getSelectedFile().getAbsolutePath());
			if (filterType == "class")
				classpath.setText(fc.getSelectedFile().getAbsolutePath());
		}

		return fc.getName();
	}
	public void runBatFile(String path) {
		String exeBat = path;
		System.out.println("run:"+exeBat);
		try {
			Process process = Runtime.getRuntime().exec(exeBat);
			process.waitFor();

		} catch (IOException e) {
			// TODO Auto-generated catch block
			JOptionPane.showMessageDialog(jad_gui.this, e.getMessage());
		}//
		catch (InterruptedException e) {
			// TODO Auto-generated catch block
			JOptionPane.showMessageDialog(jad_gui.this, e.getMessage());
		}
		
	}
	
}  //  @jve:decl-index=0:visual-constraint="10,10"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -