import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Calculations extends JFrame implements ActionListener
{
JLabel Distance;
JTextField txt1;
JRadioButton Super_Unleaded;
JTextField txt2;
JRadioButton Desiel;
JRadioButton Unleaded;
JRadioButton Leaded;
JRadioButton rdb4;
JRadioButton SUV;
JRadioButton Luxury;
JRadioButton MidSize;
JRadioButton Compact;
static JPanel p1;
static JPanel p2 ;
static JPanel p3;
//public static Object Calculations;
public Calculations()
{
setLayout (new BorderLayout());
Distance = new JLabel("Enter Distance To Be Traveled: ");
Super_Unleaded = new JRadioButton("Super Unleaded");
Desiel = new JRadioButton ("Desiel");
Unleaded = new JRadioButton ("Unleaded");
Leaded = new JRadioButton ("Leaded");
SUV = new JRadioButton("SUV");
Luxury = new JRadioButton ("Luxury");
MidSize = new JRadioButton ("Mid-Size");
Compact = new JRadioButton ("Compact");
txt1 = new JTextField (20);
txt2 = new JTextField ("25");
txt2.setEditable (false);
p1 = new JPanel ();
p2 = new JPanel ();
p3 = new JPanel ();
p1.setBounds(30,150,400,200);
p2.setBounds(300,300,200,100);
p3.setBounds(300,400,200,100);
p1.add (Distance);
p1.add (txt1);
Distance.setBounds(10,10,200,20);
txt1.setBounds(210,10,70,20);
Super_Unleaded.setBounds(10,90,150,15);
Desiel.setBounds(10,110,100,15);
Unleaded.setBounds(10,130,100,15);
Leaded.setBounds(10,150,100,15);
SUV.setBounds(250,90,150,15);
Luxury.setBounds(250,110,100,15);
Compact.setBounds(250,130,100,15);
MidSize.setBounds(250,150,100,15);
add(Super_Unleaded, BorderLayout.CENTER);
add(Desiel, BorderLayout.CENTER);
add(Unleaded, BorderLayout.CENTER);
add(Distance, BorderLayout.CENTER);
add(Leaded, BorderLayout.CENTER);
add(txt1, BorderLayout.CENTER);
add(SUV, BorderLayout.CENTER);
add(Luxury, BorderLayout.CENTER);
add(Compact, BorderLayout.CENTER);
add(Distance, BorderLayout.CENTER);
add(MidSize, BorderLayout.CENTER);
}
public static void main(String[] args)
{
Calculations g = new Calculations();
g.add(p1);
g.add(p2);
g.setSize(420,250);
g.setVisible(true);
g.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
g.setTitle("Fuel Calculations");
g.setBackground(Color.cyan);
}
}