绑定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();
}
}
});