|
| 1 | +package U2C; |
| 2 | + |
| 3 | +import java.awt.EventQueue; |
| 4 | +import java.awt.FlowLayout; |
| 5 | +import java.awt.Font; |
| 6 | +import java.awt.event.MouseAdapter; |
| 7 | +import java.awt.event.MouseEvent; |
| 8 | +import java.net.URI; |
| 9 | +import javax.swing.JFrame; |
| 10 | +import javax.swing.JPanel; |
| 11 | +import java.awt.BorderLayout; |
| 12 | +import java.awt.Color; |
| 13 | +import java.awt.Desktop; |
| 14 | + |
| 15 | +import javax.swing.JCheckBox; |
| 16 | +import javax.swing.JLabel; |
| 17 | +import javax.swing.border.LineBorder; |
| 18 | +import java.awt.Label; |
| 19 | +import java.awt.GridBagLayout; |
| 20 | +import java.awt.GridBagConstraints; |
| 21 | +import java.awt.Insets; |
| 22 | + |
| 23 | +public class GUI { |
| 24 | + |
| 25 | + public JFrame frame; |
| 26 | + public String ExtenderName = "U2C v0.1 by bit4"; |
| 27 | + public String github = "https://github.com/bit4woo/U2C"; |
| 28 | + public JLabel lblNewLabel_1; |
| 29 | + public JCheckBox chckbx_proxy; |
| 30 | + public JCheckBox chckbx_repeater; |
| 31 | + public JCheckBox chckbx_intruder; |
| 32 | + private JPanel content_panel; |
| 33 | + private JCheckBox chckbx_display; |
| 34 | + |
| 35 | + /** |
| 36 | + * Launch the application. |
| 37 | + */ |
| 38 | + public static void main(String[] args) { |
| 39 | + EventQueue.invokeLater(new Runnable() { |
| 40 | + public void run() { |
| 41 | + try { |
| 42 | + GUI window = new GUI(); |
| 43 | + window.frame.setVisible(true); |
| 44 | + } catch (Exception e) { |
| 45 | + e.printStackTrace(); |
| 46 | + } |
| 47 | + } |
| 48 | + }); |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * Create the application. |
| 53 | + */ |
| 54 | + public GUI() { |
| 55 | + initialize(); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Initialize the contents of the frame. |
| 60 | + */ |
| 61 | + private void initialize() { |
| 62 | + frame = new JFrame(); |
| 63 | + frame.setBounds(100, 100, 450, 300); |
| 64 | + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
| 65 | + |
| 66 | + |
| 67 | + content_panel = new JPanel(); |
| 68 | + content_panel.setBorder(new LineBorder(new Color(0, 0, 0))); |
| 69 | + content_panel.setLayout(new BorderLayout(0, 0)); |
| 70 | + |
| 71 | + frame.getContentPane().add(content_panel, BorderLayout.CENTER); |
| 72 | + |
| 73 | + JPanel panel = new JPanel(); |
| 74 | + content_panel.add(panel, BorderLayout.NORTH); |
| 75 | + FlowLayout fl_panel = (FlowLayout) panel.getLayout(); |
| 76 | + fl_panel.setAlignment(FlowLayout.LEFT); |
| 77 | + panel.setBorder(new LineBorder(new Color(0, 0, 0))); |
| 78 | + |
| 79 | + JLabel lblNewLabel = new JLabel("Enable for : "); |
| 80 | + panel.add(lblNewLabel); |
| 81 | + |
| 82 | + chckbx_proxy = new JCheckBox("Proxy"); |
| 83 | + chckbx_proxy.setSelected(true); |
| 84 | + panel.add(chckbx_proxy); |
| 85 | + |
| 86 | + chckbx_repeater = new JCheckBox("Repeater"); |
| 87 | + panel.add(chckbx_repeater); |
| 88 | + |
| 89 | + chckbx_intruder = new JCheckBox("Intruder"); |
| 90 | + panel.add(chckbx_intruder); |
| 91 | + |
| 92 | + JLabel lblNewLabel_display = new JLabel("|"); |
| 93 | + panel.add(lblNewLabel_display); |
| 94 | + |
| 95 | + chckbx_display = new JCheckBox("Only Display Converted Body"); |
| 96 | + panel.add(chckbx_display); |
| 97 | + |
| 98 | + JPanel panel_1 = new JPanel(); |
| 99 | + content_panel.add(panel_1, BorderLayout.SOUTH); |
| 100 | + panel_1.setBorder(new LineBorder(new Color(0, 0, 0))); |
| 101 | + FlowLayout flowLayout = (FlowLayout) panel_1.getLayout(); |
| 102 | + flowLayout.setAlignment(FlowLayout.LEFT); |
| 103 | + |
| 104 | + |
| 105 | + lblNewLabel_1 = new JLabel(" "+github); |
| 106 | + lblNewLabel_1.setFont(new Font("", Font.BOLD, 12)); |
| 107 | + lblNewLabel_1.addMouseListener(new MouseAdapter() { |
| 108 | + @Override |
| 109 | + public void mouseClicked(MouseEvent e) { |
| 110 | + try { |
| 111 | + URI uri = new URI(github); |
| 112 | + Desktop desktop = Desktop.getDesktop(); |
| 113 | + if(Desktop.isDesktopSupported()&&desktop.isSupported(Desktop.Action.BROWSE)){ |
| 114 | + desktop.browse(uri); |
| 115 | + } |
| 116 | + } catch (Exception e2) { |
| 117 | + // TODO: handle exception |
| 118 | + //callbacks.printError(e2.getMessage()); |
| 119 | + } |
| 120 | + |
| 121 | + } |
| 122 | + @Override |
| 123 | + public void mouseEntered(MouseEvent e) { |
| 124 | + lblNewLabel_1.setForeground(Color.BLUE); |
| 125 | + } |
| 126 | + @Override |
| 127 | + public void mouseExited(MouseEvent e) { |
| 128 | + lblNewLabel_1.setForeground(Color.BLACK); |
| 129 | + } |
| 130 | + }); |
| 131 | + panel_1.add(lblNewLabel_1); |
| 132 | + |
| 133 | + JPanel panel_2 = new JPanel(); |
| 134 | + content_panel.add(panel_2, BorderLayout.CENTER); |
| 135 | + GridBagLayout gbl_panel_2 = new GridBagLayout(); |
| 136 | + gbl_panel_2.columnWidths = new int[]{660, 0}; |
| 137 | + gbl_panel_2.rowHeights = new int[]{23, 23, 15, 0}; |
| 138 | + gbl_panel_2.columnWeights = new double[]{0.0, Double.MIN_VALUE}; |
| 139 | + gbl_panel_2.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE}; |
| 140 | + panel_2.setLayout(gbl_panel_2); |
| 141 | + |
| 142 | + Label label = new Label("To display chinese correctly, you should do the following config: "); |
| 143 | + label.setFont(new Font("Dialog", Font.PLAIN, 14)); |
| 144 | + GridBagConstraints gbc_label = new GridBagConstraints(); |
| 145 | + gbc_label.anchor = GridBagConstraints.NORTHWEST; |
| 146 | + gbc_label.insets = new Insets(0, 0, 5, 0); |
| 147 | + gbc_label.gridx = 0; |
| 148 | + gbc_label.gridy = 0; |
| 149 | + panel_2.add(label, gbc_label); |
| 150 | + Label label1 = new Label("User options-->Display-->HTTP Message Display-->Change font, select a font that support chinese,eg:Microsoft Yahei."); |
| 151 | + label1.setFont(new Font("Dialog", Font.PLAIN, 14)); |
| 152 | + GridBagConstraints gbc_label1 = new GridBagConstraints(); |
| 153 | + gbc_label1.anchor = GridBagConstraints.NORTHWEST; |
| 154 | + gbc_label1.insets = new Insets(0, 0, 5, 0); |
| 155 | + gbc_label1.gridx = 0; |
| 156 | + gbc_label1.gridy = 1; |
| 157 | + panel_2.add(label1, gbc_label1); |
| 158 | + |
| 159 | + JLabel lbllike = new JLabel("if you like this extender, Please give me a star on github. thanks! any issue or suggestion also appreciated!"); |
| 160 | + lbllike.setFont(new Font("Dialog", Font.PLAIN, 14)); |
| 161 | + GridBagConstraints gbc_lbllike = new GridBagConstraints(); |
| 162 | + gbc_lbllike.anchor = GridBagConstraints.NORTHWEST; |
| 163 | + gbc_lbllike.gridx = 0; |
| 164 | + gbc_lbllike.gridy = 2; |
| 165 | + panel_2.add(lbllike, gbc_lbllike); |
| 166 | + } |
| 167 | + |
| 168 | +} |
0 commit comments