This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 10268
    
    8

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..

 
wood burning stoves
 
subject: problem with the code