Java – Transparent JScrollPane

You need to use setOpaque(false) to make it transparent. Call that both on the JScrollPane, and on it’s ViewPort.

sp.setOpaque(false);
sp.getViewport().setOpaque(false);

You’ll also have to call setOpaque(false) on the JTextArea, if you want that transparent as well.

Leave a Comment