Current Position:Home > About JTextArea and JScrollPane question

About JTextArea and JScrollPane question

Update:11-30Source: network consolidation
Advertisement
I make a swing program to run a test,a JTextArea can display the test content ,and the content increased continuously,but the vertical scroll bar is always on the top .I want the vertical scroll bar at the bottom at all time so that we can read the newest content from JTextArea.
How can I do?

The Best Answer

Advertisement
textArea.setCaretPosition( textArea.getDocument().getLength() );
  • About JTextArea and JScrollPane question Update:11-30

    I make a swing program to run a test,a JTextArea can display the test content ,and the content increased continuously,but the vertical scroll bar is always on the top .I want the vertical scroll bar at the bottom at all time so that we can read the n

  • Error using JTextArea with JScrollPane Update:11-30

    hi, I am using JTextArea with JScrollpane. I am getting a problem in selecting the text in text area. I am searching for some text in the text area and selecting it if search successful. The problem is that the the scrollbar position didnt set to the

  • JTextArea in JScrollPane behaves strange Update:11-30

    Hello, in my Swing-UI I use a JTextArea which I embed into a JScrollPane. I use the setRows/setColumns methods to set the prefferedSize of the JTextArea which works nicely. However if the JTextArea is set to a smaller size than its preffered size (e.

  • JScrollPane questions Update:10-11

    Hi, I have two questions regarding JScrollPane: 1) I have a JPanel inside a scrollpane, but setViewportView() doesn't seem to work too well. Could anyone give me a better idea how to set the viewport view, an example perhaps? The tutorial doesn't go

  • JScrollPane Question Update:11-30

    Hi, I am writing a simple java GUI application that feeds real-time data to surgeons during a brain surgery. I am using a JTextArea component inside a JScrollPane to display information. As the data get more than the window can display, the horizonta

  • Anchoring view to bottom of JTextArea within JScrollPane Update:11-30

    I've got a JTextArea that will be updated asynchronously with text of unknown length. I want the view to move to the bottom every time text is added. I've read through the API for JScrollPane, JScrollBar, JViewports etc. but haven't been able to figu

  • JTextArea(Field) & JDropMenu Questions Update:11-30

    I am wondering how to take the values put in by a user into a TextArea(TextField) and a ComboDrop(DropMenu) and have whatever is inserted into them saved into a document using FileWriter/PrintWriter... I have the plain textboxes working by using the

  • JTextArea within a JScrollPane Update:11-30

    Hi! I've searched through the Project Swing archive and found lots of questions regarding how you ensure that when text is entered into a JTextArea control (via the append() method) the JScrollPane automatically scrolls to the position where the text

  • Setting JTextArea text within a JScrollPane Update:10-11

    Hey all. I'm attempting to use the setText() method of JTextArea to set the text of various areas located in various scroll panes. The general procedure I'm following is to initialize a new JTextArea and JScrollPane within an initializeGui function,

  • JTextArea Formatting Questions Update:10-11

    How can I add a Scroll Bar to the JTextArea in the following code, I have tried adding it, as one can see below, however no matter what I seem to change, the scroll bar does not appear. If anyone could help me I'd grealtly appreciate it. public class