Codessentials

  • Increase font size
  • Default font size
  • Decrease font size
Home Coding tips Java How to make a JScrollPane transparent

How to make a JScrollPane transparent

If you want to make a JScrollPane transparent then it's not enough to set the Opaque property of the JScrollPane itself to transparent.

You need to set the Opaque property of the viewport as well.

Example:

JPanel backplane = new JPanel(); 
JScrollPane scroller = new JScrollPane(backplane);
scroller.setOpaque(false);
scroller.getViewport().setOpaque(false);
 

Bookmark

AddThis Social Bookmark Button

Related Articles


Newsflash

Now we have got some coding tips for the developers amongst you!