从SwingWorker调用反射方法

时间:2012-03-26 18:41:20

标签: java reflection swingworker

我有一个JFrame框架,它调用SwingWorker来执行I / O操作(比如复制目录中的所有文件) 在SwingWorker的doInBackground()方法中,我使用Reflection来调用执行I / O操作的方法

E.g:

    protected StringBuilder doInBackground() throws Exception {
            ...
    try {
    Class cl = ReconClient1.class;
    java.lang.reflect.Method method = cl.getMethod(invokeMethod);
    Object obj = method.invoke(client);
            ...
    } catch(Exception e) { 
        System.out.println(e.getMessage());
    }
        return ...;
    }

我希望逐步获取调用方法的输出(例如,在复制每个文件之后) 这可能吗?

0 个答案:

没有答案