• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Swings & HTML

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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....
thanx
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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. http://www.altavista.com

try {
URL url = new URL(address);
AppletContext context = getAppletContext();
context.showDocument(url);
} catch(MalformedURLException exc)
{ System.out.println("URL wrong !!!\n"); }
}
}
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi try this code !! it works !!!
public void acionPerformed(ActionEvent ae) {
if(ae.getSource()==jb)
{
Runtime r = Runtime.getRuntime();
Process p = null;
try
{
p = r.exec("C:/Program Files/Internet Explorer/iexplore www.eye4u.com");
}
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
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...
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 www.eye4u.com. Similarly u give the path of ur html file.
alright ?? clear ??? byeee....
-Vinod
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"vandana",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . 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.
Thanks.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic