This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Cant able to set Background color for panel..  RSS feed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all,

I have three panel.. consider panel1 ,panel 2 and panel3
The panel1's & panel2's Layout is Border Layout.
The panel2 is added into panel1's Border Layout center..
The panel3 is added into panel2's Border Layout center...

Now i was not able to set the background color for panel3....
But if i add the panel3 into panel2's Border Layout east, (or west or south or north) then i can able to set background color..


only if i am put into border layout center then only i was not able to set background color...

whats reason? please anybody give solution...i will be thankful...
 
Marshal
Posts: 64137
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know . . . but something makes me think you are adding the 3 panels on top of each other. If that is the case, then you have changed the colours, you just can't see them!
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this what you are trying? If so, this worked just fine for me...



The reason yours may not be working is that the CENTER object will occupy all un-used space. The EAST and WEST are not the same. Give your panel 3 a preferred size and you will see it...
[ July 30, 2008: Message edited by: Gil Estes ]
 
karthik tvn
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply...
i try this and i will pass comments...

Here you add panel p3 into Border Layout East...
p2.add(p3, BorderLayout.EAST);
but i need, add p3 into Border Layout CENTER...
 
G Estes
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried that too and it worked. The issue you were having (I suspect) is no preferred size for the colorized panel.

Cheers!
 
karthik tvn
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply...
i try this and i will pass comments...

Here you add panel p3 into Border Layout East...
p2.add(p3, BorderLayout.EAST);
but i need, add p3 into Border Layout CENTER...
 
G Estes
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
karthikkumar, did it work?
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everbody!
I too have a similar problem like karthik...



that my Frame class for tetrism and i can't seem to set the background color for any of the JPanels, the color is shown only ont the borders.
Please help if you can.

Benjamin
 
Sheriff
Posts: 21719
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't hijack month old threads.
 
Benjamin Kastelic
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
k, so i'll make a new one
 
That new kid is a freak. Show him this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!