Hello everyone, I have such a complexity, it should save in arrayList , but it does not save due to the type mismatch, or what ... Please tell me what could be the matter?
button1.addActionListener(new ActionListener() {@Override public void actionPerformed(ActionEvent e) { Model model = new Model(); model.setTovarList(textField1.getText()); // Ошибка try { dbHalper.writeModel(model); // добавили пользователя в базу данных } catch (Exception e1) public class Model { ArrayList < Saless > salessArrayList = new ArrayList < Saless > (); public ArrayList < Saless > getSalessArrayList() { return salessArrayList; } public void setSalessArrayList(ArrayList < Saless > salessArrayList) { this.salessArrayList = salessArrayList; } ArrayList < Tovar > tovarList = new ArrayList < Tovar > (); {} public ArrayList < Tovar > getTovarList() { return tovarList; } public void setTovarList(ArrayList < Tovar > tovarList) { this.tovarList = tovarList; } ArrayList < Saler > salerArrayList = new ArrayList < Saler > (); public ArrayList < Saler > getSalerArrayList() { return salerArrayList; } public void setSalerArrayList(ArrayList < Saler > salerArrayList) { this.salerArrayList = salerArrayList; } public Model() {} public Model(ArrayList < Saless > salessArrayList, ArrayList < Tovar > tovarList, ArrayList < Saler > salerArrayList) { this.salessArrayList = salessArrayList; this.tovarList = tovarList; this.salerArrayList = salerArrayList; } } public class Tovar { int price; public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public Tovar() {} public Tovar(int price) { this.price = price; } public void priceTovar() { price = price + 100; } } Information: 05/09/2015 9:20 - Compilation completed with 1 error and 0 warnings in 25 sec
Error: (32, 54) java: incompatible types: java.lang.String cannot be converted to java.util.ArrayList
C: \ Users \ Andrey \ IdeaProjects \ TSSDB \ src \ Form2.java
Information: java: Errors occurred while compiling module 'TSSDB'
Information: java: Some messages have been simplified; recompile with -
Xdiags: verbose to get full output
Information: Using javac 1.8.0_40 to compile java sources
Modelclass code should be given - Timofei Bondarev