Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IE6 applet problem html posted

 
mark beak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the class is in the same directory. IE just draws an empty box. any suggestions. however netscape works ok.i checked settings java for applets enabled security low. code listing is below with html. i'm using java2 1.3.1-04 could be too old ? thanks for any help.
port java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.text.DecimalFormat;
public class MortgageApplet extends Applet implements TextListener {
TextField principalField = new TextField("0.00", 15),
rateField = new TextField("0.00", 6),
yearsField = new TextField("0", 3),
paymentField = new TextField("0.00", 15);
double principal, rate, ratePercent;
int years, n;
final int paymentsPerYear = 12;
final int timesPerYearCalculated = 12;
double effectiveAnnualRate;
double payment;
DecimalFormat currency = new DecimalFormat("####0.00");
public void init()
{
setLayout(new GridLayout(4,2));
Label principalLabel = new Label("Principal $"),
rateLabel = new Label("Rate (%)"),
yearsLabel = new Label("Years"),
paymentLabel = new Label("Payment $");
Panel principalLabelPanel = new Panel(new FlowLayout(FlowLayout.RIGHT)),
rateLabelPanel = new Panel(new FlowLayout(FlowLayout.RIGHT)),
yearsLabelPanel = new Panel(new FlowLayout(FlowLayout.RIGHT)),
paymentLabelPanel = new Panel(new FlowLayout(FlowLayout.RIGHT));
Panel principalFieldPanel = new Panel(new FlowLayout(FlowLayout.LEFT)),
rateFieldPanel = new Panel(new FlowLayout(FlowLayout.LEFT)),
yearsFieldPanel = new Panel(new FlowLayout(FlowLayout.LEFT)),
paymentFieldPanel = new Panel(new FlowLayout(FlowLayout.LEFT));
principalLabelPanel.add(principalLabel);
principalFieldPanel.add(principalField);
rateLabelPanel.add(rateLabel);
rateFieldPanel.add(rateField);
yearsLabelPanel.add(yearsLabel);
yearsFieldPanel.add(yearsField);
paymentLabelPanel.add(paymentLabel);
paymentFieldPanel.add(paymentField);
add(principalLabelPanel);
add(principalFieldPanel);
add(rateLabelPanel);
add(rateFieldPanel);
add(yearsLabelPanel);
add(yearsFieldPanel);
add(paymentLabelPanel);
add(paymentFieldPanel);
principalField.addTextListener(this);
rateField.addTextListener(this);
yearsField.addTextListener(this);
}

public void textValueChanged (TextEvent e)
{
Object source=e.getSource();
if (source == principalField ||
source == rateField ||
source == yearsField)
{
try
{
principal = Double.valueOf(principalField.getText()).doubleValue();
ratePercent = Double.valueOf(rateField.getText()).doubleValue();
rate = ratePercent/100.0;
years = Integer.parseInt(yearsField.getText());
n = paymentsPerYear * years;
effectiveAnnualRate = rate / paymentsPerYear;
payment = principal*(effectiveAnnualRate / (1 - Math.pow(1 + effectiveAnnualRate, -n)));
paymentField.setText(currency.format(payment));
}
catch (NumberFormatException ex) {}
}
}
}
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Calculate Mortgage Payments</title>
</head>
<body>
<applet code="MortgageApplet"
width=300 height=200></applet>
</body>
</html>
[ June 05, 2003: Message edited by: mark beak ]
 
John Lee
Ranch Hand
Posts: 2545
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic