1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| public class AddDialog extends JDialog { private String id,ip,time; private JButton button; private JTextField urltext, passtext, xortext; private JTextArea configtext; private JComboBox<String> atype, acode;
public AddDialog() { super(MainFrame.main, "添加SHELL", true); this.setComponent(); this.setEvent(); this.setVisible(true); }
public AddDialog(String s) { super(MainFrame.main, "修改SHELL", true); String[] tmp = s.split("\t"); this.setComponent(); this.setEvent(); this.id = tmp[0]; urltext.setText(tmp[1]); passtext.setText(tmp[2]); configtext.setText(tmp[3]); button.setText("编辑"); atype.setSelectedItem(tmp[4]); acode.setSelectedItem(tmp[5]); this.ip = tmp[6]; this.time = tmp[7]; this.setVisible(true); }
private void setComponent() {
Toolkit t = Toolkit.getDefaultToolkit(); Dimension d = t.getScreenSize(); this.setResizable(false); this.setSize(450, 240); this.setLocation((d.width - this.getWidth()) / 2, (d.height - this.getHeight()) / 2); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); JPanel north = new JPanel(); JPanel center = new JPanel(); JPanel south = new JPanel(); north.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 8)); center.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0)); south.setLayout(new FlowLayout(FlowLayout.RIGHT, 3, 8)); JLabel urllabel = new JLabel("地址:"); urllabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); JLabel configlabel = new JLabel("配置:"); configlabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); JLabel actionlabel = new JLabel(""); actionlabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); urltext = new JTextField("http://"); passtext = new JTextField(); configtext = new JTextArea(); JScrollPane configscroll = new JScrollPane(configtext); button = new JButton("添加"); String[] strtype = new String[] { "脚本类型", "ASP(Eval)", "ASPX(Eval)", "PHP(Eval)", "JSP(Eval)", "Customize" }; String[] strcode = new String[] { "字符编码", "GB2312", "GBK", "UTF-8", "BIG5", "ISO-8859-1" }; atype = new JComboBox<>(strtype); acode = new JComboBox<>(strcode); urltext.setPreferredSize(new Dimension(320,23)); passtext.setPreferredSize(new Dimension(56,23)); configtext.setLineWrap(true); configtext.setPreferredSize(new Dimension(369,128)); configscroll.setBorder(urltext.getBorder());
JLabel xorlabel = new JLabel("XOR:"); xorlabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); xortext = new JTextField(); xortextsetPreferredSize(new Dimension(56,23)); north.add(urllabel); north.add(urltext); north.add(passtext); center.add(configlabel); center.add(configscroll);
south.add(xorlabel); south.add(xortext); south.add(atype); south.add(acode); south.add(button); south.add(actionlabel); this.getContentPane().add(north, BorderLayout.NORTH); this.getContentPane().add(center, BorderLayout.CENTER); this.getContentPane().add(south, BorderLayout.SOUTH); this.getRootPane().setDefaultButton(button); }
.... }
|