This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in dispalying panel  RSS feed

 
priya gnana
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to add a label in panel at the location 10,100.But its displaying at the centre of the panel(irrespect of location specified).Can any one help me in solving this problem.




 
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
You need to set the layout of the panel to "null"
 
priya gnana
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i set the panel to null but now it displays nothing...

 
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
1) Take out the BorderLayout.WEST. When the layout is null, providing constraints doesn't make sense
2)You do not need the setVisible(true)
3) Use setBounds() instead of setLocation

 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:3) Use setBounds() instead of setLocation

Because by default, components have a size of 0x0 - that's why you're not seeing anything. Usually the layout manager calls setBounds for you so you won't have to worry about the size, but in this case you have to do it manually.

If you don't know the size you want the control to have, retrieve its preferred size.
 
priya gnana
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all for spending your valuable time and suggestions.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!