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中