Tuesday, September 1, 2009

How to make JTextArea transparent in Nimbus LAF of Java

Recently i encountered a problem while using Nimbus LAF of Java that i was not able to make components transparent by using setOpaque(false).
Though my Java 6 update version is a bit older than the current updated version, so it might be possible you may not experience this problem.

For my problem, i found out from the Bugs Section of Java website that this can be resolved like this:-

JTextArea jTextArea1=new JTextArea1();
................
................
jTextArea1.setOpaque(false);
jTextArea1.setBackground(new Color(0,0,0,0));

This bug might have been resolved in future updates but if you face problem, you can use this trick.

5 comments:

  1. How do you setup custom look and feel? I want to use this: http://napkinlaf.sourceforge.net/

    Do I have to download jar files and place where? and How do I tell java to refer to that jar file to set the look and feel?

    ReplyDelete
  2. Great post!! Thanks for sharing such an wonderful information ...

    ReplyDelete
  3. Thanks for the trick. I really need to brush up my java :)

    Caro

    ReplyDelete
  4. Thanks mate !

    Been looking for a while !

    ReplyDelete
  5. Causes a strange repaint bug, if JEditorPane is editable

    ReplyDelete

Write Your Comments..

Share this Page:-