|
|
HTML link or Hyperlink in a Java Panel
Does any expert out there know how to create a HTML link or Hyperlinnk in a
Java Panel (ie, JPanel and etc.)?
Given that, an user is able to click on the HTML link on the panel and the
webpage will be launched on the system default browser (ie, IE).
It is greatly appreciated if anyone could give me a hand on this. Thanks in
advance!!!
|
|
0
|
|
|
|
Reply
|
gundamseed
|
2/24/2004 4:21:46 AM |
|
> Does any expert out there know how to create a HTML link or Hyperlinnk in
a
> Java Panel (ie, JPanel and etc.)?
any JButton with appropriate ActionListener can do it.
> Given that, an user is able to click on the HTML link on the panel and the
> webpage will be launched on the system default browser (ie, IE).
>
see http://browserlauncher.sourceforge.net/
example:
import edu.stanford.ejalbert.BrowserLauncher;
class HtmlButton extends JButton {
Color fg0 = ...;
Color fg1 = ...;
public HtmlButton(String text, String url) {
setText(text);
setActionCommand(url);
addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
BrowserLauncher.openURL(getActionCommand());
}
});
//make it look like a link in browser
setMargin(new Insets(0,0,0,0));
setBorder(new EmptyBorder(0,0,0,0));
addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent e) {
setForeground(fg0);
}
public void mouseExited(MouseEvent e) {
setForeground(fg1);
}
});
}
}
____________
http://reader.imagero.com the best java image reader.
|
|
0
|
|
|
|
Reply
|
ak
|
2/24/2004 7:33:46 AM
|
|
"gundamseed" ...
> Does any expert out there
Where? You have multi-posted this
to several groups. Do _not_ mulit-post.
(Grrrr)
--
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology
|
|
0
|
|
|
|
Reply
|
Andrew
|
2/24/2004 1:29:41 PM
|
|
|
2 Replies
478 Views
(page loaded in 0.055 seconds)
|
|
|
|
|
|
|
|
|