0

i build an desktop application java using NetBeans IDE 7.4 ,add CSS file from file->new file->other->Cascading Style Sheet . iam write a css :

JPanel{
  background: red ;
}

but there is no effect on JPanel background , where is the problem ?

Sameer H. Ibra
  • 1,816
  • 2
  • 17
  • 25
  • Are you using a framework or just pure swing? – Bnrdo Feb 03 '14 at 08:35
  • 1
    Then no, you cannot do that. So how do you include it in the java class? CSS are used to style documents written in markup language (e.g. HTML). Unless you have a framework that translates xml into Java Swing class then that may be possible. But in pure swing, no way. – Bnrdo Feb 03 '14 at 08:54
  • Take a look at this [thread](http://stackoverflow.com/questions/5956934/java-swing-with-css) – Bnrdo Feb 03 '14 at 08:59

1 Answers1

0

If your panel is 'not opaque' (transparent) you wont see your background color.

however read this

https://netbeans.org/kb/73/java/gui-image-display.html

user3241004
  • 24
  • 1
  • 5