Results 1 to 3 of 3
Thread: Currency Converter!!!!
- 03-29-2009, 08:03 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 3
- Rep Power
- 0
Currency Converter!!!!
Hey everyone,*
I've an assignment that is coding a "currency converter". I managed to generate the program screen, but I don't know where and how to code in order to make calculations for currency conversion. If you've any solution or idea about it, please leave your comments on that topic page..
Thanks a lot for everything from now on.
Have a nice Sunday!!!!
package assignment;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.text.DecimalFormat;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class MoneyConverter extends JFrame {
private JFrame mainFrame;
private JLabel inLabel;
private JTextField inField;
private JLabel tinLabel;
private JTextField tinField;
private JLabel zinLabel;
private JTextField zinField;
private JButton closeButton;
private JButton usdtoaudButton;
private JButton audtousdButton;
public MoneyConverter() {
mainFrame = new JFrame("Money Converter");
inLabel = new JLabel(" AUD ");
inField = new JTextField(20);
tinLabel = new JLabel(" Rate ");
tinField = new JTextField(20);
zinLabel = new JLabel(" USD ");
zinField = new JTextField(20);
usdtoaudButton = new JButton("USD to AUD");
audtousdButton = new JButton("AUD to USD");
closeButton = new JButton("Close");
Container c = mainFrame.getContentPane();
c.setLayout(new FlowLayout());
c.add(inLabel);
c.add(inField);
c.add(tinLabel);
c.add(tinField);
c.add(zinLabel);
c.add(zinField);
c.add(usdtoaudButton);
c.add(audtousdButton);
c.add(closeButton);
mainFrame.setSize(400,180);
mainFrame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e) {System.exit(0);
}
});
USDtoAUDButtonHandler uhandler = new USDtoAUDButtonHandler();
usdtoaudButton.addActionListener(uhandler);
CloseButtonHandler chandler = new CloseButtonHandler();
closeButton.addActionListener(chandler);
AUDtoUSDButtonHandler ahandler = new AUDtoUSDButtonHandler();
audtousdButton.addActionListener(ahandler);
mainFrame.show();
}
class USDtoAUDButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
}
class AUDtoUSDButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
}
class CloseButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
}
public static void main(String args [])
{
MoneyConverter app = new MoneyConverter();
}
}
- 03-29-2009, 10:07 AM #2
Still cross posting.
Swing - CURRENCY CONVERTER!!!!
db
- 04-02-2009, 07:23 AM #3
Member
- Join Date
- Jan 2009
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
Convert Currency to Words in English
By javanewbie in forum JCreatorReplies: 5Last Post: 03-29-2009, 07:25 AM -
usb to serial converter
By freezy in forum Advanced JavaReplies: 2Last Post: 03-18-2009, 10:48 AM -
sound converter WAV to AU
By Unome in forum Java AppletsReplies: 5Last Post: 03-14-2009, 10:25 AM -
Formatting a number to currency
By Java Tip in forum java.textReplies: 0Last Post: 04-16-2008, 10:59 PM -
Setting currency
By Java Tip in forum Java TipReplies: 0Last Post: 11-16-2007, 02:08 PM


LinkBack URL
About LinkBacks

Bookmarks