Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with the code

 
in.anurag Singh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I have a problem with the above code.
The program is compiling successfully and is running but i am not getting the panel containing rectangle on the main Frame.
The main Frame is displaying only the comboboxes, there should be a rectangle also..

Please solve the problem..
 
Aron Jhed Amiscosa
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please use codetags next time.
 
in.anurag Singh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh..yes..
i will take care of that..this is my first time to have the problem with the code so sorry..
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the button to incorporate the code tags in your original post
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your drawrectangle class as shown:

attempts to draw a 150 x 100 point rectangle with the rectangle's top left corner at [200, 50]. However when you create one in your main class:


you only give it a size of 150 x 50, so how will this rectangle ever show if it starts at 200, 50?

Also, you avoid using null layout and setBounds but instead let layout managers do the component laying for you.
 
in.anurag Singh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Thanks,
This makes my code run and a rectangle is now appearing..
Thanks a lot..

I will now try this by layout managers..

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic