wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes String is not displaying in the panel... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "String is not displaying in the panel..." Watch "String is not displaying in the panel..." New topic
Author

String is not displaying in the panel...

Shalini Chandel
Ranch Hand

Joined: May 05, 2005
Posts: 115
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....


SCJP 1.4
Sunil Kumar Gupta
Ranch Hand

Joined: Aug 26, 2005
Posts: 824
Remove paint() method from Applet

And add one class as


Class pan extends Panel{


}


Lack of will power has caused more failure than lack of intelligence or ability.
My Blog | Red5 Resources | Technology Update | Daily Technology Tips
Sunil Kumar Gupta
Ranch Hand

Joined: Aug 26, 2005
Posts: 824
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

Joined: May 05, 2005
Posts: 115
Thanx a lot Sunil....
It's done...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String is not displaying in the panel...