Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!

Pispa Lupa

Greenhorn
+ Follow
since Aug 04, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pispa Lupa

I'm trying to add pictures to an applet.
To do this, I'm trying to create a policy.
The path for the default policy file of a
user in Windows NT is:
Winnt\Profiles\<Username>\.java.policy
When I go to the dos prompt and type
Policytool, I get an error stating:
"Could not find policy file:c:\Documents and settings\<Username>\.java.policy
The computer is not letting me create such
a file manually. Any help?
Lupa
16 years ago
Hey Guys,
I found the errors and fixed them. Lines 28-31
labelCustNo = new JLabel("Customer Number");
labelCustName = new JLabel(" Name");
labelCustSex = new JLabel("Sex");
labelCustAge = new JLabel("Age");
I did not name labelCustSex and labelCustAge correctlty the first time. Sorry about that and thanks for the help!
Lupa.
16 years ago
Hey Chad,
Thanks for the quick reply. I looked at the code but I can't seem to find the mistake. Keep in mind that this is also happening when I'm running a simple Hello world applet. Anyway, here is the code and I appreciate the help.
Pispa.
import javax.swing.*;
import java.awt.Graphics;
public class Customer1 extends JApplet {
// Variable for the panel
JPanel panelObject;

// Variables of labels
JLabel labelCustNo;
JLabel labelCustName;
JLabel labelCustSex;
JLabel labelCustAge;

// Variables for data entry controls
JTextField textCustNo;
JTextField textCustName;
JComboBox comboCustSex;
JTextField textCustAge;

public void init() {
// Add apprropriate controls to the frame
// Create panel
panelObject = new JPanel();
getContentPane().add(panelObject);

// Create and add the appropriate controls
// Initializing labels
labelCustNo = new JLabel("Customer Number");
labelCustName = new JLabel(" Name");
labelCustNo = new JLabel("Sex");
labelCustNo = new JLabel("Age");

// Initializing textfield
textCustNo = new JTextField(15);
textCustName = new JTextField(30);
textCustAge = new JTextField(2);
String Sex[] = { "Male", "Female" };
comboCustSex = new JComboBox(Sex);

// Adding controls for Customer Number
panelObject.add(labelCustNo);
panelObject.add(textCustNo);

// Adding controls for Customer Name
panelObject.add(labelCustName);
panelObject.add(textCustName);

// Adding controls for Customer Sex
panelObject.add(labelCustSex);
panelObject.add(comboCustSex);

// Adding controls for Customer Age
panelObject.add(labelCustAge);
panelObject.add(textCustAge);

}
}
16 years ago
Hello Everyone,
I am trying to run some applets that I wrote using appletviewer but I'm getting the following error although I have the current JVM and JRE installed. Any help?
java.lang.NullPointerException
at java.awt.Container.addImpl(Container.java:336)
at java.awt.Container.add(Container.java:223)
at Customer1.init(Customer1.java:49)
at sun.applet.AppletPanel.run(AppletPanel.java:340)
at java.lang.Thread.run(Thread.java:479)
I get this error when I'm trying to run even the simplest applet there is.
Thanks for your help.
P.S. If you'd like for me to paste the html code I wrote, please let me know
Pispa
16 years ago
I'm fairly new to Java. Please forgive me if this question sounds dumb.
Can anyone please tell me where I can find some real-world applications or professional projects that I could help me learn java from the ground up?
Thanks!
16 years ago