mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
getContentPane().add(mainPanel);
}
private JPanel createButtonPanel() {
final Desktop desktop = Desktop.getDesktop();
JPanel buttonPanel = new JPanel(new GridLayout(1, 3, 10, 10));
AbstractAction openBrowserAction = new AbstractAction("Show in browser") {
@Override
public void actionPerformed(ActionEvent event) {
try {
desktop.browse(reportFile.getAbsoluteFile().toURI());
} catch (IOException e) {
throw new IllegalStateException("Failed showing reportFile (" + reportFile
+ ") in browser.", e);
}
finishDialog();
}
};
openBrowserAction.setEnabled(desktop.isSupported(Desktop.Action.BROWSE));
buttonPanel.add(new JButton(openBrowserAction));
AbstractAction openFileAction = new AbstractAction("Show in files") {
@Override
public void actionPerformed(ActionEvent event) {
try {
desktop.open(reportFile.getParentFile());
} catch (IOException e) {
throw new IllegalStateException("Failed showing reportFile (" + reportFile
+ ") in file explorer.", e);
}
finishDialog();
}
};
openBrowserAction.setEnabled(desktop.isSupported(Desktop.Action.OPEN));
buttonPanel.add(new JButton(openFileAction));
AbstractAction closeAction = new AbstractAction("Ok") {
@Override
public void actionPerformed(ActionEvent e) {