Positioning Cursor in JTextArea

Hi. Is there a method in JTextArea to scroll right up to the first character of the text? Whenever I set the text, the cursor scrolls all the way down to the last character. I'm only using JTextArea, not JEditorPane. Thanks.

Oops - you said JTextArea, not JTextField - in that case:
  JTextArea ta = ...;
  ta.setText( "Eat Me" );
  ta.setCaretPosition( 0 );:)

Similar Messages

  • How to Set Position Cursor Option to Non key fields in Table Maintenance .

    Hi,
    I have created a Ztable and i am using table maintenance for that table. In TMG ,by default  we have position cursor option to key fields only . User wants that position cursor option for non key fields also. Please help me out of this issue .
    How to provide Position Cursor option to Non key fields.
    Thanks & Regards,
    Prasad.

    Hi Nabheet,
    I tried using TYPE S DISPLAY LIKE E and am setting vim_abort_saving as X and sy-subrc as 4. However, this is also not enabling the fields. In this case, the first 2 fields - key fields are getting enabled but not the required ones. The above snapshot is for the same.
    lv_date1 = table1-date1.
       lv_date2 = table1-date2.
       lv_diff = lv_date2 - lv_date1.
       IF lv_diff LT 0.
         CLEAR: lv_err_msg.
         lv_err_msg = text-005.
         MESSAGE lv_err_msg TYPE 'S' DISPLAY LIKE  lc_e.
         vim_abort_saving = lc_x.
         sy-subrc = 4.

  • How can I set position of a JTextArea inside a JPanel?

    Hi,
    I'm trying to add a JTextArea to a JPanel. It works as expected but what can I do to alter the position of the JTextArea inside the JPanel? Right now the JTextArea is centered and starting at the top of the JPanel. I would like it to, either start one row down, or be centered vertically, depending on what looks the best.
    Tried to mark as question, but that option is gone once the message is posted it seems.
    Edited by: Red_herring on Nov 23, 2009 11:15 AM

    JPanels don't have "rows", so that probably isn't the best description of your requirement. But the short answer is that you do it with a LayoutManager. There's a tutorial about them. Google keywords: java layoutmanager tutorial, and look for the ones from Sun.

  • New at Java Swing, How to position cursor?

    I'm new at this, but I would like to know how to position a cursor in either a JTextField or JTextArea?
    Any help here would be appreciated.
    Tks Ran

    JTextField.setCaretPosition(newPosition);See also:
    http://java.sun.com/j2se/1.4/docs/api/javax/swing/text/JTextComponent.html#setCaretPosition(int)
    (sorry that the link doesn't work, but it's the forum, not the link... just browse downwards for setCaretPosition(int) )
    Cheers!

  • Position Cursor on GRAPH either by dragging it OR entering the dsired position in the Cursor legend

    I've written a VI that allows the user to import a dataset, view it on a graph, and then use cursors to "filter" the range of data that I'm interested in, by sending the cursor.index values from the first graph to an array subset function which feeds a second graph.  The problem is that I'd like to provide the user the ability to position the cursors on the first graph both visually - by dragging - (for "course" control) AND by entering the desired values directly into the cursor legend (for fine control).  The problem is that I cannot find a way to do this, since I have to have the Lock Ring set to “Lock to Plot” in order to capture the index information. According to the documentation, the only way to be able to position the cursors via the Cursor legend is to set the Lock Ring to “Free”, which means the index values are rendered useless, since the cursor is no longer locked to the plot.  If I leave the Lock Ring in "Lock to Plot", and enter a value in the cursor legend, it does move the cursor, but not to where it should.  If I enter a value an x value of 9.0 for cursor 1, the cursor goes to 10.2638.  The next time I enter 9.0, it goes to 9.82794.  I don't understand what the issue is.  Is there a way around this?
    Attachments:
    ppv data filter 3.vi ‏366 KB

    Yes Rudi:  What I want is for the operator to place the cursors by dragging them (just eye-balling it).  The, if they see that the Y cursor (horizontal) is at 10.234, and they want to make it 10, they could simply enter that value in the cursor legend, and the cursor would be placed exactly at 10.  The only way to do this seems to be to select the “Free” option for the cursor.  However, in order to use the first graph to set the boundaries of the second graph, I have to use the Cursor Index from the first as an input to the Array Subset that feeds the second graph.  In order to use the Cursor Index, the first graph has to have its cursor Lock Rings set to “Lock to Plot”.  Am I making this any more understandable, or just rambling?

  • How to Determine the coordinates of the cursor in JTextArea

    I've made an Editor and i'm trying to write down in a status line the position (Line and Column) of the cursor.
    How can I determine it.

    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.lang.*;
    public class yourclass extends JFrame implements MouseListener, MouseMotionListener{
    private JLabel statusbar;
    public yourclass(){
    statusbar = new JLabel();
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    c.add(statusbar, BorderLayout.CENTER);
    c.addMouseListener(this);
    c.addMouseMotionListener(this);
    setSize(300,300);
    show();
    public void mouseClicked(MouseEvent e){}
    public void mousePressed(MouseEvent e){}
    public void mouseReleased(MouseEvent e){}
    public void mouseEntered(MouseEvent e){}
    public void mouseExited(MouseEvent e){}
    public void mouseDragged(MouseEvent e){}
    public void mouseMoved(MouseEvent e){
    statusbar.setText("Moved at [" + e.getX() + ", " + e.getY() + "]" );
    public static void main(String args[]){
    yourclass app = new yourclass();
    app.addWindowListener(
         new WindowAdapter(){
              public void windowClosing(WindowEvent e)
    System.exit(0);
    hope it helps

  • Position cursor in text field when form is opened

    Another newbee question I'm afraid!
    I want to position the cursor in a text field when a user opens the form. I can't find a way to do it but I'm pretty sure it's straightforward!
    Also, can I remove fields from the tab order?
    Thanks (for your help and patience!)

    Hi,
    You would select the object that you want to receive focus and put the following in the docReady event.
    xfa.host.setFocus("this");
    The docReady event is a good one to use, because it only fires once.
    The tab order can be set in the Tab Order tab. Depending on the version of LC Designer that you have, the flexibility will vary. However I would do this as a last step, as any changes can throw the tab order out of sequence.
    Note that tab order is greatly affected by the relevant x/y coordinates of objects and where objects are in separate subforms.
    Hope this helps,
    Niall

  • Positioning cursor in editable text-field

    It is almost impossible to position the cursor in a text-field. Even though I have very thin finger it takes me more than two tries to position the cursor. Would be nice if on a future PlayBook-update the behaviour of text-selection and cursor-positioning would be improved. Works much better on Android-devices (okey, they often have a scrollball) and iPhone.
    Check out my apps in the BlackBerry World
    Visit my developer blogs /dev/alopix and /home/alopix
    BBM Channel: C0047B612

    i dont have that issue with my fat fingers anymore with some practice. are you lightly touching or mashing while you select? i found mashing to make it less accurate. remember it is the first part that touches that makes the selection and not the top of your finger or thumb.
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • Position Cursor on a specific SO line in VA01 / 02

    Hi,
      I have a requirement to do some validation in the User Exit, SAVE_DOC_PREPARE for VA01 / 02. If there is a Error, I want the cursor to be positioned on the specific line item which had this error. Please note the above exit gets called the user presses the 'Save' buttn, so this can happen from any screen.
    Regards,
    SG..

    why don't you do the same thing with incompletion log procedure...system will take the user to that particular field and he can proceed with 'save' option in both VA01/02.
    Reward Points if it helps,
    Regards,
    N

  • JTextField:  How to selectAll() AND Position Cursor at Beginning of Text

    Hi All,
    I have a problem with when a JTextField is selected, I cannot simultaneously selectAll() and position the cursor at the beginning of the text. (selectAll() positions the cusror at the end of the selected text, not the beginning, which is what I require).
    Does anyone have a solution for this as I haven't found an answer as of yet.
    Many thanks.

    Thanks uncle_alice, but as far as I have determined, the setCaret() and selectAll() methods are mutally exclusive. Why do people ask for help and then disagree with the answer given?
    Thanks uncle_alice, I tried the code and it works.It amazes me that it took half an hour to "try" the code. Why not try the code first, ask a followup question later if it doesn't work? Why do we have to waste time resonding to a question twice, just to get you to try the code?

  • Position Cursor on Field

    Hi All,
    I have a requirement to check if the field Delivery Note has a value when doing goods receipt via MIGO or MIGO_GR. If this field has a value, the system should issue an error message and the cursoe should be positioned in that field so that the users will know that they need to fill it in. My question is how will I make the cursor go to that field given that this is not a required field in MIGO?
    Thanks,
    Jim

    hi,
    use set cursor field for that particular field in the program.
    regards,
    keerthi

  • List Output - how to position cursor back to Page 1, line 5, column 90.

    Hello,
    I have a report program that calculates and writes a Grand Total at the end of a multiple page report.
    The program can not calculate the Grand Total until the end of the program.  Pages are displayed as Subtotals are calculated. My user wants the Grand Total to also be displayed at the top of Page one.    I am able to write to any line and column position just fine using the Skip to Line command.
    But I can not find a way to return to Page 1 then write the value.  I have tried
    SCROLL LIST TO FIRST PAGE   and I have tried to reset the sy-pagno value prior to the write
    statement.   Is there a way to page back and write to a report list?
    Thanks
    MPersson

    Check this sample code:
    Here page no like 1 of totpage is inserted to top of every page. Similarly u can display total to each page.
    REPORT ZLTEST3 NO STANDARD PAGE HEADING
    LINE-COUNT 65
    LINE-SIZE 80.
    DATA: NUM_PAGES_C(10) TYPE C.
    PERFORM WRITE.
    PERFORM GET_TOTAL_PAGENO.
    TOP-OF-PAGE.
    WRITE:/(SY-LINCT) 'TEST - TEST' CENTERED.
    WRITE: / SY-DATUM, 60 SY-PAGNO,'of', '*****'.
    SKIP.
    *& Form WRITE
    text *
    --> p1 text
    <-- p2 text
    FORM WRITE.
    DO 200 TIMES.
    WRITE:/ 'TEST', SY-LINNO.
    ENDDO.
    ENDFORM. " WRITE
    *& Form GET_TOTAL_PAGENO
    text *
    --> p1 text
    <-- p2 text
    FORM GET_TOTAL_PAGENO.
    WRITE SY-PAGNO TO NUM_PAGES_C LEFT-JUSTIFIED.
    DO SY-PAGNO TIMES.
    READ LINE 2 OF PAGE SY-INDEX.
    REPLACE '*****' WITH NUM_PAGES_C INTO SY-LISEL.
    MODIFY LINE 2 OF PAGE SY-INDEX.
    ENDDO.
    ENDFORM. " GET_TOTAL_PAGENO
    Note : this method only works in foreground

  • Positioning cursor in texteditor

    Hi all,
         How to set cursor in texteditor control in
    dynpro.
    Regards,
    bala

    Use the methods of class CL_GUI_TEXTEDIT.
    Try the method GO_TO_LINE.
    Regards,
    Ravi

  • Trouble positioning Cursor in Table Cell...

    Basically I have a left navigation table cell, and it
    includes many rows and an image in the cell.
    Well, I have to put this stupid "Authorize.net Verified
    Merchant" Seal in the Nav Cell. I want to put it at the
    bottom of the cell, underneat the red shield logo I made
    (see picture).
    The problem is that when I select the Horz and Vert for
    "Center", "Bottom" in Design View, the whole cell moves to the
    bottom. I just want to move the cursor down there so I can place
    the code for the Authorize.net Seal.
    http://www.blackreefdesigns.com/misc/example.png
    Please advise!

    <td width="164" height="195" align="left" valign="top"
    bgcolor="#333333"><table width="164" border="0"
    align="center" bordercolor="#CCCCCC">
    <tr>
    <td width="158" bgcolor="#CCCCCC"><div
    align="center" class="style28">PRODUCT
    CATALOG</div></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><div align="left"
    class="style7"><span class="style18"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=2">-
    AK</a></span></div></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><span class="style7"><a
    href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=4">-
    AR</a></span></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><span class="style7"><a
    href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=6">-
    FN/FAL</a></span></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=9"><strong>-
    HK</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=11"><strong>-
    SIG556</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=12"><strong>-
    SKS</strong></a></td>
    </tr>
    <tr bgcolor="#333333">
    <td> </td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=100"><strong>-
    CALIFORNIA COMPLIANT</strong></a></td>
    </tr>
    <tr bgcolor="#333333">
    <td> </td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=101"><strong>-
    RAILED FORENDS</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=13"><strong>-
    TACTICAL GEAR</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=7"><strong>-
    GUN CASES</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=14"><strong>-
    TACTICAL LIGHTS</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=87"><strong>-
    OPTICS &amp; MOUNTS</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=117"><strong>-
    NIGHT VISION</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=16"><strong>-
    HEARING &amp; EYE
    PROTECTION</strong></a></td>
    </tr>
    <tr bgcolor="#333333">
    <td> </td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=102"><strong>-
    MILITARY SURPLUS</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=103"><strong>-
    CLEARANCE</strong></a></td>
    </tr>
    <tr>
    <td bgcolor="#666666"><a href="
    http://www.adxtactical.com/store/pc/viewCategories.asp?idCategory=104"><strong>-
    MISC. PRODUCTS</strong></a></td>
    </tr>
    <tr bgcolor="#333333">
    <td> </td>
    </tr>
    <tr>
    <td bgcolor="#666666"><strong>- ADDAX GPU
    (COMING SOON)</strong></td>
    </tr>
    </table>
    <br>
    <table width="100%" border="0" align="left">
    <tr>
    <td><div align="center"><img src="logo.gif"
    width="160" height="230"></div></td>
    </tr>
    </table>
    <p align="center"> </p>
    </td>

  • XY graph cursor position bug

    I have reproduced the bug mentioned here:
    http://forums.lavag.org/Graph-Cursor-XY-Position-Bug-t1366.html&gopid=40859#entry40859
    I've reproduced this bug (?) in Labview 8.5, with an XY graph doing
    much the same as Jack. The attached zip file contains a stripped down
    version of my program (originally written by my coworker, Andrew
    MacDonald). Run "RENA3 Data Viewer.vi" and follow the instructions.
    As Jack said, changing Cursor.PosX to Cursor.Index solves the problem.
    I did not find this bug mentioned anywhere other than the above link.
    Fraser
    Attachments:
    XY Graph Cursor Bug.zip ‏142 KB

    Hi Karla,
    Sorry if that wasn't as obvious as I thought! :-)  Hopefully the attached image makes it clear.  On the front panel, 'Cursor Channel' is inputted.  This is directly wired to Histogram.Cursor.PosX.  Immediately following, Histogram.Cursor.PosX is read and wired to the front panel indicator 'Cursor.Cursor Position:Cursor X'.  There is always a difference of 15 or 16 between the two values.  If there was no bug, these two values should be identical!  I can only conclude that Labview is doing something funny...
    As I mentioned before, changing Cursor.PosX to Cursor.Index fixes the problem.
    A bit of background:  my FWHM function outputs the peak channel, and the cursor is supposed to go through the peak so you can have a visual check that it is analyzing the right peak.  I noticed that the line would never go through the peak; the line would always have an offset.  After wasting a couple of hours, it became clear that I was wiring the correct value into 'Cursor.PosX', but something was going wrong beyond that.
    Cheers,
    Fraser
    Message Edited by fjharris on 01-25-2008 11:34 AM
    Message Edited by fjharris on 01-25-2008 11:36 AM
    Attachments:
    Labview Bug.png ‏27 KB

Maybe you are looking for

  • Problem obtaining BitmapData for a canvas via Javascript

    Hi, For my web application I have one HTML button, which is outside of flash application shown on the same page. Via Flex application I've declared callback function to be called by Javascript in this way: ExternalInterface.addCallback("cbProcessButt

  • Extreme - Express - Ethernet - Best Practice Setup

    Hi, I have an Airport Extreme 'Creating' a WPA protected network in N (b/g) compatible mode. I have an Airport ExpressN (7.3.1) in another room, with a Ubuntu PC plugged in to it via the ethernet cable. My question is how best to set it up to allow t

  • Weblogic.jar file location in  CC&B Media

    Hi Guys Can anyone let me know the weblogic.jar file location in CC&B 2.2 media. Thanks Aleem

  • File sharing with ipad

    Can I access Windows machines with my iPad through my home network?

  • How do I uninstall the latest firefox update?

    I just updated to the latest version of firefox 13.0.1 and the update is not working correctly. Many websites do not display all the page and I need to get rid of this latest update. I need to go back to the previous version. How do I do this? This a