Skip to content

Commit 8367202

Browse files
committed
Finish base for GUI
1 parent dd14319 commit 8367202

File tree

1 file changed

+190
-15
lines changed

1 file changed

+190
-15
lines changed

src/java/com/javadeobfuscator/deobfuscator/ui/SwingWindow.java

Lines changed: 190 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public static void main(String[] args)
4747
gbc_IPanel.fill = GridBagConstraints.HORIZONTAL;
4848
gbc_IPanel.anchor = GridBagConstraints.FIRST_LINE_START;
4949
gbc_IPanel.insets = new Insets(15, 10, 0, 10);
50+
gbc_IPanel.gridwidth = 2;
5051
gbc_IPanel.weightx = 1;
5152
JPanel inputPnl = new JPanel();
5253
inputPnl.setBorder(new TitledBorder("Deobfuscator Input"));
@@ -68,7 +69,8 @@ public static void main(String[] args)
6869
gbc_Text.gridy = gridy;
6970
gbc_Text.weightx = 1;
7071
gbc_Text.fill = GridBagConstraints.HORIZONTAL;
71-
inputPnl.add(new JTextField(), gbc_Text);
72+
JTextField textField = new JTextField();
73+
inputPnl.add(textField, gbc_Text);
7274
GridBagConstraints gbc_Select = new GridBagConstraints();
7375
gbc_Select.insets = new Insets(5, 7, 2, 2);
7476
gbc_Select.gridx = 2;
@@ -84,14 +86,16 @@ public static void main(String[] args)
8486
gbc_box.insets = new Insets(5, 2, 2, 2);
8587
gbc_box.gridx = 0;
8688
gbc_box.gridy = gridy;
87-
inputPnl.add(new JCheckBox(gridy == 2 ? "Verify" : "Detect"), gbc_box);
89+
JCheckBox checkBox = new JCheckBox(gridy == 2 ? "Verify" : "Detect");
90+
inputPnl.add(checkBox, gbc_box);
8891
}
8992

9093
//Other Options
9194
GridBagConstraints gbc_OPanel = new GridBagConstraints();
9295
gbc_OPanel.fill = GridBagConstraints.BOTH;
9396
gbc_OPanel.anchor = GridBagConstraints.NORTHWEST;
9497
gbc_OPanel.insets = new Insets(15, 10, 20, 10);
98+
gbc_OPanel.gridwidth = 2;
9599
gbc_OPanel.gridy = 1;
96100
gbc_OPanel.weightx = 1;
97101
gbc_OPanel.weighty = 1;
@@ -120,25 +124,16 @@ public static void main(String[] args)
120124
transformerJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
121125
transformerJList.setModel(transformerList);
122126
transformerListScroll.setViewportView(transformerJList);
123-
124127
GridBagConstraints gbc_TransformerList = new GridBagConstraints();
128+
gbc_TransformerList.gridx = 0;
129+
gbc_TransformerList.gridy = 0;
130+
gbc_TransformerList.gridheight = 4;
125131
gbc_TransformerList.anchor = GridBagConstraints.FIRST_LINE_START;
126132
gbc_TransformerList.fill = GridBagConstraints.BOTH;
127133
gbc_TransformerList.insets = new Insets(20, 20, 20, 10);
128134
gbc_TransformerList.weightx = 0.5;
129135
gbc_TransformerList.weighty = 1;
130136
transformersPanel.add(transformerListScroll, gbc_TransformerList);
131-
//Buttons
132-
JButton add = new JButton(">");
133-
GridBagConstraints gbc_add = new GridBagConstraints();
134-
gbc_add.gridx = 1;
135-
gbc_add.ipadx = 10;
136-
transformersPanel.add(add, gbc_add);
137-
JButton remove = new JButton("<");
138-
GridBagConstraints gbc_remove = new GridBagConstraints();
139-
gbc_remove.gridx = 1;
140-
gbc_remove.ipadx = 10;
141-
transformersPanel.add(remove, gbc_remove);
142137
//Second list (selected)
143138
JScrollPane transformerSelectedScroll = new JScrollPane();
144139
DefaultListModel<String> transformerSelected = new DefaultListModel<>();
@@ -147,15 +142,195 @@ public static void main(String[] args)
147142
selectedJList.setModel(transformerSelected);
148143
transformerSelectedScroll.setViewportView(selectedJList);
149144
GridBagConstraints gbc_TransformerSelected = new GridBagConstraints();
145+
gbc_TransformerSelected.gridy = 0;
146+
gbc_TransformerSelected.gridx = 2;
147+
gbc_TransformerSelected.gridheight = 4;
150148
gbc_TransformerSelected.anchor = GridBagConstraints.LAST_LINE_START;
151149
gbc_TransformerSelected.fill = GridBagConstraints.BOTH;
152150
gbc_TransformerSelected.insets = new Insets(20, 10, 20, 20);
153-
gbc_TransformerSelected.gridx = 2;
154151
gbc_TransformerSelected.weightx = 0.5;
155152
gbc_TransformerSelected.weighty = 1;
156153
transformersPanel.add(transformerSelectedScroll, gbc_TransformerSelected);
154+
//Buttons
155+
//4 panels to position buttons correctly
156+
JPanel panel1 = new JPanel();
157+
GridBagConstraints gbc_panel1 = new GridBagConstraints();
158+
gbc_panel1.gridx = 1;
159+
gbc_panel1.weighty = 0.5;
160+
transformersPanel.add(panel1, gbc_panel1);
161+
JPanel panel2 = new JPanel();
162+
panel2.setLayout(new GridBagLayout());
163+
GridBagConstraints gbc_panel2 = new GridBagConstraints();
164+
gbc_panel2.gridx = 1;
165+
gbc_panel2.weighty = 0.5;
166+
transformersPanel.add(panel2, gbc_panel2);
167+
JPanel panel3 = new JPanel();
168+
panel3.setLayout(new GridBagLayout());
169+
GridBagConstraints gbc_panel3 = new GridBagConstraints();
170+
gbc_panel3.gridx = 1;
171+
gbc_panel3.weighty = 0.5;
172+
transformersPanel.add(panel3, gbc_panel3);
173+
JPanel panel4 = new JPanel();
174+
GridBagConstraints gbc_panel4 = new GridBagConstraints();
175+
gbc_panel4.gridx = 1;
176+
gbc_panel4.weighty = 0.5;
177+
transformersPanel.add(panel4, gbc_panel4);
178+
JButton add = new JButton(">");
179+
GridBagConstraints gbc_add = new GridBagConstraints();
180+
gbc_add.anchor = GridBagConstraints.CENTER;
181+
gbc_add.insets = new Insets(5, 5, 5, 5);
182+
gbc_add.ipadx = 10;
183+
panel2.add(add, gbc_add);
184+
JButton remove = new JButton("<");
185+
GridBagConstraints gbc_remove = new GridBagConstraints();
186+
gbc_remove.anchor = GridBagConstraints.CENTER;
187+
gbc_remove.insets = new Insets(5, 5, 5, 5);
188+
gbc_remove.ipadx = 10;
189+
panel3.add(remove, gbc_remove);
157190
tabbedPane.addTab("Transformers", transformersPanel);
158191

192+
//TODO: FILE LIST
193+
JPanel libPanel = new JPanel();
194+
libPanel.setLayout(new GridBagLayout());
195+
JScrollPane libListScroll = new JScrollPane();
196+
DefaultListModel<String> librariesList = new DefaultListModel<>();
197+
JList<String> libJList = new JList<>(librariesList);
198+
libJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
199+
libJList.setModel(librariesList);
200+
libListScroll.setViewportView(libJList);
201+
GridBagConstraints gbl_libraries = new GridBagConstraints();
202+
gbl_libraries.gridx = 0;
203+
gbl_libraries.gridy = 0;
204+
gbl_libraries.gridheight = 4;
205+
gbl_libraries.anchor = GridBagConstraints.FIRST_LINE_START;
206+
gbl_libraries.fill = GridBagConstraints.BOTH;
207+
gbl_libraries.insets = new Insets(20, 20, 20, 20);
208+
gbl_libraries.weightx = 1;
209+
gbl_libraries.weighty = 1;
210+
libPanel.add(libListScroll, gbl_libraries);
211+
//Buttons
212+
//4 panels to position buttons correctly
213+
JPanel libPanel1 = new JPanel();
214+
GridBagConstraints gbc_libPanel1 = new GridBagConstraints();
215+
gbc_libPanel1.gridx = 1;
216+
gbc_libPanel1.weighty = 0.5;
217+
libPanel.add(libPanel1, gbc_libPanel1);
218+
JPanel libPanel2 = new JPanel();
219+
libPanel2.setLayout(new GridBagLayout());
220+
GridBagConstraints gbc_libPanel2 = new GridBagConstraints();
221+
gbc_libPanel2.gridx = 1;
222+
gbc_libPanel2.weighty = 0.5;
223+
libPanel.add(libPanel2, gbc_libPanel2);
224+
JPanel libPanel3 = new JPanel();
225+
libPanel3.setLayout(new GridBagLayout());
226+
GridBagConstraints gbc_libPanel3 = new GridBagConstraints();
227+
gbc_libPanel3.gridx = 1;
228+
gbc_libPanel3.weighty = 0.5;
229+
libPanel.add(libPanel3, gbc_libPanel3);
230+
JPanel libPanel4 = new JPanel();
231+
GridBagConstraints gbc_libPanel4 = new GridBagConstraints();
232+
gbc_libPanel4.gridx = 1;
233+
gbc_libPanel4.weighty = 0.5;
234+
libPanel.add(libPanel4, gbc_libPanel4);
235+
JButton addLib = new JButton(" Add ");
236+
GridBagConstraints gbc_addLib = new GridBagConstraints();
237+
gbc_addLib.anchor = GridBagConstraints.CENTER;
238+
gbc_addLib.insets = new Insets(5, 5, 5, 20);
239+
libPanel2.add(addLib, gbc_addLib);
240+
JButton removeLib = new JButton("Remove");
241+
GridBagConstraints gbc_removeLib = new GridBagConstraints();
242+
gbc_removeLib.anchor = GridBagConstraints.CENTER;
243+
gbc_removeLib.insets = new Insets(5, 5, 5, 20);
244+
libPanel3.add(removeLib, gbc_removeLib);
245+
tabbedPane.addTab("Libraries", libPanel);
246+
247+
//TODO: String list
248+
JPanel stringPanel = new JPanel();
249+
stringPanel.setLayout(new GridBagLayout());
250+
JScrollPane stringListScroll = new JScrollPane();
251+
DefaultListModel<String> stringList = new DefaultListModel<>();
252+
JList<String> stringJList = new JList<>(stringList);
253+
stringJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
254+
stringJList.setModel(stringList);
255+
stringListScroll.setViewportView(stringJList);
256+
GridBagConstraints gbl_string = new GridBagConstraints();
257+
gbl_string.gridx = 0;
258+
gbl_string.gridy = 0;
259+
gbl_string.gridheight = 4;
260+
gbl_string.anchor = GridBagConstraints.FIRST_LINE_START;
261+
gbl_string.fill = GridBagConstraints.BOTH;
262+
gbl_string.insets = new Insets(0, 20, 0, 20);
263+
gbl_string.weightx = 1;
264+
gbl_string.weighty = 1;
265+
stringPanel.add(stringListScroll, gbl_string);
266+
//Buttons
267+
//4 panels to position buttons correctly
268+
JPanel stringPanel1 = new JPanel();
269+
GridBagConstraints gbc_stringPanel1 = new GridBagConstraints();
270+
gbc_stringPanel1.gridx = 1;
271+
gbc_stringPanel1.weighty = 0.5;
272+
stringPanel.add(stringPanel1, gbc_stringPanel1);
273+
JPanel stringPanel2 = new JPanel();
274+
stringPanel2.setLayout(new GridBagLayout());
275+
GridBagConstraints gbc_stringPanel2 = new GridBagConstraints();
276+
gbc_stringPanel2.gridx = 1;
277+
gbc_stringPanel2.weighty = 0.5;
278+
stringPanel.add(stringPanel2, gbc_stringPanel2);
279+
JPanel stringPanel3 = new JPanel();
280+
stringPanel3.setLayout(new GridBagLayout());
281+
GridBagConstraints gbc_stringPanel3 = new GridBagConstraints();
282+
gbc_stringPanel3.gridx = 1;
283+
gbc_stringPanel3.weighty = 0.5;
284+
stringPanel.add(stringPanel3, gbc_stringPanel3);
285+
JPanel stringPanel4 = new JPanel();
286+
GridBagConstraints gbc_stringPanel4 = new GridBagConstraints();
287+
gbc_stringPanel4.gridx = 1;
288+
gbc_stringPanel4.weighty = 0.5;
289+
stringPanel.add(stringPanel4, gbc_stringPanel4);
290+
JButton addString = new JButton(" Add ");
291+
GridBagConstraints gbc_addString = new GridBagConstraints();
292+
gbc_addString.anchor = GridBagConstraints.CENTER;
293+
gbc_addString.insets = new Insets(5, 5, 5, 20);
294+
stringPanel2.add(addString, gbc_addString);
295+
JButton removeString = new JButton("Remove");
296+
GridBagConstraints gbc_removeString = new GridBagConstraints();
297+
gbc_removeString.anchor = GridBagConstraints.CENTER;
298+
gbc_removeString.insets = new Insets(5, 5, 5, 20);
299+
stringPanel3.add(removeString, gbc_removeString);
300+
//Text pane
301+
JTextField textPane = new JTextField();
302+
GridBagConstraints gbl_text = new GridBagConstraints();
303+
gbl_text.gridx = 0;
304+
gbl_text.gridy = 4;
305+
gbl_text.anchor = GridBagConstraints.FIRST_LINE_START;
306+
gbl_text.fill = GridBagConstraints.HORIZONTAL;
307+
gbl_text.insets = new Insets(0, 20, 20, 20);
308+
gbl_text.weightx = 1;
309+
stringPanel.add(textPane, gbl_text);
310+
tabbedPane.addTab("Ignored Classes", stringPanel);
311+
312+
//Config and Run buttons
313+
GridBagConstraints gbl_loadConfig = new GridBagConstraints();
314+
gbl_loadConfig.gridy = 2;
315+
gbl_loadConfig.anchor = GridBagConstraints.FIRST_LINE_START;
316+
gbl_loadConfig.insets = new Insets(0, 20, 20, 10);
317+
JButton load = new JButton("Load Config");
318+
frame.getContentPane().add(load, gbl_loadConfig);
319+
GridBagConstraints gbl_saveConfig = new GridBagConstraints();
320+
gbl_saveConfig.gridx = 1;
321+
gbl_saveConfig.gridy = 2;
322+
gbl_saveConfig.anchor = GridBagConstraints.FIRST_LINE_START;
323+
gbl_saveConfig.insets = new Insets(0, 10, 20, 20);
324+
JButton save = new JButton("Save Config");
325+
frame.getContentPane().add(save, gbl_saveConfig);
326+
GridBagConstraints gbl_run = new GridBagConstraints();
327+
gbl_run.anchor = GridBagConstraints.FIRST_LINE_END;
328+
gbl_run.gridx = 1;
329+
gbl_run.gridy = 2;
330+
gbl_run.insets = new Insets(0, 10, 20, 20);
331+
JButton run = new JButton("Run");
332+
frame.getContentPane().add(run, gbl_run);
333+
159334
frame.setVisible(true);
160335
}
161336

0 commit comments

Comments
 (0)