File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Swings & HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Swings & HTML" Watch "Swings & HTML" New topic

Swings & HTML


Joined: Mar 29, 2001
Posts: 13
hi folks,
i am making a Help for my sw. I am using Java script for it. I hv made a GUI for my sw. On this GUi i hv a Help menuitem. this menuitem whn clked shd open a browser in wch i hv my help in document form. there r many hyperlinks wthin my help document.
can any one pl. suggest me tht wthr is it posible for me to invoke a internet browser kind of thing frm action listener of a button.
pl reply at ur earliest....
Ana Mihailescu

Joined: Apr 26, 2001
Posts: 29
This example is part of an applet. If the "conex" button is pressed, it opens a new browser window, for the given url.
public void actionPerformed(ActionEvent e)
String comanda=e.getActionCommand();
if (comanda.equals("conex"))
String address=t.getText();
// eg.

try {
URL url = new URL(address);
AppletContext context = getAppletContext();
} catch(MalformedURLException exc)
{ System.out.println("URL wrong !!!\n"); }
vinod ac

Joined: Jul 08, 2001
Posts: 9

Hi try this code !! it works !!!
public void acionPerformed(ActionEvent ae) {
Runtime r = Runtime.getRuntime();
Process p = null;
p = r.exec("C:/Program Files/Internet Explorer/iexplore");
catch(Exception e)
System.out.println("Error opening Internet Explorer...");
jb -> Object of class JButton
Runtime & Process are in java.lang Package. So u need not import the java.lang package
vinod ac

Joined: Jul 08, 2001
Posts: 9
I have misspelled actionPerformed as acionperformed
So plz correct it.
Actually u can run any exe file like notepad,mspaint etc... provided u give the correct path.
While giving the path be careful !!!
u must use forward slash(/) and not backward slash(\)
While running the Internet Explorer give the path of iexplore.exe file and pass the path of ur html file as an arguement.
In the code that i have given, internet explorer will open and will start downloading Similarly u give the path of ur html file.
alright ?? clear ??? byeee....
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: Swings & HTML
It's not a secret anymore!