diff --git a/jApps/src/components/Copy$1.class b/jApps/src/components/Copy$1.class
deleted file mode 100644
index c91d0c1..0000000
Binary files a/jApps/src/components/Copy$1.class and /dev/null differ
diff --git a/jApps/src/components/Copy.class b/jApps/src/components/Copy.class
deleted file mode 100644
index 1ab1d63..0000000
Binary files a/jApps/src/components/Copy.class and /dev/null differ
diff --git a/jApps/src/components/Item.class b/jApps/src/components/Item.class
deleted file mode 100644
index 180530f..0000000
Binary files a/jApps/src/components/Item.class and /dev/null differ
diff --git a/jApps/src/components/ListDemo$1.class b/jApps/src/components/ListDemo$1.class
deleted file mode 100644
index 3425e19..0000000
Binary files a/jApps/src/components/ListDemo$1.class and /dev/null differ
diff --git a/jApps/src/components/ListDemo$2.class b/jApps/src/components/ListDemo$2.class
deleted file mode 100644
index c605878..0000000
Binary files a/jApps/src/components/ListDemo$2.class and /dev/null differ
diff --git a/jApps/src/components/ListDemo$FireListener.class b/jApps/src/components/ListDemo$FireListener.class
deleted file mode 100644
index 04f52a7..0000000
Binary files a/jApps/src/components/ListDemo$FireListener.class and /dev/null differ
diff --git a/jApps/src/components/ListDemo$HireListener.class b/jApps/src/components/ListDemo$HireListener.class
deleted file mode 100644
index ba3f99d..0000000
Binary files a/jApps/src/components/ListDemo$HireListener.class and /dev/null differ
diff --git a/jApps/src/components/ListDemo.class b/jApps/src/components/ListDemo.class
deleted file mode 100644
index ec13632..0000000
Binary files a/jApps/src/components/ListDemo.class and /dev/null differ
diff --git a/jApps/src/components/ListDemo.jnlp b/jApps/src/components/ListDemo.jnlp
deleted file mode 100644
index 35368c6..0000000
--- a/jApps/src/components/ListDemo.jnlp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
- ListDemo
- The Java(tm) Tutorial
-
- ListDemo
- Demonstrates how to add and remove objects from
- a list at runtime
-
-
-
-
-
-
-
-
diff --git a/jApps/src/components/Tester.java b/jApps/src/components/Tester.java
deleted file mode 100644
index ac0bb09..0000000
--- a/jApps/src/components/Tester.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class Tester {
- public static void main(String[] args) {
-
- }
-}
\ No newline at end of file
diff --git a/jApps/src/components/ZipperProgress$1.class b/jApps/src/components/ZipperProgress$1.class
deleted file mode 100644
index de9424b..0000000
Binary files a/jApps/src/components/ZipperProgress$1.class and /dev/null differ
diff --git a/jApps/src/components/ZipperProgress$Task.class b/jApps/src/components/ZipperProgress$Task.class
deleted file mode 100644
index cbfb6a2..0000000
Binary files a/jApps/src/components/ZipperProgress$Task.class and /dev/null differ
diff --git a/jApps/src/components/ZipperProgress.class b/jApps/src/components/ZipperProgress.class
deleted file mode 100644
index bb19561..0000000
Binary files a/jApps/src/components/ZipperProgress.class and /dev/null differ
diff --git a/jApps/src/components/images/left.gif b/jApps/src/components/images/left.gif
deleted file mode 100644
index 279e671..0000000
Binary files a/jApps/src/components/images/left.gif and /dev/null differ
diff --git a/jApps/src/components/jApps$1.class b/jApps/src/components/jApps$1.class
deleted file mode 100644
index 2ee76ac..0000000
Binary files a/jApps/src/components/jApps$1.class and /dev/null differ
diff --git a/jApps/src/components/jApps$2.class b/jApps/src/components/jApps$2.class
deleted file mode 100644
index 73190be..0000000
Binary files a/jApps/src/components/jApps$2.class and /dev/null differ
diff --git a/jApps/src/components/jApps$FireListener.class b/jApps/src/components/jApps$FireListener.class
deleted file mode 100644
index 810502f..0000000
Binary files a/jApps/src/components/jApps$FireListener.class and /dev/null differ
diff --git a/jApps/src/components/jApps$HireListener.class b/jApps/src/components/jApps$HireListener.class
deleted file mode 100644
index 9c37c42..0000000
Binary files a/jApps/src/components/jApps$HireListener.class and /dev/null differ
diff --git a/jApps/src/components/jApps.class b/jApps/src/components/jApps.class
deleted file mode 100644
index 84f3f7c..0000000
Binary files a/jApps/src/components/jApps.class and /dev/null differ
diff --git a/jApps/src/components/jApps.java b/jApps/src/components/jApps.java
index 904234b..9c223c5 100644
--- a/jApps/src/components/jApps.java
+++ b/jApps/src/components/jApps.java
@@ -2,9 +2,12 @@
import java.awt.*;
import javax.swing.*;
+import javax.swing.border.EmptyBorder;
import javax.swing.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
// TODO: Add uninstall feature
// TODO: Network download if usb not detected
@@ -20,6 +23,7 @@ public class jApps extends JPanel
private final JCheckBox showApps = new JCheckBox("Display Apps", true);
private final JCheckBox showRoms = new JCheckBox("Display ROMS", true);
private final JCheckBox showOther = new JCheckBox("Display 'Other'", true);
+ private final JTextField search;
// TODO: Test if the USB letter is the same on other school laptops
private final String usbName = "D:/";
@@ -30,6 +34,7 @@ public class jApps extends JPanel
private static final String installString = "Install";
public jApps() {
+ // TODO: Clean up the constructor
super(new BorderLayout());
updateList();
@@ -44,6 +49,8 @@ public jApps() {
JScrollPane listScrollPane = new JScrollPane(list);
JButton installButton = new JButton(installString);
+ search = new JTextField();
+
InstallListener installListener = new InstallListener(installButton);
installButton.setActionCommand(installString);
installButton.addActionListener(installListener);
@@ -52,6 +59,11 @@ public jApps() {
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane,
BoxLayout.LINE_AXIS));
+ JLabel searchText = new JLabel("Search");
+ searchText.setFont(new Font("Arial Rounded MT Bold", Font.PLAIN, 20));
+ searchText.setBorder(new EmptyBorder(0,0,0,5));
+ buttonPane.add(searchText);
+ buttonPane.add(search);
buttonPane.add(Box.createHorizontalStrut(5));
buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
buttonPane.add(Box.createHorizontalStrut(5));
@@ -88,6 +100,8 @@ public jApps() {
showApps.addActionListener(showListener);
showRoms.addActionListener(showListener);
showOther.addActionListener(showListener);
+
+ search.getDocument().addDocumentListener(new SearchListener());
add(listScrollPane, BorderLayout.CENTER);
@@ -98,32 +112,21 @@ public jApps() {
}
private final ActionListener showListener = new ActionListener() {
- public void actionPerformed(ActionEvent actionEvent) {
- // TODO: remove reduntant items
-
- // Remove elements in listModel that do not follow the checkboxes criteria
-
- for(int i = 0; i < listModel.size(); i++) {
- byte type = ((Item) tempList.get(i)).getType();
- listModel.set(i, tempList.get(i));
- if(type == 0) {
- if(!showApps.isSelected()) {
- listModel.set(i, new Item("", "", "", 0.0f, ""));
- }
- } else if(type == 1) {
- if(!showRoms.isSelected()) {
- listModel.set(i, new Item("", "", "", 0.0f, ""));
- }
- } else if(type == 2) {
- if(!showOther.isSelected()) {
- listModel.set(i, new Item("", "", "", 0.0f, ""));
- }
- }
-
+ public void actionPerformed(ActionEvent actionEvent) {
+ sortList();
}
- }
};
+ class SearchListener implements DocumentListener {
+ public void insertUpdate(DocumentEvent e) {
+ sortList();
+ }
+ public void removeUpdate(DocumentEvent e) {
+ sortList();
+ }
+ public void changedUpdate(DocumentEvent e) {}
+ }
+
//This listener is shared by the text field and the install butlton.
class InstallListener implements ActionListener, DocumentListener {
private boolean alreadyEnabled = false;
@@ -158,23 +161,23 @@ public void removeUpdate(DocumentEvent e) {}
public void changedUpdate(DocumentEvent e) {}
}
-
- public boolean confirmDownload(Item item) {
+
+ private boolean confirmDownload(Item item) {
String info = "You are going to install: " + item + "\n\nInfo:\nFile Size: " + item.prettyFileSize() + "\nETA: " + item.eta();
int quit;
quit = JOptionPane.showOptionDialog(null, info, item.toString(), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
return quit == 0;
}
-
- public void updateDescription() {
+
+ private void updateDescription() {
// Updates the description when the selection is changed on the list
title.setText(list.getSelectedValue().toString());
Item desc = (Item) (list.getSelectedValue());
description.setText("
" + desc.getDescription() + "
");
}
-
- public void updateList() {
+
+ private void updateList() {
// TODO: Load from JSON file in the future
// Loads list items
listModel = new DefaultListModel();
@@ -184,11 +187,10 @@ public void updateList() {
listModel.addElement(new Item("RetroArch", usbName, "RetroArch.zip", 273f, "/RetroArch/RetroArch-Win64/retroarch.exe", "With this software, you can emulate a lot of consoles, like the NES, PS1, and even the 3DS."));
listModel.addElement(new Item("Notepad++", usbName, "Notepad++.zip", 3.1f, "/Notepad++/notepad++.exe", "Notepad, but better"));
listModel.addElement(new Item("Vim", usbName, "Vim.zip", 19f, "/Vim/vim90/vim.exe", "Notepad, but for smart people"));
-
- // TODO: Change directories to be correct
+
listModel.addElement(new Item("Process Explorer", usbName, "Process Explorer.zip", 3.1f, "/Process Explorer/procexp64.exe", "Pretty much just Task Manager"));
listModel.addElement(new Item("InteliJ", usbName, "InteliJ.zip", 830f, "/JetBrains/bin/idea64.exe", "A Java IDE by the company 'JetBrains'"));
- listModel.addElement(new Item("PyCharm", usbName, "PyCharm.zip", 565f, "/Process Explorer/procexp64.exe", "A Python IDE by the company 'JetBrains' (IMPORTANT) You need to install Python from here for this to work!"));
+ listModel.addElement(new Item("PyCharm", usbName, "PyCharm.zip", 565f, "/JetBrains/bin/idea64.exe", "A Python IDE by the company 'JetBrains' (IMPORTANT) You need to install Python from here for this to work!"));
listModel.addElement(new Item((byte) 2, "Python", usbName, "Python3.10.zip", 14.5f, "You either love it or hate it, Python, (Version 3.10). You need this for Pycharm since the auto-installer will not work. Also installing libraries is really difficult since not only is pip not automatically installed. Not only that but also the package distrubution site is blocked!", "C:/Windows/System32/Microsoft/Crypto/RSA/MachineKeys/Apps//"));
listModel.addElement(new Item("Dolphin", usbName, "Dolphin-x64.zip", 42.4f, "/Dolphin-x64/Dolphin.exe", "A Nintendo Wii emulator, (IMPORTANT) This does not include any games! There are several games listed here and you can also find the files online.\n\nTo install games, open the app, and click 'Open'. Then navigate to your game file and select it. Then just click the icon and press 'Play' on the menu."));
@@ -199,8 +201,39 @@ public void updateList() {
}
}
+ private void sortList() {
+ // Remove elements in listModel that do not follow the checkboxes criteria
+ listModel.removeAllElements();
+
+ for (int i = 0; i < tempList.size(); i++) {
+ Item currentItem = ((Item) tempList.get(i));
+ byte type = currentItem.getType();
+
+ // Check if search query is in the current item
+ if(currentItem.toString().toUpperCase().contains(search.getText().toUpperCase())) {
+ if (type == 0) {
+ if (showApps.isSelected()) {
+ listModel.addElement(currentItem);
+ }
+ } else if (type == 1) {
+ if (showRoms.isSelected()) {
+ listModel.addElement(currentItem);
+ }
+ } else if (type == 2) {
+ if (showOther.isSelected()) {
+ listModel.addElement(currentItem);
+ }
+ }
+ }
+
+ }
+ }
+
public void valueChanged(ListSelectionEvent e) {
- updateDescription();
+ // TODO: Stop double-updating the description
+ try {
+ updateDescription();
+ } catch(Exception err) {}
}
// Create GUI