File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String is not displaying in the panel...

 
Shalini Chandel
Ranch Hand
Posts: 115
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I made an applet with a panel and one button on it. I want to display a string inside the panel on the click event of the button.

Now the problem is when i click the button, the string is dispalying on the applet. How can we redirect it to the panel. The code is as follows:



Its very urgent..Somebody please help me..

thanx and regards....
 
Sunil Kumar Gupta
Ranch Hand
Posts: 824
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove paint() method from Applet

And add one class as


Class pan extends Panel{


}
 
Sunil Kumar Gupta
Ranch Hand
Posts: 824
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove paint() method from Applet

And add one class as


Class pan extends Panel{

public void paint(Graphics g){
g.drawString("Whatever", locX, locY);
}

}

Now call pan.repaint() in actionPerformed() as u already did

Tell me If i m not clear to my point

 
Shalini Chandel
Ranch Hand
Posts: 115
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx a lot Sunil....
It's done...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic