转换为货币格式

时间:2012-12-13 00:32:05

标签: java

                System.out.print(toLn+toFn+toStr+toC+toSt+toZ+fromLn+fromFn+fromStr+fromC+fromSt+fromZ+beforeN+d+ship+bsize+msg+"\n");
                //add info to addOrder
                double test = manager.addOrder(toLn, toFn, toStr, toC, toSt, toZ, fromLn, fromFn, fromStr, fromC, fromSt, fromZ, beforeN, d, ship, bsize, msg);

                beforeN = false;


                totalField.setText(Double.toString(test));
            }
        }
    }

我遇到的麻烦是totalfield.setText(Double.toString(test))带来的值;是一个值,比方说52.0。它显示52.0但我想要它做的是在TextField中显示$ 52.0。有关如何做的快速建议吗?     }

1 个答案:

答案 0 :(得分:0)

totalField.setText(“$”+ Double.toString(test));