首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Swing中怎么加超链接

2012-12-26 
Swing中如何加超链接final Color linkColor new Color(49, 89, 151)??? ??? ???? ????????? final JLab

Swing中如何加超链接

final Color linkColor = new Color(49, 89, 151);
??? ??? ???? ????????? final JLabel jidLabel = new JLabel("001号商品展示");
??? ??? ???? ????????? jidLabel.setToolTipText("");
??? ??? ???? ????????? jidLabel.addMouseListener(new MouseAdapter() {
??? ??? ???? ???????????? public void mouseClicked(MouseEvent mouseEvent) {

??? ??? ???? ??????????? ??? ?String bd = "http://www.baidu.com";
??? ??? ???? ??????????? ??? try {
//??? ??? ??? ??? ??? ??? ??? ??? Runtime.getRuntime().exec( "C:\\Program?? Files\\Internet?? Explorer\\IEXPLORE.EXE?? "+picurl);?? //这种方式也可以,不过有时候是打不开图的,第二种方式没问题
??? ??? ???? ??????????? ??? ??? Runtime.getRuntime().exec("cmd.exe /c start "+ picurl);
??? ??? ??? ??? ??? ??? ??? } catch (IOException e) {
??? ??? ??? ??? ??? ??? ??? ??? // TODO Auto-generated catch block
??? ??? ??? ??? ??? ??? ??? ??? e.printStackTrace();
??? ??? ??? ??? ??? ??? ??? }
??? ??? ???? ???????????? }
??? ??? ???? ???????? });

??? ??? ???? ???????? add(jidLabel); //把Label添加到Panel中

热点排行