5

I need to create a panel which should be invisible but the components inside it (for example, JTextArea, JButton, etc.) should be visible. When I click on the invisible panel, it should become visible.

I can only use JRE 1.4 and nothing more than that. :(

Any idea how to create such a transparent panel???

mdb
  • 52,000
  • 11
  • 64
  • 62
sv_in
  • 13,929
  • 9
  • 34
  • 55

2 Answers2

8

Transparancy is controlled with

setOpaque(false)
Peter
  • 5,728
  • 20
  • 23
  • 1
    I was under the impression that this is considered as misuse of setOpaque - see http://stackoverflow.com/questions/2451990/setopaquetrue-false-java – mikera Sep 26 '13 at 10:29
  • that article explains how Swing got it wrong. Doesnt make it the wrong solution. – Peter Sep 27 '13 at 06:18
5

JComponent.setOpaque(false) is the way to go.

gizmo
  • 11,819
  • 6
  • 44
  • 61