am trying to load a csv file on my application which allows the action listener to call a readfile method and displays the 2d array on the file to the textarea.
i am getting a compliation error of such.
pls how do i rectify this

setText(java.lang.string) in javax.swing.text.jtextcomponent cannot be applied to (java.lang.string[][])

public void actionPerformed(ActionEvent event)
    // "Load File is pressed
    {
        if( event.getSource() == buttonEnterNumber)
        {
         String input = textFieldInput.getText();
         String fname = input;
          ReadIt r = new ReadIt( fname);
          textAreaOutput.setText( r.readFile()); 

setText(java.lang.string) in javax.swing.text.jtextcomponent cannot be applied to (java.lang.string[][])

The error message says that you are using the wrong argument with the setText() method.
It wants a String and you are using a 2Dim String array.
You will need to use loops to get the elements out of the array and add them to the textarea.

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.