I have this code, and I want it to repaint so that when the user enters the details it prints out the acceleration and fuel consumption (calculated in another class), I can see it works because i have system.out.println's showing the values but they do not get updated to my JFrame.

window() is called in another constructor in another class, the JFrame opens fine but does not update

Any ideas?

Thanks

```
public class Vehicle extends JFrame {

    protected static double horsepower;
    protected static double aerodynamics;
    protected static double weight;
    protected static double acceleration;
    protected static double topspeed;
    protected double fuelconsumption;
    protected String userHorsepower;
    protected String userWeight;
    protected String userTopspeed;
    protected String userInput = "No Current Selection";

    JPanel panel = new JPanel();
    JButton Van = new JButton("Add Van");

    public Vehicle(double horsepower, double weight, double aerodynamics, double topspeed){
        super();
    }

    public void window(){

        JButton Van = new JButton("Add Van Car");
        Van.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {

                userHorsepower = JOptionPane.showInputDialog("Enter Horsepower");
                horsepower = Double.parseDouble(userHorsepower);
                userWeight = JOptionPane.showInputDialog("Enter Weight");
                weight = Double.parseDouble(userWeight);
                userTopspeed = JOptionPane.showInputDialog("Enter Topspeed");
                topspeed = Double.parseDouble(userTopspeed);
                aerodynamics = 0.9;
                userInput = "Van";
                TestConsumption.printVan();
                repaint();
                return;

            }});

        JButton SportCar = new JButton("Add Sports Car");
        SportCar.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                        userHorsepower = JOptionPane.showInputDialog("Enter Horsepower");
                        horsepower = Double.parseDouble(userHorsepower);
                        userWeight = JOptionPane.showInputDialog("Enter Weight");
                        weight = Double.parseDouble(userWeight);
                        userTopspeed = JOptionPane.showInputDialog("Enter Topspeed");
                        topspeed = Double.parseDouble(userTopspeed);
                        aerodynamics = 0.5;
                        userInput = "Sports Car";
                        TestConsumption.printCar();
                        panel.repaint();
            }});

        JLabel userChoice = new JLabel(userInput);
        JLabel accel = new JLabel("Acceleration: " + acceleration);
        JLabel fuel = new JLabel("Fuel Consumption: " + fuelconsumption);

        panel.setLayout(new GridLayout(5,5,0,0));
        panel.add(Van);
        panel.add(SportCar);
        panel.add(userChoice);
        panel.add(accel);
        panel.add(fuel);
        add(panel);
        pack();
        setTitle("Title Here");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setResizable(true);
        setSize(300,200);
        setLocationRelativeTo(null);
        setVisible(true);
        repaint();
    }

```

Window is called in this class 

```
public class TestConsumption extends Vehicle {

    public TestConsumption(double horsepower, double weight, double aerodynamics, double topspeed) {
        super(horsepower, weight, aerodynamics, topspeed);
    }

    public static void main(String [] args){

        Vehicle vh = new Vehicle(500, 500, 500, 500);
        vh.window();
    }

    public static void printCar(){
        Vehicle Car = new SportCar(horsepower,weight,aerodynamics,topspeed);

        Car.acceleration();
        Car.showFuelConsumption();
    }

    public static void printVan(){

        Vehicle FirstVan = new Van(horsepower,weight,aerodynamics,topspeed);

        FirstVan.acceleration();
        FirstVan.showFuelConsumption();
    }
}

```