1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-11-14 06:39:53 -08:00
Abacus/src/org/nwapw/abacus/Abacus.java

61 lines
1.6 KiB
Java
Raw Normal View History

2017-07-24 10:04:00 -07:00
package org.nwapw.abacus;
import org.nwapw.abacus.plugin.PluginManager;
2017-07-28 11:17:54 -07:00
//import org.nwapw.abacus.plugin.StandardPlugin;
import org.nwapw.abacus.window.Window;
import org.nwapw.abacus.plugin.ClassFinder;
import javax.swing.*;
2017-07-28 11:17:54 -07:00
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
2017-07-24 10:04:00 -07:00
public class Abacus {
private Window mainUi;
private PluginManager manager;
public Abacus(){
init();
}
private void init() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | UnsupportedLookAndFeelException | IllegalAccessException e) {
e.printStackTrace();
}
manager = new PluginManager();
ArrayList<String> names = new ArrayList<>();
2017-07-28 11:17:54 -07:00
try {
ClassFinder classFinder = new ClassFinder();
File pluginFile = new File("plugins");
2017-07-28 11:17:54 -07:00
for(File classes:pluginFile.listFiles()){
if(classes.getName().endsWith(".jar")){
names.addAll(classFinder.addJar(classes));
2017-07-28 11:17:54 -07:00
}
}
for(String name:names){
System.out.println(name);
}
ArrayList<Class> classes = classFinder.getClasses();
for(Class classGet:classes){
manager.addClass(classGet);
}
} catch (IOException | ClassNotFoundException e) {
2017-07-28 11:17:54 -07:00
e.printStackTrace();
}
mainUi = new Window(manager);
mainUi.setVisible(true);
manager.load();
2017-07-28 11:17:54 -07:00
}
2017-07-24 10:04:00 -07:00
public static void main(String[] args){
new Abacus();
2017-07-24 10:04:00 -07:00
}
}