Search code examples
javaswinglook-and-feel

Texturing backgrounds in Java Swing everywhere, not just in panels


I want to make a GUI with Java swing/JPanel with a textured background. I found a few tutorials on the topic that texture within the boundaries of the control its being applied to, like this:

enter image description here

That's easy enough. I can't figure out how to apply textures, (not necessarily the same texture) elsewhere, like on the tabs title bar, the background, scroll bars... basically everywhere that's still yellow.

How do I do this? Does this require making my own 'Look and Feel'?


Solution

  • Components have a variety of functions named paint___ that control the drawing of various parts. I overrode these and tiled Graphics.drawImage() in the parts responsible for the background.