hi,

i am new to java programming, i do not know anything...
can anybody post a sample program for implementing jeditorpane.
it will be a great help ....

thanks in advance...

Recommended Answers

All 11 Replies

What do you get when you Search or Google ?

thank you for responding,
i did not find a program which displays a weblink which when clicked opens in any browser.. and which is running without errors

What does opening in a browser have to do with the JEditPane class?

evryone on the net says to use jeditorpane
if we can do without jeditorpane..please let me know..this helps me a lot

What is it you want to do?

i want to display a link in jcontent pane or any window and when clicked should be opened in any browser

Thank you for your suggestion. I tried many sample programs but nothing seems to be close to what i want. could you/anyone please give me a sample program which displays a link like www.google.com or any other website address and when clicked opens that page/link in explorer

I don't know if any these will work, but a simple google search turned up these links.
http://www.centerkey.com/java/browser/
http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
http://www.croftsoft.com/library/tutorials/browser/
http://javaxden.blogspot.com/2007/09/launch-web-browser-through-java.html
etc.
Hope one of these will give you what you're looking for.

BTW, my search terms were "java program url launch browser".

Thank you for your reply, i have a question
can we do this by invoking command prompt as below


Here's a simple way you can run Internet Explorer from the command line...

Create a new text file that contains the following line:

@start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" %*

Rename the file e.bat

Copy this file to your profile folder

Quote
C:\Documents and Settings\your_account_name


Now you can open a command prompt window and type the following

e www.trap17.com

Yep, that works too. Assuming you have the batch file as described in your post, the following program will launch the browser with the given URL.

import java.io.*;

public class Test {
    public static void main(String[] args) {
       try {
          Process p = Runtime.getRuntime().exec("e.bat www.trap17.com");
      } catch (Exception e) {
         e.printStackTrace();
      }
   }
}

Note that from the command line you can just say "e www.trap17.com", but from inside the java program you have to say
"e.bat www.trap17.com".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.