I need to insert numbers of JButtons in a JTextPane. It is done via insertComponent() method. but there is a problem, the components are in a line and JScrollPane doesn’t scroll neither vertically nor horizontally (however I just want vertically). what should I do?
I need to insert numbers of JButtons in a JTextPane . It is done
Share
A simple solution is to add spaces between the buttons, these allow the
JTextPaneto wrap the buttons.Alternatively, you can insert a single
JComponentand add the buttons as children of that single component. This would allow you to use any layout you like for the buttons (FlowLayoutis probably what you want).