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.

Resizing issue with canvas within jscrollpane within jsplitpane

Instead of setPreferredSize(), let your components calculate their own preferred size and pack() the enclosing Window to accommodate. The example below adds an instance of draw.GraphPanel to the top and a corresponding control panel to the bottom. import draw.GraphPanel; import java.awt.EventQueue; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; /** * @see https://stackoverflow.com/q/11942961/230513 … Read more