import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Temperatures extends JFrame implements ActionListener
{
	JTextField t1,t2;
	public Temperatures ()
	{
		
		JButton b1 = new JButton("Convert");
		add(b1);
		b1.setBackground(Color.GREEN);
		
		JLabel l1=new JLabel("Celsius");
		add(l1);
		t1=new JTextField (10);
		add(t1);
		l1.setForeground(Color.YELLOW);
		JLabel l2=new JLabel("32 fahrenheit");
		add(l2);
		t2=new JTextField (10);
		add(t2);
		l2.setForeground(Color.YELLOW);
		Font ft= new Font ("Cooper Black",Font.ITALIC,26);
		b1.setFont(ft);
		l1.setFont(ft);
		l2.setFont(ft);
		JPanel p1=new JPanel();
		add(p1,BorderLayout.CENTER);
		FlowLayout fw=new FlowLayout();
		setLayout(fw);
		b1.addActionListener(this);
	}
	public void actionPerformed(ActionEvent ae)
	{
		String e=ae.getActionCommand();
		double a=Double.parseDouble(t1.getText());
		double c= 0;
		if (e.equals("Celsius"))
			c=(1.8*c) + 32  ;
		else if (e.equals("32 fahrenheit"))
			c=(c-32) *0.5555555 ;
		t2.setText(Double.toString(c));
			
	}
	public static void main (String[] args)
	{
		Temperatures t=new Temperatures();
		t.setVisible(true);
		t.setSize(600,600);
		t.getContentPane().setBackground(Color.BLUE);
		t.setTitle("Conver the Temperatures");
		t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	}