diff --git a/dist/C41C.jar b/dist/C41C.jar index bc8be32..a572017 100644 Binary files a/dist/C41C.jar and b/dist/C41C.jar differ diff --git a/src/c41c/Window.java b/src/c41c/Window.java index 9dd9f1c..9ed55e2 100644 --- a/src/c41c/Window.java +++ b/src/c41c/Window.java @@ -1140,8 +1140,10 @@ private void BUTTON_AddDigitActionPerformed(java.awt.event.ActionEvent evt) {//G if(!OperationUnderway) { newValue = Value.multiply(new BigInteger(Integer.toString(Base))) .add(new BigInteger(button.getName(), Base)); - if (newValue.compareTo(CurrentMaxInt) < 0) + if (newValue.compareTo(CurrentMaxInt) < 0) { Value = newValue; + changeAllBits(Value); + } } else { if (!SecondOperandEntered) { SecondOperand = BigInteger.ZERO; @@ -1149,8 +1151,10 @@ private void BUTTON_AddDigitActionPerformed(java.awt.event.ActionEvent evt) {//G } newValue = SecondOperand.multiply(new BigInteger(Integer.toString(Base))) .add(new BigInteger(button.getName(), Base)); - if (newValue.compareTo(CurrentMaxInt) < 0) + if (newValue.compareTo(CurrentMaxInt) < 0) { SecondOperand = newValue; + changeAllBits(SecondOperand); + } } refreshTextArea(); @@ -1162,10 +1166,13 @@ private void BUTTON_RemoveDigitActionPerformed(java.awt.event.ActionEvent evt) { if (OperationUnderway && !SecondOperandEntered) return; - if(!OperationUnderway) + if(!OperationUnderway) { Value = Value.divide(new BigInteger(Integer.toString(Base))); - else + changeAllBits(Value); + } else { SecondOperand = SecondOperand.divide(new BigInteger(Integer.toString(Base))); + changeAllBits(SecondOperand); + } refreshTextArea(); }//GEN-LAST:event_BUTTON_RemoveDigitActionPerformed @@ -1175,6 +1182,7 @@ private void BUTTON_ClearCurrentActionPerformed(java.awt.event.ActionEvent evt) Value = BigInteger.ZERO; else SecondOperand = BigInteger.ZERO; + changeAllBits(BigInteger.ZERO); DivisionByZero = false; refreshTextArea(); @@ -1215,6 +1223,11 @@ private void bitSwitch(JLabel bitLabel) { refreshTextArea(); } + private void changeAllBits(BigInteger value) { + for (int i = 0; i < CurrentMaxInt.bitLength(); i++) + LABEL_bitGroup[i].setText(value.testBit(i) ? "1" : "0"); + } + private void testTextArea() { long start=System.currentTimeMillis(); @@ -1277,9 +1290,11 @@ else if (bitNum == 0) CurrentMaxInt = BigInteger.ONE.shiftLeft(bitNum-1); Value = Value.mod(CurrentMaxInt.shiftLeft(1)); Value = adjustForOverflow(Value); + changeAllBits(Value); if(OperationUnderway) { SecondOperand = SecondOperand.mod(CurrentMaxInt.shiftLeft(1)); SecondOperand = adjustForOverflow(SecondOperand); + changeAllBits(SecondOperand); } refreshTextArea(); @@ -1385,6 +1400,7 @@ private void performOperation() { return; } Value = adjustForOverflow(Value); + changeAllBits(Value); refreshTextArea(); }