【发布时间】:2021-06-03 07:25:05
【问题描述】:
我想向存储在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) + "");
}
【问题讨论】:
-
您真的应该尝试通过修复格式并提供更好的问题描述来改善您的问题,如果可能的话,甚至是minimal reproducible example。
-
除此之外,看看您的屏幕截图,
JComboBox中的“数字”似乎以“O”而不是“0”开头。这可能是问题所在。 -
为什么不把字符串打印到控制台看看呢?
-
maloomeister,哈哈哈,非常感谢,iv bn 花了一周时间。从来没有想过! O vs 0 哈哈。
-
Gilbert Le Blanc ,我做到了,但没有看到 O 和 0 之间的区别。
标签: java arrays spring performance swing