mercredi 22 avril 2015

java - retrive class loaded inside method?

class test{
     void method(){
          javax.swing.JOptionPane.showMessageDialog(null,"test");
     }
}

I don't know it's asked before or not.
how to get class javax.swing.JOptionPane?
i have been using reflection

Class cls=Class.forName("test");
Field[]field=cls.getDeclaredFields();
for(Field f : field)
{
    System.out.println(f.getName());
}

but, it doesn.t print anithing.





Aucun commentaire:

Enregistrer un commentaire