Code::
import javax.swing.*;
import java.awt.event.*;
public class CurrencyConverter extends JFrame
{ JTextField t1=new JTextField();
JTextField t2=new JTextField();
JTextField t3=new JTextField();
JLabel l1=new JLabel("Rupees:");
JLabel l2=new JLabel("US Dollars:");
JLabel l3=new JLabel("Euros:");
CurrencyConverter()
{
setLayout(null);
setTitle("Converter");
setVisible(true);
setSize(400,200);
l1.setBounds(20,30,70,30);
l2.setBounds(20,70,70,30);
l3.setBounds(20,110,70,30);
t1.setBounds(120,30,70,30);
t2.setBounds(120,70,70,30);
t3.setBounds(120,110,70,30);
add(t1);
add(l1);
add(l2);
add(t2);
add(t3);
add(l3);
t1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
double a=Double.parseDouble(t1.getText());
t2.setText(String.format("%.2f",a*0.015));
t3.setText(String.format("%.2f",a*0.015));
}
});
t2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
double a=Double.parseDouble(t2.getText());
t1.setText(String.format("%.2f",a*64.68));
t3.setText(String.format("%.2f",a*0.94));
}
});
t3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
double a=Double.parseDouble(t3.getText());
t2.setText(String.format("%.2f",a*1.06));
t1.setText(String.format("%.2f",a*68.71));
}
});
}
public static void main(String[] nt)
{
new CurrencyConverter();
}
}
import javax.swing.*;
import java.awt.event.*;
public class CurrencyConverter extends JFrame
{ JTextField t1=new JTextField();
JTextField t2=new JTextField();
JTextField t3=new JTextField();
JLabel l1=new JLabel("Rupees:");
JLabel l2=new JLabel("US Dollars:");
JLabel l3=new JLabel("Euros:");
CurrencyConverter()
{
setLayout(null);
setTitle("Converter");
setVisible(true);
setSize(400,200);
l1.setBounds(20,30,70,30);
l2.setBounds(20,70,70,30);
l3.setBounds(20,110,70,30);
t1.setBounds(120,30,70,30);
t2.setBounds(120,70,70,30);
t3.setBounds(120,110,70,30);
add(t1);
add(l1);
add(l2);
add(t2);
add(t3);
add(l3);
t1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
double a=Double.parseDouble(t1.getText());
t2.setText(String.format("%.2f",a*0.015));
t3.setText(String.format("%.2f",a*0.015));
}
});
t2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
double a=Double.parseDouble(t2.getText());
t1.setText(String.format("%.2f",a*64.68));
t3.setText(String.format("%.2f",a*0.94));
}
});
t3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
double a=Double.parseDouble(t3.getText());
t2.setText(String.format("%.2f",a*1.06));
t1.setText(String.format("%.2f",a*68.71));
}
});
}
public static void main(String[] nt)
{
new CurrencyConverter();
}
}
Output::