Basically my program has a JTabbedPane
and each tab has a JTextPane
in a JScrollPane
. Somehow but always text starts from the bottom. How can I fix that?
I tried to put this, but it didn't work.
JScrollBar vertical = scrollPane.getVerticalScrollBar();
JScrollPane scrollPane = new JScrollPane();
scrollPane.setEnabled(false);
scrollPane.setBounds(10, 36, 973, 492);
panel.add(scrollPane);
JScrollBar vertical = scrollPane.getVerticalScrollBar();
vertical.setValue(vertical.getMaximum());
JTextPane textPane = new JTextPane();
textPane.setEditable(false);
textPane.setFont(new Font("Calibri Light", Font.BOLD, 20));
textPane.setText("blahblahbalhtonsoftexthere");
scrollPane.setViewportView(textPane);