0

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()); 
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by NormR1
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.