| 19 | import javax.swing.JTextArea; |
| 20 | |
| 21 | public class Windows{ |
| 22 | |
| 23 | public static void Windows(String code) { |
| 24 | JFrame windows = new JFrame(); |
| 25 | windows.setVisible(true); |
| 26 | windows.setTitle("Copy2Java - Code By CoolCat"); |
| 27 | //windows.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
| 28 | windows.setBounds(100, 100, 450, 300); |
| 29 | JPanel contentPane = new JPanel(); |
| 30 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
| 31 | windows.setResizable(false); |
| 32 | windows.setContentPane(contentPane); |
| 33 | contentPane.setLayout(null); |
| 34 | |
| 35 | JLabel proxtlabel = new JLabel("Proxy:"); |
| 36 | proxtlabel.setBounds(10, 236, 48, 25); |
| 37 | contentPane.add(proxtlabel); |
| 38 | |
| 39 | JTextField proxy = new JTextField(); |
| 40 | proxy.setText("127.0.0.1:8080"); |
| 41 | proxy.setBounds(59, 233, 139, 28); |
| 42 | contentPane.add(proxy); |
| 43 | proxy.setColumns(10); |
| 44 | |
| 45 | final JCheckBox setproxy = new JCheckBox("set"); |
| 46 | setproxy.setBounds(204, 232, 48, 29); |
| 47 | contentPane.add(setproxy); |
| 48 | |
| 49 | JButton toclip = new JButton("Copy to clipboard"); |
| 50 | |
| 51 | toclip.setBounds(258, 232, 164, 29); |
| 52 | toclip.setVisible(true); |
| 53 | contentPane.add(toclip); |
| 54 | |
| 55 | //代码面板 |
| 56 | final JTextArea textArea = new JTextArea(); |
| 57 | //textArea.setLineWrap(true); |
| 58 | |
| 59 | JScrollPane scrollPane = new JScrollPane(textArea); |
| 60 | scrollPane.setBounds(0, 0, 434, 226); |
| 61 | contentPane.add(scrollPane); |
| 62 | |
| 63 | textArea.setText(code); |
| 64 | |
| 65 | setproxy.addChangeListener(new ChangeListener() { |
| 66 | public void stateChanged(ChangeEvent e) { |
| 67 | //System.out.println(setproxy.isSelected()); |
| 68 | String[] proxyStr = proxy.getText().split(":"); |
| 69 | |
| 70 | if(setproxy.isSelected()) { |
| 71 | String code = textArea.getText().toString().replace("setProxy(false)", "setProxy(true)"); |
| 72 | code = code.replace("127.0.0.1",proxyStr[0]).replace("8080",proxyStr[1]); |
| 73 | textArea.setText(code); |
| 74 | }else { |
| 75 | String code = textArea.getText().toString().replace("setProxy(true)", "setProxy(false)"); |
| 76 | textArea.setText(code); |
| 77 | } |
| 78 | } |
nothing calls this directly
no outgoing calls
no test coverage detected