简体   繁体   中英

Converting to Currency format

                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));
            }
        }
    }

The trouble i am having is that the value that is brought forth by totalfield.setText(Double.toString(test)); is a value, lets say 52.0. Its displaying 52.0 but what i want it to do is display $ 52.0 in the TextField. Any quick suggestions as to how to do it? }

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM