在JPanel中,我有组合框,以便更新组合框的详细信息。我需要从后端数据库查询。这会使整个GUI冻结。
if (ccyPairs.size() == 0) {
try {
String query = "SELECT * FROM " + PropertyFile.getInstance().getSmfTable() + " WHERE SECURITYTYPE = 4 ";
Security[] securities = SecurityMaster.getInstance().getData(query, false);
for (Security security : securities) {
String Symbol = security.getSymbol();
ccyPairs.add(Symbol);
}
} catch (Exception exception) {
Log.error(getClass().getName(), "getValidSymbols", "Exception occurred while retrieving fx symbols from smf table " + exception.getMessage());
}
return ccyPairs;
}
return ccyPairs;
下面 Security [] securities = SecurityMaster.getInstance()。getData(query,false);是对数据库的调用。
有谁能解释一下如何解决这个问题?