I am writing a Chess game using Java and Swing... However there is this one problem I have...
At the bottom of my game, I have a status bar which tells users about the currently state or program, and other things... I used a JTextArea for the status bar... this bar has to be scrollable too so users can look back at what happened...
I used a ScrollPane to make the JTextArea scrollable, like this:
new JScrollPane( statusBar, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)
And whenever I want to output new strings into the status bar I just append it to the JTextArea...
My problem is, when I add new stuff to the status bar, the JTextArea does not automatically show the newly added strings... instead users have to scroll down everytime to view the new strings... is there a way to make it so that the newly added strings are visible automatically?
I tried searching for documentations on this at Sun's website... but no luck... anyone know?
At the bottom of my game, I have a status bar which tells users about the currently state or program, and other things... I used a JTextArea for the status bar... this bar has to be scrollable too so users can look back at what happened...
I used a ScrollPane to make the JTextArea scrollable, like this:
new JScrollPane( statusBar, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)
And whenever I want to output new strings into the status bar I just append it to the JTextArea...
My problem is, when I add new stuff to the status bar, the JTextArea does not automatically show the newly added strings... instead users have to scroll down everytime to view the new strings... is there a way to make it so that the newly added strings are visible automatically?
I tried searching for documentations on this at Sun's website... but no luck... anyone know?