Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Observable List

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: class FXCollections.

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?

like image 470
fr33zex Avatar asked Dec 11 '22 08:12

fr33zex


1 Answers

change

ObservableList<Account> userAccounts = new FXCollections.observableArrayList();

to

ObservableList<Account> userAccounts = FXCollections.observableArrayList();
like image 196
parsa Avatar answered Jan 03 '23 16:01

parsa