绑定IP按钮加个事件相应呗,然后调用CMD命令执行,如下可参考:
jb4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String strCmd="cmd /c route add "+jt1.getText()+" mask "+jt2.getText()+" "+jt3.getText();
JOptionPane.showMessageDialog(null, strCmd);
try {
Runtime.getRuntime().exec(strCmd);
} catch (IOException ex) {
ex.printStackTrace();
}
}
});
jb4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String strCmd="cmd /c route add "+jt1.getText()+" mask "+jt2.getText()+" "+jt3.getText();
JOptionPane.showMessageDialog(null, strCmd);
try {
Runtime.getRuntime().exec(strCmd);
} catch (IOException ex) {
ex.printStackTrace();
}
}
});
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货