Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Button background  RSS feed

 
Honzak Troubak
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need help with background of JButton. I need set background of JButton but usual way doesn't work. Only the edge is setting to color.



I tryed to use setOpaque(true) and setBorderPainted(true/false) but unfortunatly it doesn't work.



Does anybody have any idea?

Thanks a lot
 
Piet Souris
Rancher
Posts: 1783
55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Look & Feel are you using?
 
Honzak Troubak
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure. I did not set or change Look & Feel.

I run on Windows 7 professional and I use last edition of Java.

This class is extends of JDialog and layout is used GridLayout.
 
Piet Souris
Rancher
Posts: 1783
55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Honzak,

well, I remember having the same problem a while ago. At home my button had a completely filled
background, at the office it had only a filled border in the background. IIRC, it had all to do with the
specific look and feel.

On my machine at home, some of the L&F's are

"windows classic" ,"metal","cde/motif", "nimbus", "windows"

You can see what L&F's you have with the following routine:


and set an L&F by;

for some value of j.

Could you try some and see if your problem is solved?

Greetings,
Piet
 
Honzak Troubak
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much, I changed Look and Feel and the problem is solved.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!