我正在尝试通过单击 GUI 按钮来显示小数点。我使用下面的方法,它适用于数字但不适用于小数点。任何建议都会很棒。谢谢
private void displayWeightedquantity(ActionEvent event){
JButton currentButton = null;
JButton[] numberButtonsarray = {bnDecimal,bnZero,bnOne, bnTwo, bnThree, bnFour, bnFive,bnSix,bnSeven,
bnEight,bnNine};
currentButton = (JButton)event.getSource();
for (int i = 0; i <numberButtonsarray.length; i++){
if (currentButton == numberButtonsarray[i]){
lbDisplayitemQty.setText(lbDisplayitemQty.getText() + currentButton.getText());
break;
}
}
}
我的虚拟数字键盘: