我到处都找到了这个解决方案,但不幸的是我遇到了错误。
browser.set(StartDownloadCallback.class, (params, tell) -> {
System.out.println("Download");
params.download().on(DownloadFinished.class, event ->
System.out.println("File downloaded!"));
tell.download(createTempDir().toAbsolutePath());
});
error: method set in interface Advisable<P> cannot be applied to given types;
browser.set(StartDownloadCallback.class, (params, tell) -> tell.close());
^
required: Class<C>,C
found: Class<StartDownloadCallback>,(params,te[...]ose()
reason: inference variable C has incompatible bounds
equality constraints: StartDownloadCallback
lower bounds: BrowserCallback
where C,P are type-variables:
C extends BrowserCallback declared in method <C>set(Class<C>,C)
P extends Callback declared in interface Advisable
最佳答案
问题出在 JxBrowser 的版本上。 升级到7.8后就可以使用了。
关于java - JxBrowser 7.7 SWT - StartDownloadCallback 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62320179/