Ejemplo n.º 1
0
 void setMessage(Animator a) {
   anim = a;
   who.setText(a.author());
   ref.setText(a.description());
   pan.remove(last);
   last = a.container();
   pan.add(last, "Center");
   if (T != null) T.interrupt();
 }
Ejemplo n.º 2
0
 boolean tryDir(String d) {
   ClassLoader L = getClass().getClassLoader();
   File p = new File(d, PACKAGE);
   System.out.println("Try " + p);
   if (!p.exists() || !p.isDirectory()) return false;
   for (File f : p.listFiles()) {
     String s = f.getName();
     if (!s.endsWith(".class")) continue;
     String name = s.substring(0, s.length() - 6);
     try {
       Class<?> c = L.loadClass(PACKAGE + "." + name);
       if (!Animator.class.isAssignableFrom(c)) continue;
       Animator a = (Animator) c.newInstance();
       a.container().setPreferredSize(DIM);
       map.put(name, a);
       System.out.println("  " + name);
       // ClassNotFoundException InstantiationException IllegalAccessException
     } catch (Exception e) {
       continue;
     }
   }
   return map.size() > 0;
 }