wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes problem with the code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "problem with the code" Watch "problem with the code" New topic
Author

problem with the code

in.anurag Singh
Greenhorn

Joined: May 14, 2010
Posts: 25


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..
Jhedzkie Skies
Ranch Hand

Joined: Oct 28, 2009
Posts: 118
please use codetags next time.
in.anurag Singh
Greenhorn

Joined: May 14, 2010
Posts: 25
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

Joined: Jul 26, 2007
Posts: 9990
    
    7

You can use the button to incorporate the code tags in your original post


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
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

Joined: May 14, 2010
Posts: 25



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

I will now try this by layout managers..

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with the code
 
Similar Threads
Virtual Graphing Calculator
Image problem
A Paint Application with Combo Boxes and Buttons
How to put image on JPanel
How to Draw a Line in Java?