when trying to declare a new ObservableList
:
ObservableList<Account> userAccounts = new FXCollections.observableArrayList();
I am getting an error at observableArrayList();
which says:
cannot find symbol, symbol: class
observableArrayList
, location: classFXCollections
.
Here are my import statements
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
And here is my method
public ObservableList<Account> getUsersAccounts(int memberID) {
ObservableList<Account> userAccounts = new FXCollections.observableArrayList();
try {
Statement stmt = conn.createStatement();
String sql = "SELECT * FROM account WHERE member_id='" + memberID + "'";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()) {
Account account = new Account(rs.getInt("member_id"), rs.getString("account_type"), rs.getDouble("balance"));
userAccounts.add(account);
}
} catch (SQLException ex) {
Logger.getLogger(JDBCManager.class.getName()).log(Level.SEVERE, null, ex);
}
return userAccounts;
}
What am I missing, why can't I declare a new ObservableList
?
change
ObservableList<Account> userAccounts = new FXCollections.observableArrayList();
to
ObservableList<Account> userAccounts = FXCollections.observableArrayList();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With