Skip to content

Commit 0cc0944

Browse files
authored
Merge pull request #1 from xmpf/ishtar-modal
2023-03-22: Changed JADXecute window to modeless
2 parents e07ae6d + 3df0353 commit 0cc0944

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vscode/

jadx-with-jadxecute/jadx-gui/src/main/java/jadx/gui/plugins/jadxecute/JadxecuteDialog.java

+25-11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.awt.Color;
3030
import java.awt.Component;
3131
import java.awt.Dimension;
32+
import java.awt.Font;
3233

3334
import javax.swing.JFileChooser;
3435
import javax.swing.JList;
@@ -46,26 +47,32 @@ public class JadxecuteDialog extends JDialog {
4647
private final transient JadxSettings settings;
4748
private final transient MainWindow mainWindow;
4849

50+
private static final int DEFAULT_FONT_SIZE = 12;
51+
4952
public JadxecuteDialog(MainWindow mainWindow) {
53+
super(mainWindow, "JADXexecute", true);
5054
this.mainWindow = mainWindow;
5155
this.settings = mainWindow.getSettings();
56+
5257
initUI();
5358
}
5459

5560
private void initUI() {
5661
JPanel mainPanel = new JPanel();
5762
mainPanel.setLayout(new BorderLayout());
5863
mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
59-
64+
6065
// Input and output code areas
6166
JLabel codeInputDescription = new JLabel("Java Input");
62-
codeInputDescription.setPreferredSize(new Dimension(80, 16));
67+
codeInputDescription.setFont(new Font(null, Font.BOLD, DEFAULT_FONT_SIZE));
68+
codeInputDescription.setPreferredSize(new Dimension(100, 16));
6369
RSyntaxTextArea codeInputArea = new RSyntaxTextArea(getDefaultCodeInputText());
6470
codeInputArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
6571
JScrollPane codeInputScrollPanel = new JScrollPane(codeInputArea);
66-
codeInputScrollPanel.setPreferredSize(new Dimension(550, 200));
72+
codeInputScrollPanel.setPreferredSize(new Dimension(600, 200));
6773

6874
JLabel consoleOutputDescription = new JLabel("Console Output");
75+
consoleOutputDescription.setFont(new Font(null, Font.BOLD, DEFAULT_FONT_SIZE));
6976
consoleOutputDescription.setPreferredSize(new Dimension(80, 16));
7077
consoleOutputDescription.setBorder(new EmptyBorder(10, 0, 10, 0));
7178
JTextArea consoleOutputArea = new JTextArea(" ");
@@ -85,11 +92,14 @@ private void initUI() {
8592
bottomPan.setLayout(new BorderLayout());
8693
JPanel buttonPane = new JPanel();
8794
JLabel statusLabel = new JLabel("Status: Ready");
88-
statusLabel.setPreferredSize(new Dimension(80, 16));
95+
statusLabel.setPreferredSize(new Dimension(100, 16));
8996
JButton run = new JButton("Run");
9097
JButton close = new JButton("Close");
9198
close.addActionListener(event -> close());
99+
100+
// run code
92101
run.addActionListener(event -> runUserCode(codeInputArea, consoleOutputArea, statusLabel, run));
102+
93103
buttonPane.add(run);
94104
buttonPane.add(close);
95105
bottomPan.add(statusLabel, BorderLayout.WEST);
@@ -137,15 +147,16 @@ private JPanel initCodeExamplesPanel(RSyntaxTextArea codeInputArea, JPanel fileP
137147
codeExamplesPanel.setLayout(new BorderLayout());
138148
codeExamplesPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
139149
JLabel scriptSelection = new JLabel("Select Template:");
140-
150+
scriptSelection.setFont(new Font(null, Font.BOLD, DEFAULT_FONT_SIZE));
151+
141152
JScrollPane exampleScrollPane = initCodeExamplesListeners(codeInputArea);
142153
JPanel southExamplesPanel = new JPanel();
143154
southExamplesPanel.setLayout(new BorderLayout());
144155
southExamplesPanel.add(scriptSelection, BorderLayout.NORTH);
145156
southExamplesPanel.add(exampleScrollPane, BorderLayout.CENTER);
146157
codeExamplesPanel.add(filePanel, BorderLayout.NORTH);
147158
codeExamplesPanel.add(southExamplesPanel, BorderLayout.CENTER);
148-
codeExamplesPanel.setPreferredSize(new Dimension(200, 400));
159+
codeExamplesPanel.setPreferredSize(new Dimension(300, 400));
149160

150161
return codeExamplesPanel;
151162
}
@@ -156,12 +167,14 @@ private void finishUI(JPanel mainPanel) {
156167

157168
setTitle("JADXecute");
158169
pack();
159-
if (!mainWindow.getSettings().loadWindowPos(this)) {
160-
setSize(800, 500);
161-
}
162-
setLocationRelativeTo(null);
170+
171+
// set modal size
172+
setSize(1024, 768);
173+
174+
setLocationRelativeTo(mainPanel);
175+
this.setModal(false);
163176
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
164-
setModalityType(ModalityType.APPLICATION_MODAL);
177+
// setModalityType(ModalityType.APPLICATION_MODAL);
165178
UiUtils.addEscapeShortCutToDispose(this);
166179
}
167180

@@ -190,6 +203,7 @@ private JPanel initFilePanel(RSyntaxTextArea codeInputArea) {
190203
filePanel.setBorder(new EmptyBorder(10, 0, 10, 0));
191204

192205
JLabel fileLabel = new JLabel("Input Java File: ");
206+
fileLabel.setFont(new Font(null, Font.BOLD, DEFAULT_FONT_SIZE));
193207
JTextField fileField = new JTextField(20);
194208
JButton fileButton = new JButton("Browse");
195209
fileButton.addActionListener(e -> {

0 commit comments

Comments
 (0)