MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / createPanel

Method createPanel

src/main/java/core/packetproxy/gui/GUIData.java:74–411  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72 }
73
74 public JComponent createPanel() throws Exception {
75 main_panel = new JPanel();
76 main_panel.setLayout(new BoxLayout(main_panel, BoxLayout.Y_AXIS));
77
78 tabs = new TabSet(true, false);
79
80 main_panel.add(tabs.getTabPanel());
81
82 copy_url_body_button = new JButton("copy Method+URL+Body");
83 copy_url_body_button.addActionListener(new ActionListener() {
84
85 @Override
86 public void actionPerformed(ActionEvent actionEvent) {
87 try {
88
89 int id = GUIHistory.getInstance().getSelectedPacketId();
90 Packet packet = Packets.getInstance().query(id);
91 Http http = Http.create(tabs.getRaw().getData());
92 String copyData = http.getMethod() + "\t" + http.getURL(packet.getServerPort(), packet.getUseSSL())
93 + "\t" + new String(http.getBody(), "UTF-8");
94 Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
95 StringSelection selection = new StringSelection(copyData);
96 clipboard.setContents(selection, selection);
97 } catch (Exception e1) {
98
99 errWithStackTrace(e1);
100 }
101 }
102 });
103
104 copy_body_button = new JButton("copy Body");
105 copy_body_button.addActionListener(new ActionListener() {
106
107 @Override
108 public void actionPerformed(ActionEvent e) {
109 try {
110
111 int id = GUIHistory.getInstance().getSelectedPacketId();
112 Packet packet = Packets.getInstance().query(id);
113 Http http = Http.create(tabs.getRaw().getData());
114 String body = new String(http.getBody(), "UTF-8");// http.getURL(packet.getServerPort());
115 Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
116 StringSelection selection = new StringSelection(body);
117 clipboard.setContents(selection, selection);
118 } catch (Exception e1) {
119
120 errWithStackTrace(e1);
121 }
122 }
123 });
124 copy_body_button.setAlignmentX(0.5f);
125
126 copy_url_button = new JButton("copy URL");
127 copy_url_button.addActionListener(new ActionListener() {
128
129 @Override
130 public void actionPerformed(ActionEvent e) {
131 try {

Callers

nothing calls this directly

Calls 5

getTabPanelMethod · 0.80
addActionListenerMethod · 0.80
addMethod · 0.45
getInstanceMethod · 0.45

Tested by

no test coverage detected