• Post Reply Bookmark Topic Watch Topic
  • New Topic

retaining text of components

 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends,


how to retain a component's text, when it called from diffrent classes?

if fact, there are many indirect ways to achieve this, but i think, it would be better to use any class or any other method specialy defined to solve this type of problems.

any idea would be much appreciated

thanks
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you describe what you mean by "retain a component's text"? Retain through which events? Once a component contains some text it should remain there until the code specifically removes it.
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply

i have a JApplet and a JFrame class,
first- having a JPanel as its ContentPane which in tern having diffrent components like JTextFields,JComBox etc
second- it is having same JPanel as ContentPane what is in first.

these two classes are in two jsp's. now after running first jsp and entering text inside components ,i ran second jsp, but the texts that i have entered in the components of the first class,has been lost as soon as i called the second class inside second jsp.
so how to keep visible(retain) the text of components when they are called from another class

hope, this will be clearer to you
[ December 01, 2007: Message edited by: John Mclain ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that those are not the same objects. If a new page is loaded -even if it contains the same applet- then all the objects are re-initialized from scratch. What you would need to do is to save everything in the first applet, and then retrieve it in the second applet. This can be done by the getStream and setStream methods in the AppletContext interface. (You can get an object implementing this interface by calling getAppletContext in the Applet class.)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!