On Aug 31, 6:00 pm, anne001 <[EMAIL PROTECTED]> wrote:
> I am having trouble extracting the important information from the
> javabeans lesson.
>
> In particular.
>
> --------------------
> Code-1.13
> public class SimpleBeanJLabel extends JLabel
> implements Serializable {
> Why this complexity?
Because precisely a Bean is something you build to use it as a snippet
of code you could reimplement in another program, hence the necessity
of Serializable, so that it could be reconstruct anywhere.
It is a sine qua non condition of this feature.
If you want to go deeper in the subject, you should wait on later
lessons, where this subject is taught in details, and read absolutely
all the resources about it, and more by googling it. It is a not so
easy subject.
> But why the implements Serializable? There seems to be no point to it
> other than introduce a feature that may be used down the line but is
> not used in the example.
The goal of all exercises is not just to stick with them, but gives
you a way to discover and go deeper in new features, concepts, etc, on
your own.
>
> What is the interface that Serializable expects? (ie some of the
> method names are no longer random, which?)
See Serializable in javadoc, this is explained.
>
> what part of example 4.1 are we replacing, and why?
> What part of example 4.1 stays the same?
You could discover that with a program like merge by comparing the
files.
But to put it brief, in 4.1 you use the built-in mechanism to fire an
event, in 4.2 you build your own mechanism, then use it.
>
> I am having trouble parsing the code from example 4.2 into relevant
> information.
You would probably print both programs and inspect them class by
class, but first read the tutorial given in the resources, all your
questions are answered in it.
That should be a first step for all lessons, first read the resources,
eventually make the exerices in the resources, then read the lesson,
read the lab, make all the exercices, not just open the samples, and
finally the homework.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---