Dynamic Busy Status
This also cleans up the UI for the Dark Mode theme
This commit is contained in:
parent
c0eb9e944e
commit
0d8280b0b9
3 changed files with 35 additions and 40 deletions
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,7 @@ import java.awt.KeyboardFocusManager;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.swing.*;
|
||||
|
||||
|
@ -64,7 +65,7 @@ public class MainViewerGUI extends JFrame
|
|||
{
|
||||
public AboutWindow aboutWindow = new AboutWindow();
|
||||
public boolean isMaximized;
|
||||
public final JMenuItem[] waitIcons;
|
||||
public final List<JMenuItem> waitIcons = new ArrayList<>();
|
||||
|
||||
//main UI components
|
||||
private static final ArrayList<VisibleComponent> uiComponents = new ArrayList<>();
|
||||
|
@ -271,15 +272,6 @@ public class MainViewerGUI extends JFrame
|
|||
buildObfuscateMenu();
|
||||
defaultSettings();
|
||||
|
||||
waitIcons = new JMenuItem[10];
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
waitIcons[i] = new JMenuItem("");
|
||||
waitIcons[i].setMaximumSize(new Dimension(20, 50));
|
||||
waitIcons[i].setEnabled(false);
|
||||
rootMenu.add(waitIcons[i]);
|
||||
}
|
||||
|
||||
setTitle("Bytecode Viewer " + VERSION + " - https://bytecodeviewer.com | https://the.bytecode.club - @Konloch");
|
||||
|
||||
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS));
|
||||
|
@ -745,37 +737,39 @@ public class MainViewerGUI extends JFrame
|
|||
{
|
||||
SwingUtilities.invokeLater(()->
|
||||
{
|
||||
for (JMenuItem waitIcon : waitIcons)
|
||||
{
|
||||
waitIcon.setIcon(null);
|
||||
waitIcon.updateUI();
|
||||
}
|
||||
int length = waitIcons.size();
|
||||
for (int i = 0; i < length; i++)
|
||||
updateBusyStatus(false);
|
||||
});
|
||||
}
|
||||
|
||||
public synchronized void updateBusyStatus(final boolean busy) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (busy) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (waitIcons[i].getIcon() == null) {
|
||||
try {
|
||||
waitIcons[i].setIcon(Resources.busyIcon);
|
||||
} catch (NullPointerException e) {
|
||||
waitIcons[i].setIcon(Resources.busyB64Icon);
|
||||
}
|
||||
waitIcons[i].updateUI();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (waitIcons[i].getIcon() != null) {
|
||||
waitIcons[i].setIcon(null);
|
||||
waitIcons[i].updateUI();
|
||||
break;
|
||||
}
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
if (busy)
|
||||
{
|
||||
JMenuItem waitIcon = new JMenuItem("");
|
||||
waitIcon.setMaximumSize(new Dimension(20, 50));
|
||||
waitIcon.setEnabled(false);
|
||||
try {
|
||||
waitIcon.setIcon(Resources.busyIcon);
|
||||
} catch (NullPointerException e) {
|
||||
waitIcon.setIcon(Resources.busyB64Icon);
|
||||
}
|
||||
rootMenu.add(waitIcon);
|
||||
waitIcons.add(waitIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(waitIcons.isEmpty())
|
||||
return;
|
||||
|
||||
JMenuItem waitIcon = waitIcons.get(0);
|
||||
waitIcons.remove(0);
|
||||
rootMenu.remove(waitIcon);
|
||||
}
|
||||
|
||||
rootMenu.updateUI();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -81,8 +81,6 @@ public class ResourceViewProcessing extends PaneUpdaterThread
|
|||
}
|
||||
else
|
||||
{
|
||||
updateUpdaterTextArea = new SearchableRSyntaxTextArea();
|
||||
|
||||
final Decompiler decompiler = resourceViewPanel.decompiler;
|
||||
|
||||
//perform decompiling inside of this thread
|
||||
|
@ -91,6 +89,8 @@ public class ResourceViewProcessing extends PaneUpdaterThread
|
|||
//set the swing components on the swing thread
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
updateUpdaterTextArea = new SearchableRSyntaxTextArea();
|
||||
|
||||
Configuration.rstaTheme.apply(updateUpdaterTextArea);
|
||||
resourceViewPanel.textArea = updateUpdaterTextArea;
|
||||
|
||||
|
|
Loading…
Reference in a new issue