helllllllo friends

please can u help me????

i have project about creating currency converter using jGRASP i made the enterface using jframebuilder but i dont know how to complete it...i really need ur help friends :'(

Recommended Answers

All 15 Replies

Well how are we supposed to help you if we have no idea what your code is or what you need to help you "complete it"

hi friend
i wanna show u my code but i dont know where i should put it

hi friend

here is my project plz run it

hi friend
i wanna show u my code but i dont know where i should put it

in your post, surrounded by Code tags

/****************************************************************/ 
 /*                      jFrame                              */ 
 /*                                                              */ 
 /****************************************************************/ 
import java.awt.*; 
 import java.awt.event.*; 
 import javax.swing.*; 
 import javax.swing.event.*;
  import java.io.*;
 
 /** 
  * Summary description for jFrame 
  * 
  */ 
 public class jFrame extends JFrame 
 { 
   // Variables declaration 
   private JLabel jLabel1; 
   private JLabel jLabel2; 
   private JTextField jTextField1; 
   private JTextField jTextField2; 
   private JList jList3; 
   private JScrollPane jScrollPane1; 
   private JList jList4; 
   private JScrollPane jScrollPane2; 
   private JButton jButton1; 
   private JButton jButton2; 
   private JPanel contentPane; 
   // End of variables declaration 
  
  
   public jFrame() 
   { 
      super(); 
      initializeComponent(); 
      // 
      // TODO: Add any constructor code after initializeComponent call 
      // 
  
      this.setVisible(true); 
   } 
  
   /** 
    * This method is called from within the constructor to initialize the form. 
    * WARNING: Do NOT modify this code. The content of this method is always regenerated 
    * by the Windows Form Designer. Otherwise, retrieving design might not work properly. 
    * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder 
    * to retrieve your design properly in future, before revising this method. 
    */ 
   private void initializeComponent() 
   { 
      jLabel1 = new JLabel(); 
      jLabel2 = new JLabel(); 
      jTextField1 = new JTextField(); 
      jTextField2 = new JTextField(); 
      jScrollPane1 = new JScrollPane(); 
      jScrollPane2 = new JScrollPane(); 
      jButton1 = new JButton(); 
      jButton2 = new JButton(); 
      contentPane = (JPanel)this.getContentPane(); 
  
      // 
      // jLabel1 
      // 
      jLabel1.setText("From:"); 
      // 
      // jLabel2 
      // 
      jLabel2.setText("To:"); 
      // 
      // jTextField1 
      // 
      jTextField1.addActionListener(new ActionListener() { 
         public void actionPerformed(ActionEvent e) 
         { 
            jTextField1_actionPerformed(e); 
         } 
			
  
      }); 
      // 
      // jTextField2 
      // 
      jTextField2.addActionListener(new ActionListener() { 
         public void actionPerformed(ActionEvent e) 
         { 
            jTextField2_actionPerformed(e); 
         } 
  
     }); 
      // 
      // jList3
		
		    
                String[] listcountriescurrency = { "USD:Utd States$", "EURO:Euro", "GBP:Utd Kingdom Pnd", "JPY:Japan Yen",
               "CAD:Canada$", "AUD:Australia$", "CHF:Switzerland Fr", "AED:Utd Arab Emirates Dhs" };
            
              Container contentpane;


               contentpane = getContentPane();
               contentpane.setLayout(new FlowLayout());
               jList3 = new JList(listcountriescurrency);
                jList3.setSelectedIndex(0);
               jList3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
 
      // 
      jList3.addListSelectionListener(new ListSelectionListener() { 
         public void valueChanged(ListSelectionEvent e) 
         { 
            jList3_valueChanged(e);
            
                        
            
         } 
  
      }); 
      // 
      // jScrollPane1 
      // 
      jScrollPane1.setViewportView(jList3); 
      // 
      // jList4 
      
               contentpane = getContentPane();
               contentpane.setLayout(new FlowLayout());
               jList4 = new JList(listcountriescurrency);
                jList4.setSelectedIndex(0);
               jList4.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
 

      // 
      jList4.addListSelectionListener(new ListSelectionListener() { 
         public void valueChanged(ListSelectionEvent e) 
         { 
            jList4_valueChanged(e); 
         } 
  
      }); 
      // 
      // jScrollPane2 
      // 
      jScrollPane2.setViewportView(jList4); 
      // 
      // jButton1
      
      // 
      jButton1.setText("Convert"); 
      jButton1.addActionListener(new ActionListener() { 
         public void actionPerformed(ActionEvent e) 
         { 
            jButton1_actionPerformed(e);
             
         } 
  
      }); 
      // 
      // jButton2 
      // 
      jButton2.setText("Close"); 
      jButton2.addActionListener(new ActionListener() { 
         public void actionPerformed(ActionEvent e) 
         { 
            jButton2_actionPerformed(e);
            
            String message = "Thank you for using Our Currency Convertor";
            
               JOptionPane.showMessageDialog(null,message);
               System.exit(0);

 
         } 
  
      }); 
      // 
      // contentPane 
      // 
      contentPane.setLayout(null); 
      addComponent(contentPane, jLabel1, 9,17,60,18); 
      addComponent(contentPane, jLabel2, 178,19,60,18); 
     addComponent(contentPane, jTextField1, 4,225,89,22); 
      addComponent(contentPane, jTextField2, 186,226,80,22); 
      addComponent(contentPane, jScrollPane1, 7,42,152,166); 
      addComponent(contentPane, jScrollPane2, 173,42,154,167); 
      addComponent(contentPane, jButton1, 98,224,83,25); 
      addComponent(contentPane, jButton2, 270,225,73,25); 
      // 
      // jFrame 
      // 
      this.setTitle("Currency Converter Application"); 
      this.setLocation(new Point(29, 3)); 
      this.setSize(new Dimension(356, 287)); 
   } 
  
   /** Add Component Without a Layout Manager (Absolute Positioning) */ 
   private void addComponent(Container container,Component c,int x,int y,int width,int height) 
   { 
      c.setBounds(x,y,width,height); 
      container.add(c); 
   } 
  
   // 
   // TODO: Add any appropriate code in the following Event Handling Methods 
   // 
   private void jTextField1_actionPerformed(ActionEvent e) 
   { 
      System.out.println("\njTextField1_actionPerformed(ActionEvent e) called."); 
      // TODO: Add any handling code here 
		
		
  
   } 
  
   private void jTextField2_actionPerformed(ActionEvent e) 
   { 
      System.out.println("\njTextField2_actionPerformed(ActionEvent e) called."); 
     // TODO: Add any handling code here 
  
 
          } 
  
   private void jList3_valueChanged(ListSelectionEvent e) 
   { 
      System.out.println("\njList3_valueChanged(ListSelectionEvent e) called."); 
      if(!e.getValueIsAdjusting()) 
      { 
         Object o = jList3.getSelectedValue(); 
         System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected."); 
         // TODO: Add any handling code here for the particular object being selected 
          
      } 
   } 
  
   private void jList4_valueChanged(ListSelectionEvent e) 
   { 
      System.out.println("\njList4_valueChanged(ListSelectionEvent e) called."); 
      if(!e.getValueIsAdjusting()) 
      { 
         Object o = jList4.getSelectedValue(); 
         System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected."); 
         // TODO: Add any handling code here for the particular object being selected 
          
      } 
   } 
  
   private void jButton1_actionPerformed(ActionEvent e) 
   { 
      System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); 
     // TODO: Add any handling code here 
  
   } 
  
   private void jButton2_actionPerformed(ActionEvent e) 
   { 
      System.out.println("\njButton2_actionPerformed(ActionEvent e) called."); 
      // TODO: Add any handling code here 
  
   } 
  
   // 
   // TODO: Add any method code to meet your needs in the following area 
   // 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
   
  
 //============================= Testing ================================// 
 //=                                                                    =// 
 //= The following main method is just for testing this class you built.=// 
 //= After testing,you may simply delete it.                            =// 
 //======================================================================// 
   public static void main(String[] args) 
   { 
      JFrame.setDefaultLookAndFeelDecorated(true); 
      JDialog.setDefaultLookAndFeelDecorated(true); 
      try 
      { 
         UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); 
      } 
      catch (Exception ex) 
      { 
         System.out.println("Failed loading L&F: "); 
         System.out.println(ex); 
      } 
      new jFrame(); 
   } 
 //= End of Testing = 
  
  
 }

i wish this is the correct way to post the codes

where r u friends???????

where r u friends???????

You have not asked any question yet. You just dumped some code in your post. And posting in "IM-speak" won't earn you much help either.

1. you need coefficients to convert 8 currency among themselves 8*8
2. function to convert text values from JTextField to number

hi friends
first of all plz excuse my bad English...Actually English is my second language..

my question is where i should put the codes that will convert the currency? and what is the codes??

to be honest i have my friend project but i don’t wanna copy it i want to understand the codes...so plz can u give me simple codes and where i should put it??

thanks friends really u r very helpful

to be honest i have my friend project but i don’t wanna copy it i want to understand the codes...so plz can u give me simple codes and where i should put it??

What is the difference between you copying your friends code and you copying something we give you?

am sorry maybe u misunderstood me:(


friend there is big different

Copying my friends codes is easier than getting the codes from u..
i meant by simple codes. the codes that i will understand i believe that u will explain it to me...

friend i add some codes to my project but there r errors. the doctor wants every time i convert currency the history of converting should be stored in file…

here is my new codes plz run it

/****************************************************************/
/*                      CurrencyConvertor	                            */
/*                                                              */
/****************************************************************/
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.* ;
/**
 * Summary description for CurrencyConvertor
 *
 */
public class CurrencyConvertor extends JFrame
{
	// Variables declaration
	private JLabel jLabelFrom;
	private JLabel jLabelTo;
	private JTextField jTextFieldFrom;
	private JTextField jTextFieldTo;
	private JList jListFrom;
	private JList jListTo;
	private JButton jButtonCovert;
	private JButton jButtonClose;
	private JPanel contentPane;
	// End of variables declaration


	public CurrencyConvertor()
	{
		super();
		initializeComponent();
		//
		// TODO: Add any constructor code after initializeComponent call
		//

		this.setVisible(true);
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always regenerated
	 * by the Windows Form Designer. Otherwise, retrieving design might not work properly.
	 * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder
	 * to retrieve your design properly in future, before revising this method.
	 */
	private void initializeComponent()
	{
		ArrayList arr;

		jLabelFrom = new JLabel();
		jLabelTo = new JLabel();
		jTextFieldFrom = new JTextField();
		jTextFieldTo = new JTextField();
		jListFrom = new JList();
		jListTo = new JList();
		jButtonCovert = new JButton();
		jButtonClose = new JButton();
		contentPane = (JPanel)this.getContentPane();

		//
		// jLabelFrom
		//
		jLabelFrom.setText("From:");
		//
		// jLabelTo
		//
		jLabelTo.setText("To:");
		//
		// jTextFieldFrom
		//
		jTextFieldFrom.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e)
			{
				jTextFieldFrom_actionPerformed(e);
			}

		});
		//
		// jTextFieldTo
		//
		jTextFieldTo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e)
			{
				jTextFieldTo_actionPerformed(e);
			}

		});
		//
		// jListFrom
		//
		String[]ListFrom = new String[8];
		ListFrom[0]="USD:Utd States $";
		ListFrom[1]="EURO:Euro";
		ListFrom[2]="GBP:Utd Kingdom Pnd";
		ListFrom[3]="JPY:Japan Yen";
		ListFrom[4]="CAD:Canada $";
		ListFrom[5]="AUD:Australia $";
		ListFrom[6]="CHF:Switzerland Fr";
		ListFrom[7]="AED:Utd Arab Emirates Dhs";
		Container contentpane;
          contentpane = getContentPane();
          contentpane.setLayout(new FlowLayout());
          jListFrom = new JList(ListFrom);
          jListFrom.setSelectedIndex(0);
          jListFrom.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	
		jListFrom.addListSelectionListener(new ListSelectionListener() {
			public void valueChanged(ListSelectionEvent e)
			{
				jListFrom_valueChanged(e);
			}

		});
		//
		// jListTo
		//
		String[]ListTo = new String[8];
		ListTo[0]="USD:Utd States $";
		ListTo[1]="EURO:Euro";
		ListTo[2]="GBP:Utd Kingdom Pnd";
		ListTo[3]="JPY:Japan Yen";
		ListTo[4]="CAD:Canada $";
		ListTo[5]="AUD:Australia $";
		ListTo[6]="CHF:Switzerland Fr";
		ListTo[7]="AED:Utd Arab Emirates Dhs";

          contentpane = getContentPane();
          contentpane.setLayout(new FlowLayout());
          jListTo = new JList(ListTo);
          jListTo.setSelectedIndex(0);
          jListTo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		
		jListTo.addListSelectionListener(new ListSelectionListener() {
			public void valueChanged(ListSelectionEvent e)
			{
				jListTo_valueChanged(e);
			}

		});
		//
		// jButtonCovert
		//
		jButtonCovert.setText("Convert");
		jButtonCovert.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e)
			{
				jButtonCovert_actionPerformed(e);
			}

		});
		//
		// jButtonClose
		//
		jButtonClose.setText("Close");
		jButtonClose.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e)
			{
				jButtonClose_actionPerformed(e);
		
			}

		});
		//
		// contentPane
		//
		contentPane.setLayout(null);
		addComponent(contentPane, jLabelFrom, 17,25,60,18);
		addComponent(contentPane, jLabelTo, 227,27,60,18);
		addComponent(contentPane, jTextFieldFrom, 13,260,100,26);
		addComponent(contentPane, jTextFieldTo, 222,258,100,29);
		addComponent(contentPane, jListFrom, 13,50,196,184);
		addComponent(contentPane, jListTo, 228,51,191,185);
		addComponent(contentPane, jButtonCovert, 124,258,83,28);
		addComponent(contentPane, jButtonClose, 338,258,83,28);
		//
		// CurrencyConvertor
		//
		this.setTitle("CurrencyConvertor - extends JFrame");
		this.setLocation(new Point(0, 2));
		this.setSize(new Dimension(455, 344));
	}

	/** Add Component Without a Layout Manager (Absolute Positioning) */
	private void addComponent(Container container,Component c,int x,int y,int width,int height)
	{
		c.setBounds(x,y,width,height);
		container.add(c);
	}

	//
	// TODO: Add any appropriate code in the following Event Handling Methods
	//
	private void jTextFieldFrom_actionPerformed(ActionEvent e)
	{
		System.out.println("\njTextFieldFrom_actionPerformed(ActionEvent e) called.");
		// TODO: Add any handling code here

	}

	private void jTextFieldTo_actionPerformed(ActionEvent e)
	{
		System.out.println("\njTextFieldTo_actionPerformed(ActionEvent e) called.");
		// TODO: Add any handling code here

	}

	private void jListFrom_valueChanged(ListSelectionEvent e)
	{
		System.out.println("\njListFrom_valueChanged(ListSelectionEvent e) called.");
		if(!e.getValueIsAdjusting())
		{
			Object o = jListFrom.getSelectedValue();
			System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");
			// TODO: Add any handling code here for the particular object being selected
			
		}
	}

	private void jListTo_valueChanged(ListSelectionEvent e)
	{
		System.out.println("\njListTo_valueChanged(ListSelectionEvent e) called.");
		if(!e.getValueIsAdjusting())
		{
			Object o = jListTo.getSelectedValue();
			System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");
			// TODO: Add any handling code here for the particular object being selected
			
		}
	}

	private void jButtonCovert_actionPerformed(ActionEvent e)
	{
		System.out.println("\njButtonCovert_actionPerformed(ActionEvent e) called.");
		// TODO: Add any handling code here

            jTextFieldFrom.getText();
				int jTextFieldFrom = Integer.ParseInt();
				
				String jTextFieldFrom = "RATES.txt";
            String content = new String ("");

	         FileInputStream file = new FileInputStream(jTextFieldFrom);
            file.read();
				
				
				
				
				jTextFieldTo.getText();
				int jTextFieldTo = Integer.ParseInt();
				
				String jTextFieldFrom = "ConversionLog.txt";
            FileOutputStream file = new FileOutputStream(jTextFieldFrom);
            file.write();
				
				
	}


	private void jButtonClose_actionPerformed(ActionEvent e)
	{
		System.out.println("\njButtonClose_actionPerformed(ActionEvent e) called.");
		// TODO: Add any handling code here
           
			  String message = "Thank you for using Our Currency Convertor";
            
           JOptionPane.showMessageDialog(null,message);
           System.exit(0);
	}

	//
	// TODO: Add any method code to meet your needs in the following area
	//






























 

//============================= Testing ================================//
//=                                                                    =//
//= The following main method is just for testing this class you built.=//
//= After testing,you may simply delete it.                            =//
//======================================================================//
	public static void main(String[] args)
	{
		JFrame.setDefaultLookAndFeelDecorated(true);
		JDialog.setDefaultLookAndFeelDecorated(true);
		try
		{
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		}
		catch (Exception ex)
		{
			System.out.println("Failed loading L&F: ");
			System.out.println(ex);
		}
		new CurrencyConvertor();
	}
//= End of Testing =


}

//button convert:

String text = jTextFieldFrom.getText();
        int valueFromTextField = Integer.parseInt(text);
// calculate conversion
// write to jTextFieldTo
// write one row of history to output stream

Streams input & output you need open in CurrencyConvertor constructor , close if you exited from program.
Interesting is , what you have in "RATES.txt". You need properly read all info from RATES.txt.

hello friends,

i just want to thank u all 4 helping me...
i submited my project today but there r still some errors in input output files...
as so as i get the right codes from the doctor i will post it 4 u friends to get benefit :) plz wish 4 me my final exams will start next week.....

Can you post the codes up sooon? I neeed some help too.

Ask a question in a new thread if you need some help. Note that "help" doesn't mean giving you code to turn in for your assignment.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.