Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Where does paint get attached to an object?

 
David Sippert
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had this working in some code, unfortunatley I've misplace the code. I found the coding on this forum so I am simple trying to ask for some clarification. I have my app looking like this so far.



Maybe its late, but I can't seem to get the draw code to affect my client area to draw the rectangle. Can anyone explain this paint method to me?

Kind of confused.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

You need to swap lines 3&4.

I noticed you are using Frame (which is AWT). Instead, you should be using Swing (Google to get the AWT/Swing difference)
Almost all AWT components have a one to one Swing substitute.
Frame->JFrame
Button->JButton
Panel->JPanel

Also painting differs a bit when you are using swing. Check out http://docs.oracle.com/javase/tutorial/uiswing/painting/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!