How to start default browser when clicking on a label  
Author Message
Helmut Tessarek





PostPosted: 2005-11-28 7:45:00 Top

java-programmer, How to start default browser when clicking on a label Hi,

I was wondering how I can implement a JLabel that references to a http link.
When I click that label the default browser should open and loading the webpage.
This is for a JDialog 'About' window.
I've seen this several times, but I've no idea how to implement this with
Java/Swing.

Regards,
Helmut
 
IchBin





PostPosted: 2005-11-28 12:03:00 Top

java-programmer >> How to start default browser when clicking on a label Helmut Tessarek wrote:
> Hi,
>
> I was wondering how I can implement a JLabel that references to a http link.
> When I click that label the default browser should open and loading the webpage.
> This is for a JDialog 'About' window.
> I've seen this several times, but I've no idea how to implement this with
> Java/Swing.
>
> Regards,
> Helmut

There is a free Java program out there called BrowserLauncher. It is
free for commercial and non-commercial use, and may be modified nearly
to your heart's content.

Find at http://browserlauncher.sourceforge.net/

Here is how I have invoked it under a button.

private void jLinkButton_actionPerformed() {
try {
BrowserLauncher.openURL(AppData.getOpenLink());
System.out.println("BrowserLauncher.openURL(" +
AppData.getOpenLink() + ")");
} catch (IOException e) {
AppError.errorMessage(e);
}
}
--


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
Helmut Tessarek





PostPosted: 2005-11-28 17:07:00 Top

java-programmer >> How to start default browser when clicking on a label Hi IchBin,

IchBin wrote:

> There is a free Java program out there called BrowserLauncher. It is
> free for commercial and non-commercial use, and may be modified nearly
> to your heart's content.
>
> Find at http://browserlauncher.sourceforge.net/
>
> Here is how I have invoked it under a button.
>
> private void jLinkButton_actionPerformed() {
> try {
> BrowserLauncher.openURL(AppData.getOpenLink());
> System.out.println("BrowserLauncher.openURL(" +
> AppData.getOpenLink() + ")");
> } catch (IOException e) {
> AppError.errorMessage(e);
> }
> }

Thanks. Sounds good. I will have a look at sf.

Thanks again,
Helmut
 
 
hiwa





PostPosted: 2005-11-28 18:42:00 Top

java-programmer >> How to start default browser when clicking on a label Helmut Tessarek 銇儭銉冦偦銉笺偢:

> Hi,
>
> I was wondering how I can implement a JLabel that references to a http link.
> When I click that label the default browser should open and loading the webpage.
> This is for a JDialog 'About' window.
> I've seen this several times, but I've no idea how to implement this with
> Java/Swing.
>
> Regards,
> Helmut
java.awt.Desktop#browse(URI) since JDK 1.6.

 
 
Andrew Thompson





PostPosted: 2005-12-8 8:47:00 Top

java-programmer >> How to start default browser when clicking on a label Helmut Tessarek wrote:
> IchBin wrote:
>
>>There is a free Java program out there called BrowserLauncher.
...
> Thanks. Sounds good. ..

Is good. I've used it for a number of projects. It is
astoundingly boring (i.e. good) in the straightforward,
effortless way it opens the user's browser, and points
it to an URL.

(Oh, and you could add a mouselistener to your label,
try Googling the groups for LinkLabel or such..)

--
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew