I want to display value from variable "activity" to red color, "activity" value I got form MySQL database. Is that possible to set color on String Activity? If it is possible can you show me how to make it?
public void Select()
{
int n = 1;
for (int i = 0; i < numberRow; i++) {
try {
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/atm?zeroDateTimeBehavior=convertToNull", "root", "");
String validate = "SELECT * FROM history WHERE UserActivityID LIKE '" + n + "'";
PreparedStatement smtm = con.prepareStatement(validate);
ResultSet rs = smtm.executeQuery();
if (rs.next()) {
String Time = rs.getString("UserTimeActivity");
String activity = rs.getString("UserActivity");
n++;
jTextAreaActivity.append(activity + " - " + Time + "\n");
}
} catch (SQLException | HeadlessException | ClassCastException ex) {
JOptionPane.showMessageDialog(this, ex);
}
}
}