怎么在jlabel 上点下就到指定的一个网址 ?? 怎么在jlabel 上点下就到指定的一个网址 ?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.awt.Cursor;import java.awt.EventQueue;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.io.IOException;import javax.swing.JFrame;import javax.swing.JLabel;public class Test extends JFrame { /** * Launch the application * * @param args */ public static void main(String args[]) { EventQueue.invokeLater(new Runnable() { public void run() { try { Test frame = new Test(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame */ public Test() { super(); getContentPane().setLayout(null); setBounds(100, 100, 500, 375); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JLabel label = new JLabel(); label.addMouseListener(new MouseAdapter() { public void mouseClicked(final MouseEvent e) { String cmd = "rundll32 url.dll, FileProtocolHandler " + label.getText().trim(); try { Process p = Runtime.getRuntime().exec(cmd); } catch (IOException e1) { e1.printStackTrace(); } } }); label.setText("http://www.baidu.com"); label.setCursor(new Cursor(Cursor.HAND_CURSOR)); label.setBounds(80, 102, 281, 32); getContentPane().add(label); // }} blowfish解密密钥长度修改 关于vector的问题,求助!!!!!!!!! 关于等待窗口的问题 那位有java Swing C/S架构(含源码,数据库,设计说明)的系统; 急需要!谢谢! JSP 再来几个题帮我做一下 如何使树型视图内容对换,急!!!` 字符串转成date类型(字符串有什么硬性要求) 关于右键菜单的问题 请各位帮我解决关于JBUILDER4的一些问题! 用算法这样一个程序怎么实现呢? 异常问题,大家帮忙解决一下,先谢谢了
import java.awt.Cursor;
import java.awt.EventQueue;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;import javax.swing.JFrame;
import javax.swing.JLabel;public class Test extends JFrame { /**
* Launch the application
*
* @param args
*/
public static void main(String args[]) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Test frame = new Test();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} /**
* Create the frame
*/
public Test() {
super();
getContentPane().setLayout(null);
setBounds(100, 100, 500, 375);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JLabel label = new JLabel();
label.addMouseListener(new MouseAdapter() {
public void mouseClicked(final MouseEvent e) {
String cmd = "rundll32 url.dll, FileProtocolHandler "
+ label.getText().trim();
try {
Process p = Runtime.getRuntime().exec(cmd);
} catch (IOException e1) {
e1.printStackTrace();
} }
});
label.setText("http://www.baidu.com");
label.setCursor(new Cursor(Cursor.HAND_CURSOR));
label.setBounds(80, 102, 281, 32);
getContentPane().add(label);
//
}}