My first attempt at using JScrollPane with JTextArea is not going to plan -
JFrame window = new JFrame("Scroll test"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setResizable(false); window.setLayout(null); window.setVisible(true); window.setBounds(500, 200, 700, 700); JTextArea textArea = new JTextArea(5,30); textArea.setBounds(18, 0, 682, 500); textArea.setEditable(false); JScrollPane textScroll = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); textScroll.setBounds(0, 0, 18, 500); window.add(textScroll);
Basically, I get this scrollpane on the left side, but it does not contain one of those blocks that you can drag even when I fill the text area with shit, so it expands beyond ... Thanks
source share