I have created a JTextArea in which I have created a variable which is incremented when a button is clicked. However I want the incremented number to be displayed in the next Line and the old value stay in the previous line.
Till now I have coded the following for action listener and it is incrementing but replaces the old value and does not display on next line:
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getActionCommand().equals("Inc"))
{
String h = "/n";
int result = Integer.parseInt(area.getText())+1;
String aString = Integer.toString(result);
area.setText(String.valueOf(aString));
}