Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with repaint()

 
Clay Adkerson
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have 3 buttons: b1,b2,b3. What im trying to do is is when you click on the button it will use drawString to write what button you clicked. Im using AWT .

Here is the code i have so far.


The problem is that i cant figure out how to get it to use drawString. I tried using repaint() but i dont think i did it correctly. Im am a newb at this. I put in the paint method-> if(source == *button name here*) and then typing the g.drawString and i put repaint() in actionPerformed but it wouldnt work. Compiled correctly though. Hope you understand what im asking. Thanks ahead,
-Clay
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing/AWT...
 
Clay Adkerson
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. This helps some. I'll look it over and update my code. What i have to do is create an applet showing what we learned in class. I have 3 buttons(Java, Html, Unix) that when you click will print text on the screen giving examples and such of each. That class that i posted was just a test thing to try to get it to work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic