This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Graphics not working  RSS feed

 
Aabhay Singh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 classes







The oval is not painting. Im missing something very basic, cant figure out what .
 
Stephan van Hulst
Saloon Keeper
Posts: 7719
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not using the event dispatch thread. Do it like so:
 
Phil Freihofner
Ranch Hand
Posts: 128
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!