Skip to content

Commit

Permalink
Fix small bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisTestUser committed May 26, 2018
1 parent 143527f commit 9b76c51
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/java/com/javadeobfuscator/deobfuscator/ui/SwingWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class SwingWindow
private static List<Class<?>> transformers;
private static File inputOutputPath = new File(System.getProperty("user.dir"));
private static File libPath = new File(System.getProperty("user.dir"));
private static JCheckBoxMenuItem shouldLimitLines;
private static final Map<Class<?>, String> TRANSFORMER_TO_NAME = new HashMap<>();
private static final Map<String, Class<?>> NAME_TO_TRANSFORMER = new HashMap<>();

Expand All @@ -66,6 +67,14 @@ public static void main(String[] args)
frame.getContentPane().setLayout(new GridBagLayout());
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

//Menu
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Options");
menuBar.add(menu);
shouldLimitLines = new JCheckBoxMenuItem("Limit Console Lines");
menu.add(shouldLimitLines);
frame.setJMenuBar(menuBar);

//Deobfuscator Input
GridBagConstraints gbc_IPanel = new GridBagConstraints();
gbc_IPanel.fill = GridBagConstraints.HORIZONTAL;
Expand Down Expand Up @@ -770,7 +779,6 @@ public void actionPerformed(ActionEvent e)
{
run.setEnabled(false);
// Start
area.setText(null);
JFrame newFrame = new JFrame();
newFrame.setTitle("Console");
area.setEditable(false);
Expand Down Expand Up @@ -871,6 +879,8 @@ public void run()
@Override
public void windowClosing(WindowEvent e)
{
print.flush();
area.setText(null);
run.setEnabled(true);
if(thread.isAlive())
thread.stop();
Expand Down Expand Up @@ -953,6 +963,16 @@ public DeobfuscatorOutputStream(JTextArea console)
public void write(int b) throws IOException
{
console.append(String.valueOf((char)b));
if(shouldLimitLines.isSelected() && console.getLineCount() > 100)
{
try
{
console.replaceRange("", 0, console.getLineEndOffset(0));
}catch(Exception e)
{

}
}
}
}
}

0 comments on commit 9b76c51

Please sign in to comment.