• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get all the objects from the applet??

 
Ann Toh
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody tell me how to get all the objects (buttons, table,etc) from the applet and put it into a string??
I am using JApplet with JDK 1.4
[ July 18, 2003: Message edited by: Ann Toh ]
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ann,
what do u exactly mean by "put it in a string"?
i guess that u can probably do getComponents() on the applet object you have as JApplet or Applet objects are panels (containers) and thats how u can probably get all sub components BUT i don't know what u mean by "put it in a string"? what in reality u will want to do with such a functionality? can u explain ur ideas more?
regards
maulin
 
Ann Toh
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i mean like get all the objects from the applet and put it into a string so that when i call that function it will show me applet again.
my program is like microsoft excel, so when i open my file which i have save before. when i open it, all the objects must be there. i don know whether u understand or not but it is very difficult for me to say in words, so sorry about it.
Thanx alot.
[ July 18, 2003: Message edited by: Ann Toh ]
[ July 18, 2003: Message edited by: Ann Toh ]
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The word you want is "persistence". You want your applet data be persist after you leave and come back.
There are two places to place persistent data. If you place it on your PC, you'll need a signed applet and if the PC breaks, you lose the data. Usually it's better to place the data on the server using HTTP Tunneling. You can do that without having to do any security signing.
You can't just capture the indo you need by enumerating all the controls and invoking toString() on each one. What you really want is to be able to load and store the data that they're displaying. For some controls, this is simple (for example, the getText()/setText() methods for a Swing JTextField). For some, you may have a complex data model and it will need to manage its own serialization.
The format that you use to get the data to persist to/from the server is up to you. Usually straight lines of text or XML will do it. I don't recommend binary formats, though.
ALso up to you is how to store the data once it arrives on the server. That's what J2EE's all about.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic