Here I am providing the downloadable code link of the java code I have used in the video
"Java prog#23.How to open any document e.g .pdf, .doc ,.png file from By a jbutton or jmanu NetBeans" of my YouTube channel ProgrammingKnowledge
Click Link to watch the video LINK
This code below is for the HelpActionPerformed method action perform
private void HelpActionPerformed(java.awt.event.ActionEvent evt) {
try //try statement
{
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+"C:\\Users\\FilePath\\Frequently Asked Questions.pdf");
} catch (Exception e) //catch any exceptions here
{
JOptionPane.showMessageDialog(null,"Error"); //print the error
}
}
0 comments:
Post a Comment