For the reasons adduced here, don't of invoke setPreferredSize()
. Instead, override getPreferredScrollableViewportSize()
to return the desired size.
how can i resize a jscrollpane
-
14-10-2022 - |
Frage
Ok so I have this code:
//adding the panel which will hold the order table
JPanel orderPanel = new JPanel();
right.add(orderPanel);
JTable order = new JTable(orderData, orderColumnNames);
JScrollPane orderPane = new JScrollPane(order);
orderPanel.add(orderPane);
And I want to be able to remove this space :
I guess the space is made by the JScrollPane but i can't find any method to resize the JScrollPane to the JTable's size
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow