src/main/java/com/xdavide9/calculatorfx/CalculatorFXController.java
@FXML
    protected void onPlusMinusPressed(ActionEvent e) {
        id = updateId(e);
        log.info("Pressed: {}", id);

        onLabel = label.getText();
        if (status(onLabel) == -1) return;

        if (onLabel.equals("0"))
            return;

        BigDecimal value = new BigDecimal(onLabel);
        value = value.multiply(new BigDecimal("-1"));
        value = stripDecimalTrailingZeros(value);

        onLabel = String.valueOf(value);
        builder = new StringBuilder();
        builder.append(onLabel);

        if (hasTooManyDigits(onLabel.length())) {
            log.error("Result had too many digits");
            displayErr();
            return;
        }

        label.setText(onLabel);
    }
/**
     * Changes the sign of the number in label.
     */
Changes the sign of the number in label.
Changes the sign of the number in label .
@FXML
    protected void onPlusMinusPressed(ActionEvent e) {
        id = updateId(e);
        log.info("Pressed: {}", id);
        onLabel = label.getText();
        if (status(onLabel) == -1) return;
        if (onLabel.equals("0"))
            return;
        BigDecimal value = new BigDecimal(onLabel);
        value = value.multiply(new BigDecimal("-1"));
        value = stripDecimalTrailingZeros(value);
        onLabel = String.valueOf(value);
        builder = new StringBuilder();
        builder.append(onLabel);
        if (hasTooManyDigits(onLabel.length())) {
            log.error("Result had too many digits");
            displayErr();
            return;
        }
        label.setText(onLabel);
    }
@ FXML protected void onPlusMinusPressed ( ActionEvent e ) { id = updateId ( e ) ; log . info ( "Pressed: {}" , id ) ; onLabel = label . getText ( ) ; if ( status ( onLabel ) == - 1 ) return ; if ( onLabel . equals ( "0" ) ) return ; BigDecimal value = new BigDecimal ( onLabel ) ; value = value . multiply ( new BigDecimal ( "-1" ) ) ; value = stripDecimalTrailingZeros ( value ) ; onLabel = String . valueOf ( value ) ; builder = new StringBuilder ( ) ; builder . append ( onLabel ) ; if ( hasTooManyDigits ( onLabel . length ( ) ) ) { log . error ( "Result had too many digits" ) ; displayErr ( ) ; return ; } label . setText ( onLabel ) ; }
Changes the sign of the number in label.
Changes the sign of the number in label .