• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Brush function doesnt appear

 
Miko Jing
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my paint program have brush function. It seem doesnt appear anything when select the brush function.

 
Campbell Ritchie
Sheriff
Pie
Posts: 50278
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I never like listeners which test for their origin. Of course using the == operator on Strings is very likely to fail. Otherwise, don't know. I htink that is too much code to read.
 
Sam Gooding
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because startPoint and endPoint are defined locally to the loop which you leave when you go on to process the "brush" part of paintComponent. They both therefore become null , and you only process your brush logic if they AREN'T null (which they are , because they're out of scope) .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic