Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Java
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);


What I have tried:

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?
Posted
Updated 26-Apr-21 22:20pm
v2

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900