我想发送短信到号码存储在一个 JComboBox
但不工作会使系统冻结。但是从中获取电话号码 JTextField
正在工作,但从组合框中获取不起作用,并引发以下错误:
15:12:54.672 [AWT-EventQueue-0] ERROR smslib - GTW: : CMS Error 500:
Quit retrying, message lost...
短信发送者应用
AbstractTester at = new AbstractTester() {
@Override
protected void test() throws Exception {
throw new UnsupportedOperationException("Not supported yet.");
}
};
OutboundNotification outboundNotification = at.new OutboundNotification();
SerialModemGateway gateway = new SerialModemGateway("", cmbPorts.getSelectedItem().toString(), 9600, "", "");
gateway.setInbound(true);
gateway.setOutbound(true);
Service.getInstance().setOutboundMessageNotification(outboundNotification);
Service.getInstance().addGateway(gateway);
Service.getInstance().startService();
for (int i = 0; i < cmbNumbers.getItemCount(); i++) {
OutboundMessage msg = new OutboundMessage(cmbNumbers.getItemAt(i), smsArea.getText());
Service.getInstance().sendMessage(msg);
txtAreaLog.append(msg.toString());
Service.getInstance().stopService();
Service.getInstance().removeGateway(gateway);
JOptionPane.showMessageDialog(null, "Your Message has been sent successfully to:" + cmbNumbers.getItemAt(i) + "");
}
1条答案
按热度按时间jgovgodb1#
将for循环更改为:
对于(int i=0;i<cmbnumbers.getitemcount();i++)
如下所述:
对于(int i=0;i<=cmbnumbers.getitemcount()-1;i++)
您的for循环声明中似乎存在一些问题。