public void jTextArea2_keyTyped(KeyEvent e)

if (e.getKeyChar() == '\n')
System.out.print("got a new line");


int Count = jTextArea2.getLineCount();
int I_1,I_2=0; String expr = "";

I_1 = jTextArea2.getLineStartOffset(Count-2);
I_2 = jTextArea2.getLineEndOffset(Count-2);

expr = jTextArea2.getText(I_1, I_2-I_1);

catch(Exception ex){}

Hello everyone,

This is my code that is supposed to take text from the user typing it in and save it into a variable so I can send the expression to my parser class.

I am new to swing so I am not sure why this is not working. I also need it to keep reading in expressions until the user is done entering them.

It would go like this

User enters x + 4 -4 then hits enter
then the program would send this expression to my parser class and it would parse the equation

after this I need the program to wait for another expression to be entered ...

help please?