So I\'m stumped. I, for some reason, seem to remember that Java does weird things when you try to add new lines to stuff... so I think that may be the problem here.
Thi
EDIT
I have created a quick piece of code to add a KeyListener onto a JTextArea and this works fine. You don't need to particularly watch for an Enter key being pressed. How is this different from the rest of your code? (If you could paste more of it, that would be helpful.) I sort of feel like your KeyListener is not doing something properly. Are letters typing when you type? Try just taking out the if statement where you check for ENTER and see if that helps.
public class TestGui {
private JFrame frame;
private JTextArea textArea;
public TestGui() {
frame = new JFrame();
frame.setSize(200, 200);
textArea = new JTextArea();
textArea.setSize(200, 200);
frame.add(textArea);
// Notice that I don't do anything inside this listener.
// It doesn't need to be here.
textArea.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void keyTyped(KeyEvent e) {
}
});
frame.setVisible(true);
}
public static void main(String[] args) {
TestGui gui = new TestGui();
}
}