This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Game Development and the fly likes Graphics not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Graphics not working" Watch "Graphics not working" New topic
Author

Graphics not working

Aabhay Singh
Greenhorn

Joined: Dec 04, 2012
Posts: 2
I have 2 classes







The oval is not painting. Im missing something very basic, cant figure out what .
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 4003
    
  18

You are not using the event dispatch thread. Do it like so:


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Phil Freihofner
Ranch Hand

Joined: Sep 01, 2010
Posts: 115
    
    1
I don't see where you've added the JPanel to the JFrame!

Are you even getting a proper frame size to display? Is it blank? I think when drawing directly on a JFrame, as you are doing, one has to draw on a specific layer--a display layer of some sort which I can't recall off the top of my head. I'm more used to adding a JPanel to a JFrame, and putting the graphics on the JPanel rather than the JFrame.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Graphics not working
 
It's not a secret anymore!