the layout manager sets the size of the components.
if the JEditorPane is inside a JScrollPane, you can specify the preferred size of its viewport. for the frame that contains the scrollpane,
you should call pack() (instead of setSize()). the layout manager will then take the preferred sizes of the components to lay them out.
example:
scrollPane.getViewport().setPreferredSize(new Dimension(300,300);
regards