mercredi 8 novembre 2017

NoSuchMethod exception with Reflection

I am trying to call a swing panel from a jar using reflection this is the code

public class coolUI extends JPanel{

public coolUI{

   //swing code here ( made by windowbuilder )

 }
}

Here is the code that i use to call it from

String className = "plugins.plugin1.coolUI";
Class UI = cl.loadClass(className);         
Method theUI = UI.getMethod("coolUI");
Object a = UI.newInstance();
theUI.invoke(a, null);

What i am trying to do here is to load a jar, and to attach the UI inside the jar into a tabbedpane, though i can do this without reflection, i have no idea on how to do this with it.





Aucun commentaire:

Enregistrer un commentaire