In a JPanel, I have combobox in order to update the combobox with details. I need to query from backend Database. This makes the entire GUI freeze.
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;
Here Security[] securities = SecurityMaster.getInstance().getData(query, false); is a call to database.
Can anyone please explain how to solve this problem?