File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes doesn't draw anything Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "doesn Watch "doesn New topic
Author

doesn't draw anything

Bobby Marvikuan
Ranch Hand

Joined: Mar 14, 2012
Posts: 54
Hi there!
Can anyone help me to understand why my code does not working please it should draw a rectangle in the JFrame but ... it does not and I am stupid because I don't see why. so here is the code.


Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172
    
    8

Check out http://www.coderanch.com/how-to/java/BackgroundImageOnJPanel
You can use the same approach to have your custom painting instead of the image


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Bobby Marvikuan
Ranch Hand

Joined: Mar 14, 2012
Posts: 54
Maneesh Godbole wrote:Check out http://www.coderanch.com/how-to/java/BackgroundImageOnJPanel
You can use the same approach to have your custom painting instead of the image

OK thanks I see the point but if I want to add on my square smth. like JLabel will I able to do that if I am using this method with an image?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172
    
    8

Custom painting for containers does not interfere with their ability to add children or lay them out properly.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: doesn't draw anything
 
Similar Threads
how to place Panel into Frame
Simple JPanel question
Overiding g in a JPanel not drawing Oval
Triggering an animation from a button
full-screen gray window problem and event handling problem