Runtime.getRuntime().exec("D:\Program Files\Tencent\QQ\Bin\QQ.exe");//设置为LZ的qq路径
-
import java.awt.event.MouseAdapter;
-
import java.awt.event.MouseEvent;
-
import java.io.IOException;
-
import javax.swing.JButton;
-
import javax.swing.Jframe;
-
import javax.swing.JPanel;
-
public class MoveMessageDemo extends JPanel {
-
private JButton button = new JButton();
-
public MoveMessageDemo() {
-
button.setText("Call the QQ");
-
button.addMouseListener(new MouseAdapter() {
-
public void mousePressed(MouseEvent e) {
-
// TODO Auto-generated method stub
-
try {
-
Runtime.getRuntime().exec("D:\Program Files\Tencent\QQ\Bin\QQ.exe");
-
} catch (IOException e1) {
-
// TODO Auto-generated catch block
-
e1.printStackTrace();
-
}
-
}
-
});
-
add(button);
-
}
-
public static void main(String[] args) {
-
Jframe frame = new Jframe();
-
frame.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
-
frame.setTitle("MoveMessageDemo");
-
frame.getContentPane().add(new MoveMessageDemo());
-
frame.setSize(200, 100);
-
frame.setVisible(true);
-
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)