Skip to content

Commit ddb360c

Browse files
committed
feat: more gui stuff
1 parent 8a27407 commit ddb360c

5 files changed

Lines changed: 152 additions & 55 deletions

File tree

dev.skidfuscator.client.standalone/src/main/java/dev/skidfuscator/obfuscator/gui/ConfigPanel.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import java.io.File;
1616
import java.awt.event.WindowAdapter;
1717
import java.awt.event.WindowEvent;
18+
import javax.swing.border.BevelBorder;
19+
import javax.swing.border.EtchedBorder;
1820
import javax.swing.event.DocumentEvent;
1921
import javax.swing.event.DocumentListener;
2022

@@ -28,6 +30,20 @@ public class ConfigPanel extends JPanel {
2830

2931
public ConfigPanel() {
3032
setLayout(new GridBagLayout());
33+
34+
// Create compound border with titled border and empty border for padding
35+
setBorder(BorderFactory.createCompoundBorder(
36+
// Outer titled border
37+
BorderFactory.createTitledBorder(
38+
BorderFactory.createEtchedBorder(EtchedBorder.RAISED), // Rounded line border with increased arc
39+
"Configuration",
40+
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
41+
javax.swing.border.TitledBorder.DEFAULT_POSITION,
42+
new Font("Segoe UI", Font.BOLD, 16)
43+
),
44+
// Inner empty border for padding
45+
BorderFactory.createEmptyBorder(20, 0, 10, 0)
46+
));
3147

3248
// Load configuration
3349
config = SkidfuscatorConfig.load();

dev.skidfuscator.client.standalone/src/main/java/dev/skidfuscator/obfuscator/gui/ConsolePanel.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import dev.skidfuscator.obfuscator.gui.ansi.UnicodeBoxChars;
55

66
import javax.swing.*;
7+
import javax.swing.border.EtchedBorder;
78
import javax.swing.text.*;
89
import java.awt.*;
910
import java.io.ByteArrayOutputStream;
@@ -34,7 +35,18 @@ public class ConsolePanel extends JPanel {
3435

3536
public ConsolePanel() {
3637
setLayout(new BorderLayout());
37-
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
38+
setBorder(BorderFactory.createCompoundBorder(
39+
// Outer titled border
40+
BorderFactory.createTitledBorder(
41+
BorderFactory.createEtchedBorder(EtchedBorder.RAISED), // Rounded line border with increased arc
42+
"Console",
43+
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
44+
javax.swing.border.TitledBorder.DEFAULT_POSITION,
45+
new Font("Segoe UI", Font.BOLD, 16)
46+
),
47+
// Inner empty border for padding
48+
BorderFactory.createEmptyBorder(20, 0, 0, 0)
49+
));
3850
cachedStyles = new HashMap<>();
3951

4052
// Initialize console output

dev.skidfuscator.client.standalone/src/main/java/dev/skidfuscator/obfuscator/gui/MainFrame.java

Lines changed: 107 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
import java.awt.*;
1212
import java.awt.event.ActionEvent;
1313
import java.awt.event.KeyEvent;
14+
import java.awt.event.MouseAdapter;
15+
import java.awt.event.MouseEvent;
1416
import java.io.File;
1517
import java.io.InputStream;
18+
import java.net.URI;
1619

1720
@Getter
1821
public class MainFrame extends JFrame {
@@ -27,13 +30,13 @@ public MainFrame() {
2730
setTitle("Skidfuscator");
2831
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
2932
setPreferredSize(new Dimension(900, 700));
30-
31-
// Create main layout with increased padding
3233
setLayout(new BorderLayout(15, 5));
3334

34-
// Add header with logo
35+
// Create a panel for the left side that will contain both tabbed pane and button
36+
JPanel leftPanel = new JPanel(new BorderLayout());
37+
leftPanel.setPreferredSize(new Dimension(180, getHeight()));
3538

36-
JPanel tabbedPanel = new JPanel(new BorderLayout());
39+
// Create the tabbed pane
3740
tabbedPane = new JTabbedPane(JTabbedPane.LEFT) {
3841
@Override
3942
public void updateUI() {
@@ -47,13 +50,12 @@ protected Insets getTabAreaInsets(int tabPlacement) {
4750

4851
@Override
4952
protected int calculateTabAreaWidth(int tabPlacement, int horizRunCount, int maxTabWidth) {
50-
return 160;
53+
return 180;
5154
}
5255

5356
@Override
5457
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) {
55-
// Make tabs fill the entire width of the tab area
56-
return 160;
58+
return 180;
5759
}
5860

5961
@Override
@@ -64,24 +66,24 @@ protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
6466
if (logoStream != null) {
6567
Image logo = ImageIO.read(logoStream);
6668
Image scaledLogo = logo.getScaledInstance(150, 150, Image.SCALE_SMOOTH);
67-
g.drawImage(scaledLogo, 5, 10, null);
69+
g.drawImage(scaledLogo, 20, 10, null);
6870
}
6971

7072
// Draw separator line
7173
g.setColor(Color.DARK_GRAY);
72-
g.drawLine(5, 155, 155, 155);
74+
g.drawLine(5, 155, 175, 155);
7375

7476
// Draw version info
7577
g.setColor(new Color(200,190,220));
7678
g.setFont(new Font("Segoe UI", Font.BOLD, 11));
77-
g.drawString("Skidfuscator Community", 10, 175);
79+
g.drawString("Skidfuscator Community", 20, 175);
7880
g.setColor(new Color(130, 130, 130));
7981
g.setFont(new Font("Segoe UI", Font.ITALIC, 11));
80-
g.drawString("Build: 2023.1", 10, 190);
82+
g.drawString("Build: 2023.1", 20, 190);
8183

8284
// Draw second separator
8385
g.setColor(Color.DARK_GRAY);
84-
g.drawLine(5, 205, 155, 205);
86+
g.drawLine(5, 205, 175, 205);
8587

8688
} catch (Exception e) {
8789
e.printStackTrace();
@@ -91,70 +93,121 @@ protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
9193
});
9294
}
9395
};
94-
tabbedPane.setFont(new Font("Segoe UI", Font.PLAIN, 12));
95-
initializeTabs();
96-
tabbedPanel.add(tabbedPane);
97-
add(tabbedPanel, BorderLayout.CENTER);
9896

99-
// Create a more polished button panel
100-
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 15, 10));
97+
// Create and configure start button
10198
startButton = new JButton("Start Obfuscation");
10299
startButton.setFont(new Font("Segoe UI", Font.PLAIN, 12));
103100
startButton.setBackground(new Color(70, 130, 180));
104101
startButton.setForeground(Color.WHITE);
105102
startButton.setFocusPainted(false);
106-
startButton.addActionListener(new AbstractAction() {
103+
startButton.setPreferredSize(new Dimension(160, 30));
104+
startButton.addActionListener(e -> {
105+
if (e.getSource() == startButton) {
106+
startObfuscation();
107+
}
108+
});
109+
110+
int topSpace = 220;
111+
int bottomPadding = this.getPreferredSize().height - 60*3;
112+
113+
JPanel buttonPanel = new JPanel(new BorderLayout());
114+
buttonPanel.add(startButton, BorderLayout.NORTH);
115+
116+
// Add copyright and website info
117+
JPanel copyrightPanel = new JPanel();
118+
copyrightPanel.setLayout(new BoxLayout(copyrightPanel, BoxLayout.Y_AXIS));
119+
copyrightPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 20, 0));
120+
JLabel copyrightLabel = new JLabel("© 2025 Skidfuscator");
121+
copyrightLabel.setFont(new Font("Segoe UI", Font.BOLD, 10));
122+
copyrightLabel.setForeground(new Color(130, 130, 130));
123+
copyrightLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
124+
copyrightLabel.setHorizontalAlignment(SwingConstants.CENTER);
125+
JLabel allRightsReservedText = new JLabel("<html><div style='width:100%;text-align:justify'>All rights reserved. The use of this software is subject to the terms of the Skidfuscator License Agreement. Unauthorized reproduction or distribution of this software, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law.</div></html>");
126+
allRightsReservedText.setFont(new Font("Segoe UI", Font.PLAIN, 6));
127+
allRightsReservedText.setForeground(new Color(130, 130, 130));
128+
allRightsReservedText.setAlignmentX(Component.CENTER_ALIGNMENT);
129+
allRightsReservedText.setHorizontalAlignment(SwingConstants.CENTER);
130+
allRightsReservedText.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
131+
132+
JSeparator separator = new JSeparator();
133+
separator.setForeground(Color.DARK_GRAY);
134+
separator.setMaximumSize(new Dimension(Integer.MAX_VALUE, 1));
135+
136+
JLabel websiteLabel = new JLabel("skidfuscator.dev");
137+
websiteLabel.setFont(new Font("Courier New", Font.PLAIN, 10));
138+
websiteLabel.setForeground(new Color(70, 130, 180));
139+
websiteLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
140+
websiteLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
141+
websiteLabel.setHorizontalAlignment(SwingConstants.CENTER);
142+
websiteLabel.addMouseListener(new MouseAdapter() {
107143
@Override
108-
public void actionPerformed(ActionEvent e) {
109-
if (e.getSource() == startButton) {
110-
startObfuscation();
144+
public void mouseClicked(MouseEvent e) {
145+
try {
146+
Desktop.getDesktop().browse(new URI("https://skidfuscator.dev"));
147+
} catch (Exception ex) {
148+
ex.printStackTrace();
111149
}
112150
}
113151
});
114-
buttonPanel.add(startButton);
115-
add(buttonPanel, BorderLayout.SOUTH);
152+
copyrightPanel.add(copyrightLabel);
153+
copyrightPanel.add(separator);
154+
copyrightPanel.add(allRightsReservedText);
155+
copyrightPanel.add(separator);
156+
copyrightPanel.add(websiteLabel);
116157

117-
// Set keyboard mnemonics
118-
setupKeyboardShortcuts();
119-
120-
// Final setup
121-
pack();
122-
setLocationRelativeTo(null);
123-
}
158+
buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 20, 0));
124159

125-
private void initializeTabs() {
126160
// Initialize panels
127161
configPanel = new ConfigPanel();
128162
transformerPanel = new TransformerPanel();
129163
consolePanel = new ConsolePanel();
130164

131-
// Add Configuration tab
132-
JPanel configTabPanel = createTabPanel(configPanel, "Configuration");
133-
tabbedPane.addTab("Configuration", null, configTabPanel, "Basic configuration settings");
134-
tabbedPane.setMnemonicAt(0, KeyEvent.VK_C);
165+
// Add tabs (without content)
166+
tabbedPane.addTab("Configuration", null);
167+
tabbedPane.addTab("Transformers", null);
168+
tabbedPane.addTab("Console", null);
135169

136-
// Add Transformers tab
137-
JPanel transformerTabPanel = createTabPanel(transformerPanel, "Transformers");
138-
tabbedPane.addTab("Transformers", null, transformerTabPanel, "Transformer settings and options");
170+
// Set mnemonics
171+
tabbedPane.setMnemonicAt(0, KeyEvent.VK_C);
139172
tabbedPane.setMnemonicAt(1, KeyEvent.VK_T);
140-
141-
// Add Console tab
142-
JPanel consoleTabPanel = createTabPanel(consolePanel, "Console Output");
143-
tabbedPane.addTab("Console", null, consoleTabPanel, "View obfuscation progress and logs");
144173
tabbedPane.setMnemonicAt(2, KeyEvent.VK_O);
145174

146-
// Set default selected tab
147-
tabbedPane.setSelectedIndex(0);
148-
}
175+
// Add components to the left panel
176+
leftPanel.add(tabbedPane, BorderLayout.NORTH);
177+
leftPanel.add(buttonPanel, BorderLayout.CENTER);
178+
leftPanel.add(copyrightPanel, BorderLayout.SOUTH);
179+
180+
// Create a panel for the content area
181+
JPanel contentPanel = new JPanel(new BorderLayout());
182+
contentPanel.setBorder(
183+
BorderFactory.createEmptyBorder(10, 0, 10, 10));
184+
contentPanel.add(configPanel, BorderLayout.CENTER); // Show config panel by default
185+
186+
// Add panels to the frame
187+
add(leftPanel, BorderLayout.WEST);
188+
add(contentPanel, BorderLayout.CENTER);
189+
190+
// Add a listener to update the content panel when tabs change
191+
tabbedPane.addChangeListener(e -> {
192+
contentPanel.removeAll();
193+
switch (tabbedPane.getSelectedIndex()) {
194+
case 0:
195+
contentPanel.add(configPanel, BorderLayout.CENTER);
196+
break;
197+
case 1:
198+
contentPanel.add(transformerPanel, BorderLayout.CENTER);
199+
break;
200+
case 2:
201+
contentPanel.add(consolePanel, BorderLayout.CENTER);
202+
break;
203+
}
204+
contentPanel.revalidate();
205+
contentPanel.repaint();
206+
});
149207

150-
private JPanel createTabPanel(JComponent component, String title) {
151-
JPanel panel = new JPanel(new BorderLayout());
152-
panel.setBorder(BorderFactory.createCompoundBorder(
153-
BorderFactory.createEmptyBorder(10, 10, 10, 10),
154-
BorderFactory.createTitledBorder(title)
155-
));
156-
panel.add(component, BorderLayout.CENTER);
157-
return panel;
208+
// Final setup
209+
pack();
210+
setLocationRelativeTo(null);
158211
}
159212

160213
private void setupKeyboardShortcuts() {

dev.skidfuscator.client.standalone/src/main/java/dev/skidfuscator/obfuscator/gui/TransformerPanel.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import dev.skidfuscator.obfuscator.gui.transformer.TransformerOptionType;
99

1010
import javax.swing.*;
11+
import javax.swing.border.EtchedBorder;
1112
import java.awt.*;
1213
import java.io.File;
1314
import java.io.FileWriter;
@@ -24,6 +25,19 @@ public class TransformerPanel extends JPanel {
2425
public TransformerPanel() {
2526
setLayout(new BorderLayout(10, 10));
2627

28+
// Create compound border with titled border and empty border for padding
29+
setBorder(BorderFactory.createCompoundBorder(
30+
// Outer titled border
31+
BorderFactory.createTitledBorder(
32+
BorderFactory.createEtchedBorder(EtchedBorder.RAISED), // Rounded line border with increased arc
33+
"Transformers",
34+
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
35+
javax.swing.border.TitledBorder.DEFAULT_POSITION,
36+
new Font("Segoe UI", Font.BOLD, 16)
37+
),
38+
// Inner empty border for padding
39+
BorderFactory.createEmptyBorder(20, 0, 10, 0)
40+
));
2741
// Create transformer sections panel
2842
JPanel sectionsPanel = new JPanel(new GridLayout(0, 1, 5, 5));
2943
transformerSections = new HashMap<>();

dev.skidfuscator.obfuscator/src/main/java/dev/skidfuscator/obfuscator/util/JdkDownloader.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class JdkDownloader {
3232
break;
3333
case "windows":
3434
case "windows 11":
35+
case "windows 10":
3536
JDK_URL = "https://corretto.aws/downloads/resources/17.0.13.11.1/amazon-corretto-17.0.13.11.1-windows-x64-jdk.zip";
3637
break;
3738
default:
@@ -53,6 +54,7 @@ public static Path getCachedJdk() throws IOException {
5354
cacheName = "amazon-corretto-17.jdk";
5455
break;
5556
case "windows":
57+
case "windows 10":
5658
case "windows 11":
5759
cacheName = "jdk17.0.13_11";
5860
break;

0 commit comments

Comments
 (0)