Can JMenuItem point to a HTML file that opens in IE?
I want the jMenuItem (E.g: Tutorial Help) to point to tutorial.html on my computer.
Couldn't find any information about it at all on the net. Can any kind souls out there help me?
Your help is greatly appreciated.
Thank you.
You mean, how can you open up a url from a java program?
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
erm. ya. sort off. But mine is an application. I just want the link to point to a HTML file. Can it be done?
Pardon me if it can't be done.
Thanks!
Oh i see, you mean like how can java execute an external process, such as notepad, or in your case a .html file?
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
/*
* ped.java
*
* Created on 29 April 2006, 17:07
*/
import java.awt.*;
import java.io.*;
import java.util.*;
public class ped {
public static void main(String[] args) throws Exception {
try
{
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("notepad.exe");
}
catch(Exception e)
{
}
}
}
That opens notepad, although I'm not sure how to open explorer? But I reckon it's pretty close...
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
But why do it like that?
Why not embed a web browser control in a Java window?
If simple HTML 3.0 is enough you can use standard controls for that, else you might have to find something on the web (or get creative and write your own HTML parser).
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337