Skip to content

Commit 1ef68b0

Browse files
committed
Improve about window
Improve window sizes
1 parent c44e456 commit 1ef68b0

File tree

4 files changed

+33
-69
lines changed

4 files changed

+33
-69
lines changed

src/main/java/the/bytecode/club/jda/InitialBootScreen.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package the.bytecode.club.jda;
22

3+
import org.apache.commons.io.IOUtils;
4+
35
import javax.swing.*;
46
import javax.swing.text.html.HTMLEditorKit;
57
import java.awt.*;
@@ -52,8 +54,8 @@ else if (i >= 440)
5254

5355
JEditorPane editorPane = new JEditorPane();
5456
editorPane.setEditorKit(new HTMLEditorKit());
55-
56-
editorPane.setText(convertStreamToString(InitialBootScreen.class.getResourceAsStream("/intro.html")));
57+
editorPane.setEditable(false);
58+
editorPane.setText(IOUtils.toString(Resources.class.getResourceAsStream("/intro.html"), "UTF-8"));
5759

5860
scrollPane.setViewportView(editorPane);
5961

@@ -65,15 +67,6 @@ else if (i >= 440)
6567
this.setLocationRelativeTo(null);
6668
}
6769

68-
static String convertStreamToString(java.io.InputStream is) throws IOException
69-
{
70-
@SuppressWarnings("resource") java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
71-
String string = s.hasNext() ? s.next() : "";
72-
is.close();
73-
s.close();
74-
return string;
75-
}
76-
7770
public JProgressBar getProgressBar()
7871
{
7972
return progressBar;
Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package the.bytecode.club.jda.gui;
22

3-
import the.bytecode.club.jda.JDA;
3+
import org.apache.commons.io.IOUtils;
44
import the.bytecode.club.jda.Resources;
5-
import the.bytecode.club.jda.Settings;
65

76
import javax.swing.*;
7+
import javax.swing.text.html.HTMLEditorKit;
88
import java.awt.*;
9+
import java.io.IOException;
910

1011
/**
1112
* The about frame.
@@ -15,62 +16,41 @@
1516
public class AboutWindow extends JFrame
1617
{
1718
private static final long serialVersionUID = -8230501978224923296L;
18-
private JTextArea textArea = new JTextArea();
19+
private JEditorPane editorPane;
1920

2021
public AboutWindow()
2122
{
2223
this.setIconImages(Resources.iconList);
23-
setSize(Toolkit.getDefaultToolkit().getScreenSize());
24+
setSize(new Dimension(800, 800));
2425
setType(Type.UTILITY);
2526
setTitle("Java DisAssembler - About - https://the.bytecode.club");
2627
getContentPane().setLayout(new CardLayout(0, 0));
27-
JScrollPane scrollPane = new JScrollPane();
28-
getContentPane().add(scrollPane, "name_322439757638784");
29-
textArea.setWrapStyleWord(true);
30-
textArea.setEnabled(false);
31-
textArea.setDisabledTextColor(Color.BLACK);
32-
scrollPane.setViewportView(textArea);
3328
this.setResizable(false);
3429
this.setLocationRelativeTo(null);
30+
31+
JScrollPane scrollPane = new JScrollPane();
32+
scrollPane.setHorizontalScrollBar(null);
33+
34+
getContentPane().add(scrollPane, "name_322439757638784");
35+
editorPane = new JEditorPane();
36+
editorPane.setEditorKit(new HTMLEditorKit());
37+
editorPane.setContentType("text/html");
38+
editorPane.setEditable(false);
39+
try
40+
{
41+
editorPane.setText(IOUtils.toString(Resources.class.getResourceAsStream("/intro.html"), "UTF-8"));
42+
}
43+
catch (IOException e)
44+
{
45+
System.err.println("Couldn't load about html:");
46+
e.printStackTrace();
47+
}
48+
scrollPane.setViewportView(editorPane);
3549
}
3650

3751
@Override
3852
public void setVisible(boolean b)
3953
{
4054
super.setVisible(b);
41-
textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int) JDA.viewer.fontSpinner.getValue()));
42-
textArea.setText("Java DisAssembler " + JDA.version + " is a fork of Bytecode Viewer." + JDA.nl +
43-
JDA.nl +
44-
"Settings:" + JDA.nl +
45-
" Preview Copy: " + JDA.previewCopy + JDA.nl +
46-
" Java: " + Settings.JAVA_LOCATION.get() + JDA.nl +
47-
" JDA Dir: " + JDA.getJDADirectory() + JDA.nl +
48-
" Optional Lib: " + Settings.PATH.get() + JDA.nl +
49-
"Command Line Input:" + JDA.nl +
50-
" -help Displays the help menu" + JDA.nl +
51-
" -list Displays the available decompilers" + JDA.nl +
52-
" -decompiler <decompiler> Selects the decompiler, procyon by default" + JDA.nl +
53-
" -i <input file> Selects the input file (Jar, Class, ZIP, all work automatically)" + JDA.nl +
54-
" -o <output file> Selects the output file (Java or Java-Bytecode)" + JDA.nl +
55-
" -t <target classname> Must either be the fully qualified classname or \"all\" to decompile all as zip" + JDA.nl +
56-
" -nowait Doesn't wait for the user to read the CLI messages" + JDA.nl + JDA.nl +
57-
"Keybinds:" + JDA.nl +
58-
" CTRL + O: Open/add new jar/class/apk" + JDA.nl +
59-
" CTLR + N: Reset the workspace" + JDA.nl +
60-
" CTRL + W: Closes the currently opened tab" + JDA.nl +
61-
" CTRL + S: Save classes as zip" + JDA.nl +
62-
" CTRL + R: Run (EZ-Inject) - dynamically load the classes and invoke a main class" + JDA.nl +
63-
JDA.nl +
64-
"Code from various projects has been used, including but not limited to:" + JDA.nl +
65-
" J-RET by WaterWolf" + JDA.nl +
66-
" RSyntaxPane by Robert Futrell" + JDA.nl +
67-
" Commons IO by Apache" + JDA.nl +
68-
" ASM by OW2" + JDA.nl +
69-
" FernFlower by Stiver" + JDA.nl +
70-
" Procyon by Mstrobel" + JDA.nl +
71-
" CFR by Lee Benfield" + JDA.nl +
72-
" CFIDE by Bibl" + JDA.nl +
73-
JDA.nl +
74-
"If you're interested in Java Reverse Engineering, join The Bytecode Club - https://the.bytecode.club");
7555
}
7656
}

src/main/java/the/bytecode/club/jda/gui/MainViewerGUI.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,10 @@ else if ((oldState & Frame.MAXIMIZED_BOTH) != 0 && (newState & Frame.MAXIMIZED_B
302302

303303
menuBar.add(spinnerMenu);
304304

305-
setSize(new Dimension(800, 400));
305+
// TODO: save window location and maximized/not maximized
306+
Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
307+
setSize(new Dimension(size.width * 3 / 4, size.height * 2 / 3));
308+
306309
if (JDA.previewCopy)
307310
setTitle("Java DisAssembler " + JDA.version + " Preview - https://the.bytecode.club");
308311
else

src/main/resources/intro.html

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<html>
2-
<body style="width:800px; font-family: Helvetica Neue, Helvetica, Arial;">
2+
<body style="width:800px; font-family: Arial, sans-serif;">
33
<p>
44
<b>Java DisAssembler (JDA)</b> is a fork of Bytecode Viewer (BCV) that adds advanced code analysis features. The
55
basic principles of BCV are maintained; however, many aspects are different.
@@ -33,18 +33,6 @@ <h2>Keyboard Short-cuts:</h2>
3333
<li>Close Current Tab (Ctrl + W)</li>
3434
</ul>
3535

36-
<h2>Built-in Plugins:</h2>
37-
<ul>
38-
<li>Open Plugin - Open a .java plugin created for BCV.</li>
39-
<li>Recent Plugins - Last 25 plugins you've opened with BCV.</li>
40-
<li>Malicious Code Scanner - Allows you to define what to search for, and outputs what it found.</li>
41-
<li>Show Main Methods - Detects and outputs all of the public static void main(String[]) functions.</li>
42-
<li>Show All Strings - Grabs then outputs all of the strings in every classfile.</li>
43-
<li>Replace Strings - Allows you to do a simple permanent .replace on the classfile strings, very useful for URL
44-
swapping.
45-
</li>
46-
</ul>
47-
4836
<h2>Misc. Notes:</h2>
4937
<ul>
5038
<li>BCV and JDA were created out of love for Java Reverse engineering.</li>

0 commit comments

Comments
 (0)