Reputation: 87873
If I move the JScrollPane so it is in front of and partially covering the JPanel, then the JEditorPane inside of the JScrollPane has paint issues. It does not properly re-paint the JPanel's background. So you end up with screen painting issues when you scroll.
I have tried the overlap using the following methods - JScrollPane inside of JPanel - JScrollPane partially covering JPanel using FreeLayout (NetBeans GUI Builder) - JScrollPane partially covering JPanel using JLayeredPane
The JPanel has a solid background right now, but I will extend it to have a gradient as soon as I get solid background to work.
How can I get the JEditorPane to bring in the cropped background from the JPanel?
I am making it transparent using jEditorPane.setBackground(new Color(0,0,0,0))
I tried using setOpaque(false)
like you would do for a panel, but that just seems to put back a default background if you do it to JEditorPane.
Original question by a co-worker: https://stackoverflow.com/questions/6364460/jframe-screen-paint-issues-when-using-transparency
The original question was not as well written and did not seem to bring good answers.
Responses to co-worker question suggestions:
Upvotes: 4
Views: 4116
Reputation: 324197
The Background Panel class has code that attempts to make all component non-opaque so the background will show through.
Edit:
If you want to play with transparent background then you can check out Backgrounds With Transparency for an explanation of the problem and a couple of solutions.
In this case the BackgroundPane is the easier solution.
Upvotes: 5