Source code: com/memoire/dnd/DndLib.java
1 /**
2 * @modification $Date: 2002/12/16 18:56:25 $
3 * @statut unstable
4 * @file DndLib.java
5 * @version 0.36
6 * @author Guillaume Desnoix
7 * @email guillaume@desnoix.com
8 * @license GNU General Public License 2 (GPL2)
9 * @copyright 1998-2001 Guillaume Desnoix
10 */
11
12 package com.memoire.dnd;
13
14 import java.awt.*;
15 //import java.awt.event.*;
16 //import java.beans.*;
17 //import java.io.*;
18 import java.lang.reflect.*;
19 import java.util.*;
20
21 //import javax.swing.*;
22 //import com.memoire.dnd.*;
23
24 public class DndLib
25 {
26 public static final Window[] getAllWindows()
27 {
28 Vector v=new Vector();
29
30 try
31 {
32 //Frame[] frames=Frame.getFrames();
33 Class c=Frame.class;
34 Method m=c.getMethod("getFrames",new Class[0]);
35 Frame[] f=(Frame[])m.invoke(null,new Object[0]);
36 for(int i=0;i<f.length;i++)
37 if(!v.contains(f[i]))
38 {
39 v.addElement(f[i]);
40 //Window[] w=f[i].getOwnedWindows();
41 m=f[i].getClass().getMethod("getOwnedWindows",new Class[0]);
42 Window[] w=(Window[])m.invoke(f[i],new Object[0]);
43 for(int j=0;j<w.length;j++)
44 if(!v.contains(w[j]))
45 {
46 //System.err.println("W<--"+w[j]);
47 v.addElement(w[j]);
48 }
49 }
50 }
51 catch(Throwable th) { System.err.println(th); }
52
53 int l=v.size();
54 Window[] r=new Window[l];
55 for(int i=0;i<l;i++) r[i]=(Window)v.elementAt(i);
56 return r;
57 }
58
59 public static final String[] FU_CLASSES=new String[]
60 {
61 "com.memoire.dnd.DndLib",
62 };
63 }