+1 to HFOE comments
Never mind the code inside
The reason we do mind the code inside:
This seems to work fine for me as I dont have your code I simulated what I though you have in its simplest form.
Simply JPanel
class which holds a single JTextArea
with 70 rows and 20 columns, each is given a number by simple append(..)
on normal size and maximize number of rows dont seems to change
(this one was too big for a full unresized screen shot)
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
public class Test {
public Test() {
createAndShowGui();
}
private void createAndShowGui() {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
MyPanelTextAreas panelWithTextAreas = new MyPanelTextAreas();
JScrollPane jsp = new JScrollPane(panelWithTextAreas);
jsp.setPreferredSize(new Dimension(500, 400));//dont want it too big
frame.add(jsp);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new Test();
}
});
}
}
class MyPanelTextAreas extends JPanel {
JTextArea area = new JTextArea(70, 20);
public MyPanelTextAreas() {
setLayout(new BorderLayout());
add(area);
for (int i = 1; i <= 70; i++) {
area.append((i == 1 ? "" : "\n") + i);
}
area.setCaretPosition(1);
}
}