Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在调用“swingWorker.execute”之前,有没有办法将数据(例如对象)传递给 swingWorker?
您应该向 SwingWorker 扩展类添加访问器
SWExtended swe = new SWExtended(); swe.setMethod(newObjectValue); swe.execute();
通常我通过使我的 SwingWorker 的构造函数需要所需的对象来处理这个问题。这样编译器会强迫我记住传递变量。