更新时间:2022-06-11 00:16:11
ActionListener listener = new MyListener();
butt.addActionListener(listener);
在我的监听器中添加此
if (Desktop.isDesktopSupported()) {
try {
File myFile = new File( "path/to/file");
Desktop.getDesktop().open(myFile);
} catch (IOException ex) {
// no application registered for PDFs
}
}