I cannot get this to show up when I run it and I can't figure out whats wrong.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import javax.swing.*;
public class TravelCostEstimator extends Frame implements ActionListener,ItemListener
{
//This part defines how the program will look
Panel partOnePanel = new Panel();
Label companyLabel = new Label("Traveler's Gasoline Calculator");
Label milesLabel = new Label("\nAnticipated Miles");
TextField milesField = new TextField(10);
Label costPerGallonLabel = new Label("\nAnticipated Per Gallon Cost Of Gas");
TextField costPerGallonField = new TextField(10);
Label milesPerGallonLabel = new Label("\nVehicle Miles Per Gallon");
TextField milesPerGallonField = new TextField(10);
Button calcButton = new Button("Calculate");
Panel partTwoPanel = new Panel();
Label beginningLocationLabel = new Label("\nBeginning Location");
Label endLocationLabel = new Label("\n Destination");
Label vehicleSizeLabel = new Label("\n Type of Vehicle");
Label gasTypeLabel = new Label("\n Type of Gas");
Button submitButton = new Button("Submit");
Button clearButton = new Button("Clear");
//This serves as the main method used by the main class
public static void main(String[] args)
{
TravelCostEstimator f = new TravelCostEstimator();
f.setBounds(200,200,600,300);
f.setTitle("Traveler's Gasoline Calculator");
f.setVisible(true);
double totalOilChangeCost, totalFuelCost, totalTravelExpense, fuelPrice;
double oilChangeCost = 30.00;
double fuelSupeUnleadedCost = 3.00;
double fuelUnleadedCost = 2.90;
double fuelLeadedCost = 2.50;
double fuelDieselCost = 4.00;
int distanceTravel, milesPerTank, tankCapacity, milesEntered;
int oilChangeRequired = 3000;
int vehicleCompactTankCapacity = 13;
int vehicleMidSizeTankCapacity = 18;
int vehicleLuxuryTankCapacity = 15;
int vehicleSUVTankCapacity = 23;
int totalOilChange = 0;
char vehicleLabel, fuelLabel, vehicleLabelSelected, fuelLabelSelected;
int totalMiles, milesPerGallon, mpg;
double oilChange = 30.00, fuelCost,totalCost, costPerMile, fuel, total, numOfGallons;
}
public void init()
{
// Sets the layout with two panels
this.setLayout(new BorderLayout());
partOnePanel.setLayout(new FlowLayout());
partTwoPanel.setLayout(new FlowLayout());
//adds components to partOne panel
setBackground(Color.red);
partOnePanel.add(companyLabel);
partOnePanel.add(milesLabel);
partOnePanel.add(milesField);
partOnePanel.add(costPerGallonLabel);
partOnePanel.add(costPerGallonField);
partOnePanel.add(milesPerGallonLabel);
partOnePanel.add(milesPerGallonField);
partOnePanel.add(calcButton);
calcButton.addActionListener(this);
//adds compponents to partTwo panel
partTwoPanel.add(beginningLocationLabel);
Choice beginningLocation = new Choice();
beginningLocation.addItemListener(this);
beginningLocation.add("St. Cloud, MN");
beginningLocation.add("New York, NY");
beginningLocation.add("Dallas, TX");
beginningLocation.add("Minneapolis, MN");
beginningLocation.add("Las Vegas, NV");
beginningLocation.add("Miami, FL");
partTwoPanel.add(endLocationLabel);
Choice endLocationChoice = new Choice();
endLocationChoice.addItemListener(this);
endLocationChoice.add("Seattle, WA");
endLocationChoice.add("Denver, CO");
endLocationChoice.add("Tampa, FL");
endLocationChoice.add("Atlanta, GA");
endLocationChoice.add("Chicago, IL");
endLocationChoice.add("Boston, MA");
partTwoPanel.add(vehicleSizeLabel);
Choice vehicleSizeChoice = new Choice();
vehicleSizeChoice.addItemListener(this);
vehicleSizeChoice.add("Compact");
vehicleSizeChoice.add("Mid-Size");
vehicleSizeChoice.add("Luxury");
vehicleSizeChoice.add("SUV");
partTwoPanel.add(gasTypeLabel);
Choice gasTypeChoice = new Choice();
gasTypeChoice.addItemListener(this);
gasTypeChoice.add("Leaded");
gasTypeChoice.add("Unleaded");
gasTypeChoice.add("Super Unleaded");
gasTypeChoice.add("Diesel");
partTwoPanel.add(submitButton);
submitButton.addActionListener(this);
partTwoPanel.add(clearButton);
clearButton.addActionListener(this);
//adds panels to the frame
add(partOnePanel, BorderLayout.NORTH);
add(partTwoPanel, BorderLayout.CENTER);
}
public void actionPerformed (ActionEvent e)
{
}
public void itemStateChanged(ItemEvent ie)
{
}
}