Added Translated JCheckBox
This commit is contained in:
parent
370f2b9a1c
commit
ad6dff9082
5 changed files with 48 additions and 4 deletions
|
@ -4,6 +4,8 @@ import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.Resources;
|
import the.bytecode.club.bytecodeviewer.Resources;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.components.listeners.PressKeyListener;
|
import the.bytecode.club.bytecodeviewer.gui.components.listeners.PressKeyListener;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.components.listeners.ReleaseKeyListener;
|
import the.bytecode.club.bytecodeviewer.gui.components.listeners.ReleaseKeyListener;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.Translation;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBox;
|
||||||
import the.bytecode.club.bytecodeviewer.util.JTextAreaUtils;
|
import the.bytecode.club.bytecodeviewer.util.JTextAreaUtils;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -39,7 +41,7 @@ public class SearchableJTextArea extends JTextArea
|
||||||
private final JScrollPane scrollPane = new JScrollPane();
|
private final JScrollPane scrollPane = new JScrollPane();
|
||||||
private final JPanel searchPanel = new JPanel(new BorderLayout());
|
private final JPanel searchPanel = new JPanel(new BorderLayout());
|
||||||
private final JTextField searchInput = new JTextField();
|
private final JTextField searchInput = new JTextField();
|
||||||
private final JCheckBox caseSensitiveSearch = new JCheckBox("Exact");
|
private final JCheckBox caseSensitiveSearch = new TranslatedJCheckBox("Exact", Translation.EXACT);
|
||||||
|
|
||||||
public SearchableJTextArea()
|
public SearchableJTextArea()
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,8 @@ import the.bytecode.club.bytecodeviewer.Resources;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.components.listeners.PressKeyListener;
|
import the.bytecode.club.bytecodeviewer.gui.components.listeners.PressKeyListener;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.components.listeners.ReleaseKeyListener;
|
import the.bytecode.club.bytecodeviewer.gui.components.listeners.ReleaseKeyListener;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
|
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.Translation;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBox;
|
||||||
import the.bytecode.club.bytecodeviewer.util.JTextAreaUtils;
|
import the.bytecode.club.bytecodeviewer.util.JTextAreaUtils;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -44,7 +46,7 @@ public class SearchableRSyntaxTextArea extends RSyntaxTextArea
|
||||||
private final RTextScrollPane scrollPane = new RTextScrollPane(this);
|
private final RTextScrollPane scrollPane = new RTextScrollPane(this);
|
||||||
private final JPanel searchPanel = new JPanel(new BorderLayout());
|
private final JPanel searchPanel = new JPanel(new BorderLayout());
|
||||||
private final JTextField searchInput = new JTextField();
|
private final JTextField searchInput = new JTextField();
|
||||||
private final JCheckBox caseSensitiveSearch = new JCheckBox("Exact");
|
private final JCheckBox caseSensitiveSearch = new TranslatedJCheckBox("Exact", Translation.EXACT);
|
||||||
private final JLabel titleHeader = new JLabel("");
|
private final JLabel titleHeader = new JLabel("");
|
||||||
private final Color scrollBackground = new Color(0x3c3f41);
|
private final Color scrollBackground = new Color(0x3c3f41);
|
||||||
private final Color scrollForeground = new Color(0x575859);
|
private final Color scrollForeground = new Color(0x575859);
|
||||||
|
|
|
@ -30,6 +30,8 @@ import javax.swing.tree.TreePath;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.components.VisibleComponent;
|
import the.bytecode.club.bytecodeviewer.gui.components.VisibleComponent;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.Translation;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBox;
|
||||||
import the.bytecode.club.bytecodeviewer.util.FileContainer;
|
import the.bytecode.club.bytecodeviewer.util.FileContainer;
|
||||||
import the.bytecode.club.bytecodeviewer.util.FileDrop;
|
import the.bytecode.club.bytecodeviewer.util.FileDrop;
|
||||||
import the.bytecode.club.bytecodeviewer.util.LazyNameUtil;
|
import the.bytecode.club.bytecodeviewer.util.LazyNameUtil;
|
||||||
|
@ -63,7 +65,7 @@ import the.bytecode.club.bytecodeviewer.util.LazyNameUtil;
|
||||||
public class ResourceListPane extends VisibleComponent implements FileDrop.Listener
|
public class ResourceListPane extends VisibleComponent implements FileDrop.Listener
|
||||||
{
|
{
|
||||||
public final JPopupMenu rightClickMenu = new JPopupMenu();
|
public final JPopupMenu rightClickMenu = new JPopupMenu();
|
||||||
public final JCheckBox exact = new JCheckBox("Exact");
|
public final JCheckBox exact = new TranslatedJCheckBox("Exact", Translation.EXACT);
|
||||||
public final JButton open = new JButton("+");
|
public final JButton open = new JButton("+");
|
||||||
public final JButton close = new JButton("-");
|
public final JButton close = new JButton("-");
|
||||||
public final ResourceTreeNode treeRoot = new ResourceTreeNode("Loaded Files:");
|
public final ResourceTreeNode treeRoot = new ResourceTreeNode("Loaded Files:");
|
||||||
|
|
|
@ -22,6 +22,8 @@ import the.bytecode.club.bytecodeviewer.gui.components.VisibleComponent;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
|
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.BackgroundSearchThread;
|
import the.bytecode.club.bytecodeviewer.searching.BackgroundSearchThread;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.SearchResultNotifier;
|
import the.bytecode.club.bytecodeviewer.searching.SearchResultNotifier;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.Translation;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBox;
|
||||||
import the.bytecode.club.bytecodeviewer.util.FileContainer;
|
import the.bytecode.club.bytecodeviewer.util.FileContainer;
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -56,7 +58,7 @@ public class SearchBoxPane extends VisibleComponent
|
||||||
public static final SearchRadius[] SEARCH_RADII = SearchRadius.values();
|
public static final SearchRadius[] SEARCH_RADII = SearchRadius.values();
|
||||||
public static final SearchType[] SEARCH_TYPES = SearchType.values();
|
public static final SearchType[] SEARCH_TYPES = SearchType.values();
|
||||||
|
|
||||||
public final JCheckBox exact = new JCheckBox("Exact");
|
public final JCheckBox exact = new TranslatedJCheckBox("Exact", Translation.EXACT);
|
||||||
public final DefaultMutableTreeNode treeRoot = new DefaultMutableTreeNode("Results");
|
public final DefaultMutableTreeNode treeRoot = new DefaultMutableTreeNode("Results");
|
||||||
public final JTree tree;
|
public final JTree tree;
|
||||||
public final JComboBox typeBox;
|
public final JComboBox typeBox;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package the.bytecode.club.bytecodeviewer.translation.components;
|
||||||
|
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.TranslatedComponent;
|
||||||
|
import the.bytecode.club.bytecodeviewer.translation.Translation;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Konloch
|
||||||
|
* @since 6/30/2021
|
||||||
|
*/
|
||||||
|
public class TranslatedJCheckBox extends JCheckBox
|
||||||
|
{
|
||||||
|
private final TranslatedComponent component;
|
||||||
|
|
||||||
|
public TranslatedJCheckBox(String text, Translation translation)
|
||||||
|
{
|
||||||
|
super(text);
|
||||||
|
|
||||||
|
if(translation != null)
|
||||||
|
{
|
||||||
|
this.component = translation.getTranslatedComponent();
|
||||||
|
this.component.runOnUpdate.add(this::updateText);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.component = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateText()
|
||||||
|
{
|
||||||
|
if(component != null)
|
||||||
|
setText(component.value);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue