当试图宣布一个新的ObservableList:
ObservableList<Account> userAccounts = new FXCollections.observableArrayList();
我收到一个错误observableArrayList();,上面写着:
找不到符号,符号:class
observableArrayList,location:classFXCollections.
这是我的import语句
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
Run Code Online (Sandbox Code Playgroud)
这是我的方法
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;
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么,为什么我不能申报新的ObservableList …