URL Linkage

Hi I would like to know how to like … when you press a button or a JButton in your program, then it will open your computer default internet explorer that the URL is stated within the button…

my brother insisit that it is supposed to using the package URI instead of the package URL… so I am abit confused…

but it seems that my brother’s program works well with both URI and URL…

can someone explain?

Your brother is kind of wrong:

URI -> Uniform Resource Identifier
URL -> Uniform Resource Locator

A URI is for identification purpose and does not have to point to an existing resource.
A URL is the actual adress of a resource.

However it’s kind of pointless to debate, since both look the same for an existing resource:
A URL is always a URI while a URI is not necessarily a URL :slight_smile:


To start the default-browser of a system use the Desktop class of the Java Desktop Integration Components (JDIC)

oh ok…

but then i have a question… how do make the button link to a url on the internet?

for example i open a program… then when i press the button on the program it opens this website : http:java.sun.com

is this posssible?

Have you actually read my post? ::slight_smile:

If you have problems using buttons, see How to Use Buttons of Creating a GUI with JFC/Swing

I have read the links you provided but i can’t seem to get the concept or at least how to do it…

it only shows the concept of how to get the URL from the web… or any kind of data from the web… instead of displaying the actual URL on the internet explorer. :-[

Do you have other links? or other soures of help… ?

You should read the Desktop class’ API again. More specifically the browse method.
If you don’t know these concepts already, you will need to find information on calling static methods and using 3rd party libraries with your application.

Cheers,
Brett

ok … i will take note… :smiley: