I am new to GUI and I am trying to print a table in a database on the GUI window, I used the JTextArea in order to allow new lines on the window.
However, when the GUI shows up, I can easily erase them with my cursor! How can I prevent that?
String toPrintOnGUI = "";
while (resultSet.next()) {
for (int i = 1; i <= columnsNumber; i++) {
toPrintOnGUI += (resultSet.getString(i) + " \t");
}
toPrintOnGUI = toPrintOnGUI.substring(0, toPrintOnGUI.length() - 1);
toPrintOnGUI += "\n";
}
JTextArea label = new JTextArea(toPrintOnGUI);
label.setBackground(Color.WHITE);
panel.add(label);
frame.setVisible(true);