• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problem with repaint()

 
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
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
author
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.
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic