I have a text area that updates a button press (this updating works fine). When it updates, a long list appears in the text area that requires a scroll bar. However, when I add the last two lines below, not only does the scroll bar not appear, text doesn't appear as well. How do I fix this? (I'm new to java swing so the simpler the answer the better)
textArea1 = new JTextArea("");
textArea1.setBounds(450, 40, 400, 700);
frame.getContentPane().add(textArea1);
JScrollPane scroll = new JScrollPane(textArea1);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
You add the
JScrollPaneto theJFrame.Oracle has a helpful tutorial, Creating a GUI With Swing. Skip the Learning Swing with the NetBeans IDE section.
You should be using Swing layout managers, rather than
setBounds.