Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_java thread: Applet is not loading swing components


Message #1 by misbah_ansari@y... on Mon, 3 Feb 2003 23:47:51
I copied this into JBuilder and ran it.  The first time it ran, it wanted to
know the name of the main class file to run (under Project Properties, Run
tab, Applet tab).  I specified "javaexamples.TestCreditLimit" (by typing it
in at the top of the "Select Main Class for Project" window -- off from the
Applet tab).

Then it ran fine.

Normally, if you do a File / New Project in JBuilder, followed by a File /
New / Applet, the wizards will take care of this.  Your difficulty may have
come from copying/pasting examples.

When I copy paste examples of .java source files, I normally create a new
project, then create a new class -- making sure to name my package and class
the same as what is in the example .java file.  Then I completely replace
the generated class source statements with the example .java source.  At
that point, a Run of the project usually works.


----- Original Message -----
From: <misbah_ansari@y...>
To: "Professional Java" <pro_java@p...>
Sent: Monday, February 03, 2003 11:47 PM
Subject: [pro_java] Applet is not loading swing components


> Hello to all,
> I have a problem regaring applet.My applet is not showing anything in
> browser or not in Jbuilder.I have downloaded the sun's plug-in from sun's
> site but sitll nothing is happening.I m using the following code.
> _________________________________________________________________________
> package javaexamples;
> import javax.swing.*;
> import java.awt.*;
> public class TestCreditLimit extends JApplet   {  // Classs begins here
>   JLabel Actlbl;
>   Container c;
>   public void init(){ // Method init begins here
>         c=getContentPane();
>         c.setLayout(new FlowLayout());
>         Actlbl = new JLabel("Enter account number...");
>         c.add(Actlbl);
>
>   }   // Method init ends here
>
>
> } //Class ends here
>
___________________________________________________________________________
> This code should display label on applet but it does nothing.Please help
> me.
> i will be thankful.
> Bye,
> Misbah Ansari.
>


  Return to Index