在jlist中创建新行

时间:2013-03-24 23:07:31

标签: java swing netbeans newline jlist

代码:

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

这将是列表中的一个元素

(抱歉不能把图片放到代表处)

0 个答案:

没有答案