📄 jad_gui.java
字号:
package jad;
import javax.swing.JPanel;
import java.awt.Frame;
import javax.swing.ButtonGroup;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.WindowConstants;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.Dimension;
import javax.swing.JRadioButton;
import java.awt.Font;
import javax.swing.BorderFactory;
import javax.swing.border.BevelBorder;
import javax.swing.border.TitledBorder;
import java.awt.SystemColor;
import java.awt.Point;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import javax.swing.JTextPane;
public class jad_gui extends JDialog {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,682"
private JButton jButton3 = null;
private JButton jButton4 = null;
private JPanel jPanel = null;
private JRadioButton jRadioButton = null;
private JRadioButton jRadioButton1 = null;
private ButtonGroup buttons = new ButtonGroup(); // @jve:decl-index=0:
private JLabel jLabel = null;
private JTextField jadpath = null;
private JButton jButton1 = null;
private JLabel jLabel2 = null;
private JTextField classpath = null;
private JTextField classdirPath = null;
private JLabel jLabel3 = null;
private JButton jButton2 = null;
private JButton jButton5 = null;
private JPanel jPanel1 = null;
private JRadioButton jRadioButton2 = null;
private JRadioButton jRadioButton3 = null;
private JTextField jTextField = null;
private final String COMMOND="cmd.exe /c start"; // @jve:decl-index=0:
private final String PARAMETER=" -r -o -sjava -d";
// @jve:decl-index=0:
/**
* This method initializes jButton3
*
* @return javax.swing.JButton
*/
private JButton getJButton3() {
if (jButton3 == null) {
jButton3 = new JButton();
jButton3.setBounds(new Rectangle(104, 322, 82, 18));
jButton3.setFont(new Font("Dialog", Font.PLAIN, 12));
jButton3.setText("开始编译");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
String path_jad = jadpath.getText();
if(path_jad.equals("")){
JOptionPane.showMessageDialog(jad_gui.this,"请输入编译程序所在路径!");
return;
}
String dir_jad = path_jad.substring(0, path_jad
.lastIndexOf(File.separator));
String classFile=classpath.getText();
String defaultDir="";
if (jRadioButton.isSelected()) {
if(jRadioButton2.isSelected())
defaultDir="src";
else if(jRadioButton3.isSelected()){
if(!jTextField.getText().equals(""))
defaultDir=jTextField.getText();
else
JOptionPane.showMessageDialog(jad_gui.this,"请输入目录名称!");
}
runBatFile(COMMOND+" "+path_jad+PARAMETER+dir_jad+"\\"+defaultDir+" "+classFile);
JOptionPane.showMessageDialog(jad_gui.this,"编译成功,请到:<"+dir_jad+">下查阅.");
}
if (jRadioButton1.isSelected()) {
if(jRadioButton2.isSelected())
defaultDir="src";
else if(jRadioButton3.isSelected()){
if(!jTextField.getText().equals(""))
defaultDir=jTextField.getText();
else
JOptionPane.showMessageDialog(jad_gui.this,"请输入目录名称!");
}
String classdir=classdirPath.getText();
runBatFile(COMMOND+" "+path_jad+PARAMETER+dir_jad+"\\"+defaultDir+" "+classdir+"\\**\\*.class");
JOptionPane.showMessageDialog(jad_gui.this,"编译成功,请到:<"+dir_jad+">下查阅.");
}
}
});
}
return jButton3;
}
/**
* This method initializes jButton4
*
* @return javax.swing.JButton
*/
private JButton getJButton4() {
if (jButton4 == null) {
jButton4 = new JButton();
jButton4.setFont(new Font("Dialog", Font.PLAIN, 12));
jButton4.setLocation(new Point(298, 322));
jButton4.setSize(new Dimension(82, 18));
jButton4.setText("关闭");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
jad_gui.this.dispose();
}
});
}
return jButton4;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel3 = new JLabel();
jLabel3.setBounds(new Rectangle(16, 82, 90, 18));
jLabel3.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel3.setText("class文件目录:");
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(17, 54, 90, 18));
jLabel2.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel2.setText("class文件路径:");
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setBounds(new Rectangle(10, 135, 458, 115));
jPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory
.createBevelBorder(BevelBorder.LOWERED),
"\u9009\u62e9\u7f16\u8bd1\u65b9\u5f0f",
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, new Font("Dialog",
Font.PLAIN, 12), SystemColor.infoText));
jPanel.add(getJRadioButton(), null);
jPanel.add(getJRadioButton1(), null);
jPanel.add(jLabel2, null);
jPanel.add(getClasspath(), null);
jPanel.add(getClassdirPath(), null);
jPanel.add(jLabel3, null);
jPanel.add(getJButton2(), null);
jPanel.add(getJButton5(), null);
}
return jPanel;
}
/**
* This method initializes jRadioButton
*
* @return javax.swing.JRadioButton
*/
private JRadioButton getJRadioButton() {
if (jRadioButton == null) {
jRadioButton = new JRadioButton();
jRadioButton.setBounds(new Rectangle(13, 23, 109, 26));
jRadioButton.setFont(new Font("Dialog", Font.PLAIN, 12));
jRadioButton.setText("反编译单个文件");
jRadioButton.setSelected(true);
jRadioButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
classpath.setEditable(true);
jButton2.setEnabled(true);
classdirPath.setEditable(false);
}
});
buttons.add(jRadioButton);
}
return jRadioButton;
}
/**
* This method initializes jRadioButton1
*
* @return javax.swing.JRadioButton
*/
private JRadioButton getJRadioButton1() {
if (jRadioButton1 == null) {
jRadioButton1 = new JRadioButton();
jRadioButton1.setBounds(new Rectangle(143, 23, 133, 26));
jRadioButton1.setFont(new Font("Dialog", Font.PLAIN, 12));
jRadioButton1.setActionCommand("反编译目录文件");
jRadioButton1.setText("反编译目录文件");
jRadioButton1
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
classpath.setEditable(false);
jButton2.setEnabled(false);
classdirPath.setEditable(true);
// actionPerformed()
}
});
buttons.add(jRadioButton1);
}
return jRadioButton1;
}
/**
* This method initializes jadpath
*
* @return javax.swing.JTextField
*/
private JTextField getJadpath() {
if (jadpath == null) {
jadpath = new JTextField();
jadpath.setBounds(new Rectangle(150, 107, 202, 18));
}
return jadpath;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
private JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setBounds(new Rectangle(357, 107, 73, 18));
jButton1.setFont(new Font("Dialog", Font.PLAIN, 12));
jButton1.setText("浏览...");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
openFile("exe");
System.out.println("actionPerformed()"); // TODO
// Auto-generated
// Event stub
// actionPerformed()
}
});
}
return jButton1;
}
/**
* This method initializes classpath
*
* @return javax.swing.JTextField
*/
private JTextField getClasspath() {
if (classpath == null) {
classpath = new JTextField();
classpath.setBounds(new Rectangle(118, 54, 232, 18));
}
return classpath;
}
/**
* This method initializes classdirPath
*
* @return javax.swing.JTextField
*/
private JTextField getClassdirPath() {
if (classdirPath == null) {
classdirPath = new JTextField();
classdirPath.setBounds(new Rectangle(117, 82, 232, 18));
if(jRadioButton.isSelected()){
classdirPath.setEditable(false);
}else if(jRadioButton1.isSelected()){
classdirPath.setEditable(true);
}
}
return classdirPath;
}
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -