Board index » jbuilder » Newbie Question On Applets

Newbie Question On Applets


2004-09-19 05:55:26 PM
jbuilder4
I'm working with the latest download of JBuilder X Foundation, uses 1.4.2
JDK. After following the first several steps of the GoodEveningClass
tutorial for building an applet, I created a basic do nothing applet. I
stopped following the tutorial after building the empty applet. The
remainder of the tutorial dealt with using the design tab and adding
components to the applet, and I didn't want to do that yet.
Instead, using the source tab, I added a label to the applet and some
System.out.println strings in the init(), start(), stop(), and exit()
methods, then rebuilt it. But when I run the applet the label does not show.
What shows up is an empty applet (with the info, start, stop, exit tabs at
the top). The System.out.println strings do show up in the messages window.
I'm able to get this applet to display the label when I use TextTab as the
ide to compile and run the applet (putting it in a different directory),
when I use the the command line tools (javac and appletviewer) that comes
with JDK, and when I use IE to look at the applet (that textpad compiled).
Sorry for the winded preamble but here is the rather simple code for the
applet:
*******************************************
package firstapplet;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class GoodEveningApplet extends Applet {
private boolean isStandalone = false;
private Label label;
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//Construct the applet
public GoodEveningApplet() {
}
//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
System.out.println("Applet::init()");
}
//Component initialization
private void jbInit() throws Exception {
}
//Start the applet
public void start() {
System.out.println("Applet::start()");
label = new Label("Starter");
add(label);
}
//Stop the applet
public void stop() {
System.out.println("Applet::stop()");
remove(label);
}
//Destroy the applet
public void destroy() {
System.out.println("Applet::destroy()");
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
}
}
*********************************************
Why in the world doesn't the label show up when I run the applet in
JBuilder? This is a tutorially created project and applet. I went off the
reservation with my System.out.println strings and the Label, but the code
is correct. I'm pretty stumped.
 
 

Re:Newbie Question On Applets

"Edward H. Fabrega" < XXXX@XXXXX.COM >writes:
Quote
//Start the applet
public void start() {
System.out.println("Applet::start()");
label = new Label("Starter");
add(label);
}
Try calling revalidate() after adding and removing the Label.
 

Re:Newbie Question On Applets

"Tor Iver Wilhelmsen [TeamB]" < XXXX@XXXXX.COM >wrote in
message news: XXXX@XXXXX.COM ...
Quote
"Edward H. Fabrega" < XXXX@XXXXX.COM >writes:

>//Start the applet
>public void start() {
>System.out.println("Applet::start()");
>label = new Label("Starter");
>add(label);
>}

Try calling revalidate() after adding and removing the Label.
Thanks, Tor, calling validate() worked, with no other changes in the code. I
have a question. Playing around a little bit, I modified the code,
intantiating the Label in the init() method instead of the start() method,
and did not call validate() afterwards (deleted the Label code that had been
in the start() method also), and the Label did show up when I rebuilt and
ran the program, disappearing when I clicked on "stop". Okayyeee, so then
removed the validate() call that was after the remove(label) in the stop()
method, reran the applet, and the Label still disappeared when I clicked on
"stop". This is telling me that the original problem was where I was
initializing the applet. Apparently, JBuilder didn't like it occuring in the
start() method, but was copasetic with it in the init() method. Perplexing
is that the original code worked with the other tools (TextTab, Sun's
command line tools javac and appletviewer). Can you shed any light on this?
BTW, the book I'm using to learn the AWT is David M. Geary's "Graphic Java
1.2 Third Edition, and the first example of an applet in that book had the
Label being instantiated in the start() method, like I had it in the
original code. I have two JDKs installed on my Windows XP pro sp2 machine:
JBuilder's 1.4.2, which is what I use for JBuilder, and JDK 1.5.0 RC, which
is what I use for outside the JBuilder IDE. So I can't just chalk this
inconsistency between the two IDEs as being something related to a book
dealing with a JDK that was 3 versions back from the current incantation,
since Geary's example worked fine with JDK 1.5.0.
 

{smallsort}

Re:Newbie Question On Applets

Try giving the label some bounds and a location.
Also, the default layout is probably forcing
the label position to be somewhere in a galalxy
far away.
I strongly recommend the use of the designer until
you get familiar with how to layout an applet.
Tor Iver Wilhelmsen [TeamB] wrote:
Quote
"Edward H. Fabrega" < XXXX@XXXXX.COM >writes:


>//Start the applet
>public void start() {
>System.out.println("Applet::start()");
>label = new Label("Starter");
>add(label);
>}


Try calling revalidate() after adding and removing the Label.
 

Re:Newbie Question On Applets

"Edward H. Fabrega" < XXXX@XXXXX.COM >wrote in message
Quote

"Tor Iver Wilhelmsen [TeamB]" < XXXX@XXXXX.COM >wrote in
message news: XXXX@XXXXX.COM ...
>"Edward H. Fabrega" < XXXX@XXXXX.COM >writes:
>
>>//Start the applet
>>public void start() {
>>System.out.println("Applet::start()");
>>label = new Label("Starter");
>>add(label);
>>}
>
>Try calling revalidate() after adding and removing the Label.

Thanks, Tor, calling validate() worked, with no other changes in the code.
I
have a question. Playing around a little bit, I modified the code,
intantiating the Label in the init() method instead of the start() method,
and did not call validate() afterwards (deleted the Label code that had
been
in the start() method also), and the Label did show up when I rebuilt and
ran the program, disappearing when I clicked on "stop". Okayyeee, so then
removed the validate() call that was after the remove(label) in the stop()
method, reran the applet, and the Label still disappeared when I clicked
on
"stop". This is telling me that the original problem was where I was
initializing the applet. Apparently, JBuilder didn't like it occuring in
the
start() method, but was copasetic with it in the init() method. Perplexing
is that the original code worked with the other tools (TextTab, Sun's
command line tools javac and appletviewer). Can you shed any light on
this?

BTW, the book I'm using to learn the AWT is David M. Geary's "Graphic Java
1.2 Third Edition, and the first example of an applet in that book had the
Label being instantiated in the start() method, like I had it in the
original code. I have two JDKs installed on my Windows XP pro sp2 machine:
JBuilder's 1.4.2, which is what I use for JBuilder, and JDK 1.5.0 RC,
which
is what I use for outside the JBuilder IDE. So I can't just chalk this
inconsistency between the two IDEs as being something related to a book
dealing with a JDK that was 3 versions back from the current incantation,
since Geary's example worked fine with JDK 1.5.0.


In my previous post this line: "This is telling me that the original problem
was where I was
initializing the applet."
should be: "This is telling me that the original problem was where I was
initializing the Label."
 

Re:Newbie Question On Applets

"Ken Warner" < XXXX@XXXXX.COM >wrote in message
Quote
Try giving the label some bounds and a location.
Also, the default layout is probably forcing
the label position to be somewhere in a galalxy
far away.

I strongly recommend the use of the designer until
you get familiar with how to layout an applet.

Tor Iver Wilhelmsen [TeamB] wrote:
>"Edward H. Fabrega" < XXXX@XXXXX.COM >writes:
>
>
>>//Start the applet
>>public void start() {
>>System.out.println("Applet::start()");
>>label = new Label("Starter");
>>add(label);
>>}
>
>
>Try calling revalidate() after adding and removing the Label.

The Label shows up (in the top center of the applet) when I instantiate and
add it in init() instead of start(). That's my big question now, since the
original code worked as is using the TextPad compiler and Sun's command line
tools javac and appletviewer. It annoys me, this inconsistency, like a pesky
gnat, but I lack sufficient familarity/experience with the JBuilder IDE to
figure out what is causing it. Hell, if I can't follow Geary's examples,
then what can I follow?????
 

Re:Newbie Question On Applets

Applets are run by browsers. Browsers
instantiate the applet and then call init() and
after init() is called, start() is called.
Generally speaking sometime during and
after init() is called and before start() is called,
all the validation is done. Which means that,
depending on what applet viewer is being used,
any component that is added in the start() method
may or may not be shown until the next time the
applet is drawn. Borland -- I think -- uses
their own version of the applet viewer which may
not be the same as the applet viewer in the JDK.
Try this -- in the version of your applet where
the label does not show, iconify and then uniconify
it. See if the lable is then drawn.
Again, you should try using the designer in JB
and look at all the code that is generated for you.
Edward H. Fabrega wrote:
Quote
"Ken Warner" < XXXX@XXXXX.COM >wrote in message
news:414dd5a1$ XXXX@XXXXX.COM ...

>Try giving the label some bounds and a location.
>Also, the default layout is probably forcing
>the label position to be somewhere in a galalxy
>far away.
>
>I strongly recommend the use of the designer until
>you get familiar with how to layout an applet.
>
>Tor Iver Wilhelmsen [TeamB] wrote:
>
>>"Edward H. Fabrega" < XXXX@XXXXX.COM >writes:
>>
>>
>>
>>>//Start the applet
>>>public void start() {
>>>System.out.println("Applet::start()");
>>>label = new Label("Starter");
>>>add(label);
>>>}
>>
>>
>>Try calling revalidate() after adding and removing the Label.
>

The Label shows up (in the top center of the applet) when I instantiate and
add it in init() instead of start(). That's my big question now, since the
original code worked as is using the TextPad compiler and Sun's command line
tools javac and appletviewer. It annoys me, this inconsistency, like a pesky
gnat, but I lack sufficient familarity/experience with the JBuilder IDE to
figure out what is causing it. Hell, if I can't follow Geary's examples,
then what can I follow?????


 

Re:Newbie Question On Applets

"Ken Warner" < XXXX@XXXXX.COM >wrote in message
Quote
Applets are run by browsers. Browsers
instantiate the applet and then call init() and
after init() is called, start() is called.

Generally speaking sometime during and
after init() is called and before start() is called,
all the validation is done. Which means that,
depending on what applet viewer is being used, any component that is added
in the start() method
may or may not be shown until the next time the
applet is drawn. Borland -- I think -- uses
their own version of the applet viewer which may
not be the same as the applet viewer in the JDK.

Try this -- in the version of your applet where
the label does not show, iconify and then uniconify
it. See if the lable is then drawn.

Again, you should try using the designer in JB
and look at all the code that is generated for you.


Edward H. Fabrega wrote:
>"Ken Warner" < XXXX@XXXXX.COM >wrote in message
>news:414dd5a1$ XXXX@XXXXX.COM ...
>
>>Try giving the label some bounds and a location.
>>Also, the default layout is probably forcing
>>the label position to be somewhere in a galalxy
>>far away.
>>
>>I strongly recommend the use of the designer until
>>you get familiar with how to layout an applet.
>>
>>Tor Iver Wilhelmsen [TeamB] wrote:
>>
>>>"Edward H. Fabrega" < XXXX@XXXXX.COM >writes:
>>>
>>>
>>>
>>>>//Start the applet
>>>>public void start() {
>>>>System.out.println("Applet::start()");
>>>>label = new Label("Starter");
>>>>add(label);
>>>>}
>>>
>>>
>>>Try calling revalidate() after adding and removing the Label.
>>
>
>The Label shows up (in the top center of the applet) when I instantiate
>and add it in init() instead of start(). That's my big question now,
>since the original code worked as is using the TextPad compiler and Sun's
>command line tools javac and appletviewer. It annoys me, this
>inconsistency, like a pesky gnat, but I lack sufficient
>familarity/experience with the JBuilder IDE to figure out what is causing
>it. Hell, if I can't follow Geary's examples, then what can I follow?????

As per your suggestion, I put the Label instantiating code back in the
start() method, but without a validate() method following the add(label).
The applet started without a label. I iconified the applet, and I have to
admit that I expected the label to show when I restored it but it didn't.
This is strange, because I CAN get the label to show right off the bat with
the code in the start() method as long as I call validate() right after the
add(label). This has to be a JBuilder appletviewer specific behavior, and I
can live with that. I'll be using the designer extensively once I begin to
write my own programs. Right now I'm following along with Geary's "Graphic
Java 1.2 third Edition". I'm a complete newbie to JBuilder, but am a
returning expatriate when it comes to Java itself. I have a quirk (a
feature, actually) about reviewing material that I've been away from for a
while. I act like I don't know anything, and study what I already know as if
I've never seen it before, hoping to glean a deeper insight than what had
previously existed. I mean a week ago I was reading about how to declare
primitives in Java like I'd never seen it before or done it myself. Imagine
reviewing how to add 2 + 2 = 4 and you get the idea. With AWT I don't have
to fake it too much, however. I left Java in disgust a few years ago when I
couldn't get my GUI to work the way I wanted it to (the main problem was
with updating the UI after changes), taught myself microsoft's MFC (I know
C++) and off I went to write my program. It was a flat file database
program, with a look and feel similar to Access, took me two years to write
and debug, with 36 release versions before I finally said it's good enough
for me. That whole endeavor was to give me a database that was SPECIFICALLY
tailored to my wants and needs, and there was no way that I was going to use
Access. My ultimate goal now is to get into Swing, which I think will solve
the problems that I had with AWT. The JBuilder designer will factor greatly
in my programming, so don't think I'm dishing it.
 

Re:Newbie Question On Applets

Edward H. Fabrega wrote:
Quote
"Ken Warner" < XXXX@XXXXX.COM >wrote in message
[lots of stuff deleted
As per your suggestion, I put the Label instantiating code back in the
start() method, but without a validate() method following the add(label).
The applet started without a label.
Try <yourLabelName>.setVisible(true);
in the start() method after the add();
Don't try and figure out Java without looking at the source. It
will drive you mad.
I iconified the applet, and I have to
Quote
admit that I expected the label to show when I restored it but it didn't.
This is strange, because I CAN get the label to show right off the bat with
the code in the start() method as long as I call validate() right after the
add(label). This has to be a JBuilder appletviewer specific behavior, and I
can live with that. I'll be using the designer extensively once I begin to
write my own programs.
There was a lot of GUI problems with early Java. There are still
a lot of gotcha's when mixing AWT and Swing. It aint an
easy road. That's why JB and other IDE's are around.
I have taken the cowards way out and now let the IDE do as much thinking
for me as possible.
I left Java in disgust a few years ago when I
Quote
couldn't get my GUI to work the way I wanted it to (the main problem was
with updating the UI after changes), taught myself microsoft's MFC (I know
C++) and off I went to write my program. It was a flat file database
program, with a look and feel similar to Access, took me two years to write
and debug, with 36 release versions before I finally said it's good enough
for me. That whole endeavor was to give me a database that was SPECIFICALLY
tailored to my wants and needs, and there was no way that I was going to use
Access.
MFC programmers have way more courage than I...
Even though Java and an IDE give you about a 10 to 1 advantage
in reducing development time, Swing still has it's quirks that
will drive you mad -- again.
My ultimate goal now is to get into Swing, which I think will solve
Quote
the problems that I had with AWT. The JBuilder designer will factor greatly
in my programming, so don't think I'm dishing it.

 

Re:Newbie Question On Applets

"Ken Warner" < XXXX@XXXXX.COM >wrote in message
Quote


Edward H. Fabrega wrote:
>"Ken Warner" < XXXX@XXXXX.COM >wrote in message
[lots of stuff deleted
>As per your suggestion, I put the Label instantiating code back in the
>start() method, but without a validate() method following the add(label).
>The applet started without a label.

Try <yourLabelName>.setVisible(true);
in the start() method after the add();

Don't try and figure out Java without looking at the source. It
will drive you mad.

I iconified the applet, and I have to
>admit that I expected the label to show when I restored it but it didn't.
>This is strange, because I CAN get the label to show right off the bat
>with the code in the start() method as long as I call validate() right
>after the add(label). This has to be a JBuilder appletviewer specific
>behavior, and I can live with that. I'll be using the designer
>extensively once I begin to write my own programs.

There was a lot of GUI problems with early Java. There are still
a lot of gotcha's when mixing AWT and Swing. It aint an
easy road. That's why JB and other IDE's are around.
I have taken the cowards way out and now let the IDE do as much thinking
for me as possible.

I left Java in disgust a few years ago when I
>couldn't get my GUI to work the way I wanted it to (the main problem was
>with updating the UI after changes), taught myself microsoft's MFC (I
>know C++) and off I went to write my program. It was a flat file database
>program, with a look and feel similar to Access, took me two years to
>write and debug, with 36 release versions before I finally said it's good
>enough for me. That whole endeavor was to give me a database that was
>SPECIFICALLY tailored to my wants and needs, and there was no way that I
>was going to use Access.

MFC programmers have way more courage than I...

Even though Java and an IDE give you about a 10 to 1 advantage
in reducing development time, Swing still has it's quirks that
will drive you mad -- again.

My ultimate goal now is to get into Swing, which I think will solve
>the problems that I had with AWT. The JBuilder designer will factor
>greatly in my programming, so don't think I'm dishing it.
>

I tried instantiating the Label, adding it, and setting it visible, all in
the start() method but the Label still didn't show. It looks like JBuilder
expects all component initialization to occur in the init() method, and I
can live with that. One thing is for sure, and that is that the validate()
method is a humdinger, because as long as that method follows the
add(label), the Label does show even when it's initialized and added in the
start() method. Adding validate() was Iver's suggestion in the other branch
going off from my initial post. Now if validate() acts that responisively
for me everytime I want something on the UI to be updated, then I'll be one
happy camper.
 

Re:Newbie Question On Applets

Here's an idea. After you add() and
setVisible(true) in the start() method
print out the bounds of the label.
Look in the docs ...
Edward H. Fabrega wrote:
Quote
"Ken Warner" < XXXX@XXXXX.COM >wrote in message
news:414e3769$ XXXX@XXXXX.COM ...

>
>Edward H. Fabrega wrote:
>
>>"Ken Warner" < XXXX@XXXXX.COM >wrote in message
>
>[lots of stuff deleted
>
>>As per your suggestion, I put the Label instantiating code back in the
>>start() method, but without a validate() method following the add(label).
>>The applet started without a label.
>
>Try <yourLabelName>.setVisible(true);
>in the start() method after the add();
>
>Don't try and figure out Java without looking at the source. It
>will drive you mad.
>
>I iconified the applet, and I have to
>
>>admit that I expected the label to show when I restored it but it didn't.
>>This is strange, because I CAN get the label to show right off the bat
>>with the code in the start() method as long as I call validate() right
>>after the add(label). This has to be a JBuilder appletviewer specific
>>behavior, and I can live with that. I'll be using the designer
>>extensively once I begin to write my own programs.
>
>There was a lot of GUI problems with early Java. There are still
>a lot of gotcha's when mixing AWT and Swing. It aint an
>easy road. That's why JB and other IDE's are around.
>I have taken the cowards way out and now let the IDE do as much thinking
>for me as possible.
>
>I left Java in disgust a few years ago when I
>
>>couldn't get my GUI to work the way I wanted it to (the main problem was
>>with updating the UI after changes), taught myself microsoft's MFC (I
>>know C++) and off I went to write my program. It was a flat file database
>>program, with a look and feel similar to Access, took me two years to
>>write and debug, with 36 release versions before I finally said it's good
>>enough for me. That whole endeavor was to give me a database that was
>>SPECIFICALLY tailored to my wants and needs, and there was no way that I
>>was going to use Access.
>
>MFC programmers have way more courage than I...
>
>Even though Java and an IDE give you about a 10 to 1 advantage
>in reducing development time, Swing still has it's quirks that
>will drive you mad -- again.
>
>My ultimate goal now is to get into Swing, which I think will solve
>
>>the problems that I had with AWT. The JBuilder designer will factor
>>greatly in my programming, so don't think I'm dishing it.
>>
>

I tried instantiating the Label, adding it, and setting it visible, all in
the start() method but the Label still didn't show. It looks like JBuilder
expects all component initialization to occur in the init() method, and I
can live with that. One thing is for sure, and that is that the validate()
method is a humdinger, because as long as that method follows the
add(label), the Label does show even when it's initialized and added in the
start() method. Adding validate() was Iver's suggestion in the other branch
going off from my initial post. Now if validate() acts that responisively
for me everytime I want something on the UI to be updated, then I'll be one
happy camper.


 

Re:Newbie Question On Applets

"Ken Warner" < XXXX@XXXXX.COM >wrote in message
Quote
Here's an idea. After you add() and
setVisible(true) in the start() method print out the bounds of the label.

Look in the docs ...
Edward H. Fabrega wrote:
>"Ken Warner" < XXXX@XXXXX.COM >wrote in message
>news:414e3769$ XXXX@XXXXX.COM ...
>
>>
>>Edward H. Fabrega wrote:
>>
>>>"Ken Warner" < XXXX@XXXXX.COM >wrote in message
>>
>>[lots of stuff deleted
>>
>>>As per your suggestion, I put the Label instantiating code back in the
>>>start() method, but without a validate() method following the
>>>add(label). The applet started without a label.
>>
>>Try <yourLabelName>.setVisible(true);
>>in the start() method after the add();
>>
>>Don't try and figure out Java without looking at the source. It
>>will drive you mad.
>>
>>I iconified the applet, and I have to
>>
>>>admit that I expected the label to show when I restored it but it
>>>didn't. This is strange, because I CAN get the label to show right off
>>>the bat with the code in the start() method as long as I call validate()
>>>right after the add(label). This has to be a JBuilder appletviewer
>>>specific behavior, and I can live with that. I'll be using the designer
>>>extensively once I begin to write my own programs.
>>
>>There was a lot of GUI problems with early Java. There are still
>>a lot of gotcha's when mixing AWT and Swing. It aint an
>>easy road. That's why JB and other IDE's are around.
>>I have taken the cowards way out and now let the IDE do as much thinking
>>for me as possible.
>>
>>I left Java in disgust a few years ago when I
>>
>>>couldn't get my GUI to work the way I wanted it to (the main problem was
>>>with updating the UI after changes), taught myself microsoft's MFC (I
>>>know C++) and off I went to write my program. It was a flat file
>>>database program, with a look and feel similar to Access, took me two
>>>years to write and debug, with 36 release versions before I finally said
>>>it's good enough for me. That whole endeavor was to give me a database
>>>that was SPECIFICALLY tailored to my wants and needs, and there was no
>>>way that I was going to use Access.
>>
>>MFC programmers have way more courage than I...
>>
>>Even though Java and an IDE give you about a 10 to 1 advantage
>>in reducing development time, Swing still has it's quirks that
>>will drive you mad -- again.
>>
>>My ultimate goal now is to get into Swing, which I think will solve
>>
>>>the problems that I had with AWT. The JBuilder designer will factor
>>>greatly in my programming, so don't think I'm dishing it.
>>>
>>
>
>I tried instantiating the Label, adding it, and setting it visible, all
>in the start() method but the Label still didn't show. It looks like
>JBuilder expects all component initialization to occur in the init()
>method, and I can live with that. One thing is for sure, and that is that
>the validate() method is a humdinger, because as long as that method
>follows the add(label), the Label does show even when it's initialized
>and added in the start() method. Adding validate() was Iver's suggestion
>in the other branch going off from my initial post. Now if validate()
>acts that responisively for me everytime I want something on the UI to be
>updated, then I'll be one happy camper.

Okay, here's something interesting. I'm pasting the code I used and the
messages received. The first example is with the Label getting instantiated
in init(). Notice how in init() the Label has no width and height, while in
start it does. The Label does show. Here's the code:
**************************************************
package firstapplet;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class GoodEveningApplet extends Applet {
private boolean isStandalone = false;
private Label label;
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//Construct the applet
public GoodEveningApplet() {
}
//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
label = new Label("Starter");
add(label);
label.setVisible(true);
System.out.println("In Init: label width: " + label.getWidth() + " label
height: " + label.getHeight());
}
//Component initialization
private void jbInit() throws Exception {
}
//Start the applet
public void start() {
System.out.println("In Start: label width: " + label.getWidth() + "
label height: " + label.getHeight());
}
//Stop the applet
public void stop() {
System.out.println("Applet::stop()");
remove(label);
}
//Destroy the applet
public void destroy() {
System.out.println("Applet::destroy()");
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
}
}
NOW....here is the messages I received:
In Init: label width: 0 label height: 0
In Start: label width: 47 label height: 22
Applet::stop()
Applet::destroy()
********************************************************
Now, I went ahead and put the Label instantiating code in the start() method
and deleted it from init(). The Label did not show and here is the messages
that I got:
In Start: label width: 0 label height: 0
Applet::stop()
Applet::destroy()
********************************************************
Now, with the instantiating code for the Label still in start(), WITH
validate() after the label.setVisible(true), THE LABEL DOES SHOW. Here were
the messages:
In Start: label width: 47 label height: 22
Applet::stop()
Applet::destroy()
******************************************************
So validate() is a honcho, in effect saying CONTAINER, hold the phone, what
have you got? A Label? Paint it. NOW!
 

Re:Newbie Question On Applets

Edward and Ken,
Newsgroup guidelines say quite categorically
that quoting should be limited to what is
absolutely essential, and no more.
Five levels of complete quoting never fall
within those guidelines!
Any further messages in this thread *must* be
edited for quoting. Please tighten up your
messages.
Thanks.
Edward H. Fabrega wrote:
Quote
"Ken Warner" < XXXX@XXXXX.COM >wrote [...]
>>>
>>>>As per your suggestion, I put the Label instantiating code back in the
>>>>start() method, but without a validate() method following the
>>>>add(label). The applet started without a label.
>>>[...]
--
Paul Furbacher (TeamB)
Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.