Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Removing Borders  RSS feed

 
Brent Gamble
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I need some help but let me explain first.

I'm creating a component based off of JPanel. It's has a transparent background and an empty border. When I click it, it changes to a Yellow line border, then after 1.2 seconds it changes back to an empty border. My problem is, when I set the border back to the emptyborder, the border really does change to an empty border, but the color from the yellow line border remains! If I give my component a solid background, I do not have this problem.

Any thoughts? I've tried setting the border to null, tried setUI( new BasicPanelUI() );

Thanks in advance!
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brent,
Welcome to the Ranch.

Instead of empty border, try setting a panel background color line border.
Edit:Just noticed your panel is transperant. You can define the color opacity too! Just set yellow opacity to transperant.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just curious -- would calling repaint() on the JPanel after removing the border do any good? Again, just curious. If I were the OP, I'd go with Maneesh's recommendation.
 
Brent Gamble
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks to camickr on the Official Sun Forums, I was provided a resource which both explained what I was experience and what I could do to work around it.

Problem fixed. Thanks. ;)

http://tips4java.wordpress.com/2009/05/31/backgrounds-with-transparency/

 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brent, please read the FAQ about posting questions here, in particular this one: BeForthrightWhenCrossPostingToOtherSites

To others on this site, please see Brent's reply to a similar request here: Sun forum thread
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Pete.
Congratulations Brent. You just made it to my "do not bother with answering" list.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!