JButton ayuda=new JButton("Ayuda");
//EVENTO DEL BOTON
ayuda.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evento) {
try {
// Inicia el JFileChooser
JFileChooser fc = new JFileChooser();
// Se crea un filtro de extensiones para que solamente pueda seleccionar archivos PDF
FileFilter ff = new FileNameExtensionFilter("Archivo PDF","pdf");
// Se asigna el filtro al objeto JFileChooser
fc.setFileFilter(ff);
// Se muestra la ventana de JFilChooser
fc.showOpenDialog(null);
// Se asigna el archivo seleccionado a un objeto tipo File
File archivoPDF = fc.getSelectedFile();
// Se sustituye la ruta por la ruta absoluta obtenida del objeto File
Process p = Runtime.getRuntime().exec ("rundll32 SHELL32.DLL,"
+ "ShellExec_RunDLL " + archivoPDF.getAbsolutePath());
} catch (Exception evvv) {
JOptionPane.showMessageDialog(null, "No se puede abrir el archivo de ayuda,"
+ " probablemente fue borrado","ERROR",JOptionPane.ERROR_MESSAGE);
}
}
//BY C3TIN@
//Edit by @carope9
});