English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class LeapYearApplet extends Applet implements ActionListener
{
private TextField inField = new TextField(15); //GUI components
private TextField resultField = new TextField(15);
private Label promt1 = new Label("Input Year >>");
private Label promt2 = new Label(">> is a Leap Year = >>");
private Button FindYear = new Button ("Leap Year!");

private isLeapYear = new isLeapYear(); //The Leap Year object
}

public void init();
{ //Set up the user interface
add(promt1); //Input elements
add(inField);
add(FindYear); //Control Button
add(promt2); //Output elements
add(resultField);
//Register button with listeners
FindYear.addActionListener(this);
setSize(175,200);
}//int()

public void actionPerformed(ActionEvent e)
{
String inputStr = inField.getText(); //Get user's input
//Convert it to double
double userInput = Double.parseDouble(inputStr);
double result = 0;

if(e.getSource()FindYear) { //Process and report
result = year.isLeapYear(userInput);
resultField.setText("result="+ result);
}

2007-03-28 09:08:45 · 3 answers · asked by tabbysp 2 in Computers & Internet Programming & Design

3 answers

private isLeapYear = new isLeapYear(); //The Leap Year object
i think u mean:
private LeapYear isLeapYear = new LeapYear();

you wrote "public void init();",
i think there's an extra semicolon here ...

if(e.getSource()FindYear)
what should that mean

2007-03-28 10:38:14 · answer #1 · answered by Mena M 3 · 0 0

Looks like you're missing a closing bracket in your event handler (actionPerformed).

2007-03-28 11:25:52 · answer #2 · answered by tapeworm 2 · 0 0

try repairing it in the controll panel or uninstall it, then download it again

2007-03-28 09:18:35 · answer #3 · answered by Anonymous · 0 1

fedest.com, questions and answers