我想要的是,当用户单击按钮时,输入或从任何地方删除的数据进入Textbox
数组JList
列表。
我不想建数据库!我只想在用户使用应用程序时存储数据。什么都试过了,好像事件按钮有一定的难度,代码不要太认真,只是用来分析的。
重要的是通过按下按钮将数据写入数组。前任:
btnSaveToArray.addActionListener (new ActionListener () {
public void actionPerformed (ActionEvent e) {
ArrayList recordArray=new ArrayList();
// This variable receiveList, receives value a given selected from a JList, is far from good.
String receiveList = userList.getSelectedValue().toString();
// The variable recordArray capture this value, the goal is that this variable store it.
recordArray.add(receiveList);
// these two lines to see if I recorded the same roof but're angry, it just returns me one record element.
System.out.println(recordArray.toString());
// these two lines to see if I recorded the same roof but're angry, it just returns me one record element.
System.out.println(recordArray.size());
}
我试图打印出数组的内容,以查看是否记录了用户输入,但它没有打印出任何内容。