First time writing a GUI in Java
This is it so far, when I click "Coordinate Anomalies" an arraylist of strings is shown in the JTextArea, but the only way to see the text is by highlighting it.
I also tried adding a scroll bar to the JTextArea, but have had no luck.
JTextArea textArea = new JTextArea();
textArea.setBounds(10, 79, 172, 339);
frame.getContentPane().add(textArea);
JButton btnNewButton_1 = new JButton("Coordinate Anomalies");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ArrayList<String> anomalies = vessels.coordinateAnomaly();
JScrollPane jp = new JScrollPane();
jp.setViewportView(textArea);
for (String a : anomalies) {
textArea.append(a + "\n");
}
textArea.setBounds(10, 79, 172, 339);
frame.getContentPane().add(textArea);
}
});
btnNewButton_1.setBounds(10, 45, 172, 23);
frame.getContentPane().add(btnNewButton_1);
This is my code (sorry for jank), can't stress enough that I'm new to GUIs and any advice is really appreciated.