|
-
Dec 6th, 2007, 03:29 PM
#1
Thread Starter
Member
Applet problem
Hi everyone
I run this program using netBeans it ok but, I tried to use internet explorer it does not show the interface despite there is an HTML file created by neatBeans. Could please anyone tell what is wrong. Thanks
Code:
package project;
import java.awt.Color;
import javax.swing.JOptionPane;
public class AddCustomerApplet extends javax.swing.JApplet {
Customer aCustomer;
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
Customer.initialize();
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void addCustomer()
{
String doorNumber = door_numberText.getText();
String streetName= street_nameText.getText();
String postCode = post_codeText.getText();
String phoneNumber = phone_numberText.getText();
if (doorNumber.length() == 0 || streetName.length() == 0 || postCode.length() == 0 || phoneNumber.length() == 0)
JOptionPane.showMessageDialog(this," Please Enter all data ");
else
{
aCustomer = new Customer(doorNumber,streetName,postCode,phoneNumber);
try //add New to Customer
{
aCustomer.addNew();
JOptionPane.showMessageDialog(this,"Customer added");
clearForm();
}
catch (DuplicateException e)
{
JOptionPane.showMessageDialog(this, e.toString());
}
}
}
private void clearForm()
{
door_numberText.setText(" ");
street_nameText.setText(" ");
post_codeText.setText(" ");
phone_numberText.setText(" ");
}
public void shutDown()
{
Customer.terminate();
}
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
street_nameText = new javax.swing.JTextField();
post_codeText = new javax.swing.JTextField();
phone_numberText = new javax.swing.JTextField();
order = new javax.swing.JButton();
clear = new javax.swing.JButton();
door_numberText = new javax.swing.JTextField();
setEnabled(false);
jLabel1.setText("Door Number");
jLabel2.setText("Strrt Name");
jLabel3.setText("Post Code");
jLabel4.setText("Phone Number");
order.setText("AddCustomer");
order.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
orderActionPerformed(evt);
}
});
clear.setText("Clear ");
clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearActionPerformed(evt);
}
});
door_numberText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
door_numberTextActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(28, 28, 28))
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(10, 10, 10)))
.addGap(27, 27, 27))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(door_numberText, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(order, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(5, 5, 5)
.addComponent(clear, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE))
.addComponent(post_codeText, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
.addComponent(street_nameText, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
.addComponent(phone_numberText, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE))
.addGap(57, 57, 57))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(36, 36, 36)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(door_numberText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(post_codeText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(phone_numberText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(street_nameText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(59, 59, 59)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(order, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(clear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(63, 63, 63))
);
}// </editor-fold>
private void orderActionPerformed(java.awt.event.ActionEvent evt) {
addCustomer();
clearForm();
// TODO add your handling code here:
}
private void clearActionPerformed(java.awt.event.ActionEvent evt) {
clearForm();
// TODO add your handling code here:
}
private void door_numberTextActionPerformed(java.awt.event.ActionEvent evt) {
}
private javax.swing.JButton clear;
private javax.swing.JTextField door_numberText;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JButton order;
private javax.swing.JTextField phone_numberText;
private javax.swing.JTextField post_codeText;
private javax.swing.JTextField street_nameText;
// End of variables declaration
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|