0

代码:

String key = stockNo.getText();
String quantityTxt = quantity.getText();
String info = "\n\nName: " + StockData.getName(key) + 
                "\nPrice: £" + (StockData.getPrice(key)) + 
                "\nNumber in stock: " + StockData.getQuantity(key) +
                "\nNumber to buy: " + quantityTxt;
information.append(info);

输出 jlist,我放了 \n 但似乎不起作用

key:33nameTshirtprice: £10.00number in stock:37number to buy:1
key:55nameshirtprice: £5.00number in stock:12number to buy:1

我怎么会得到它,

key:33
name: Tshirt                 (image will go here)
price: £10
number in stock: 37
number bought 1

等这将是列表中的一个元素

(抱歉,由于代表不能放图片)

4

0 回答 0