Line indicator for text Area??

for my text field , I used ::
TextArea tA01=new TextArea(20,30);
is there anyway or functions or methods that I can use to locate the current position of my blinking cursor ???
thanks....

why do you use a TextArea instead of JTextArea?
awt components are heavyweight, and most swing components are lightweight.
awt use the operating system graphic to draw the component (this makes it heavyweight). swing also use the system graphic to draw the component (top level component), but compoents such as JPanel, JButton, JTextArea, etc.. are drawn by the Java application over the toplevel component.
There are severals advantages of using swing.
1. your application gui will be rendered more correctly on different operating system
2. swing have more features that you can use
3. swing have more components

Similar Messages

  • Assign the line IDs for CO area 1000 version 0 RA key 000002

    Assign the line IDs for CO area 1000 version 0 RA key 000002
    Message no. KJ207
    Diagnosis
    You are attempting to perform WIP calculation or results analysis with results analysis version 0. However, the assignment of cost elements for the order or project to line IDs has not yet been defined for this results analysis key. controlling area 1000.

    Can you  tell me the T-code from which you are getting this error.

  • Line numbers in text area

    im using the class JTextArea of the swing class to view some text documents.
    How i can vies the number of lines of each document:
    i want the line numbers not in the document but as a part of the text area. for example:
    1:line 1
    2:something
    3:something
    4:sjdhfskjhsl
    Please help.Thanx

    You can do it in two ways.
    Place a JLabel on left of your Text Area, Add a KeyListener to the text area. On each ENTER key press count lines of JTextArea.getLineCount(). and paint your JLabel as well. Secondly you will need to move the JLabel as soon as the ScrollBar of JScrollPane will move.
    Second way is like:
    <code>
    import java.awt.Toolkit;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.text.BadLocationException;
    public class MyTextArea extends JTextArea{
    public MyTextArea(){
    super("1: ");
    setCaretPosition(3);
    addKeyListener(new MyKeyListener());
    class MyKeyListener extends KeyAdapter{
    public void keyReleased(KeyEvent e){
    try{
    switch(e.getKeyCode()){
    case KeyEvent.VK_ENTER:
    int position=getCaretPosition();
    int line=getLineOfOffset(position);
    insert((line + 1) + ": ", position);
    changeLineNos(line);
    break;
    case KeyEvent.VK_BACK_SPACE:
    position=getCaretPosition();
    line=getLineOfOffset(position);
    if(line > 0){
    int cLoc=getCollonLocation(position);
    int diff=position - cLoc;
    if(diff <= 2){
    replaceRange("", getLineEndOffset(line - 1) - 1, cLoc + diff);
    changeLineNos(line);
    } else{
    int cLoc=getCollonLocation(position);
    int diff=position - cLoc;
    if(diff <= 2){
    if(getLineCount() > 1){
    replaceRange("", 0, getLineEndOffset(0));
    changeLineNos(0);
    } else{
    setText("1: ");
    Toolkit.getDefaultToolkit().beep();
    break;
    } catch(BadLocationException ex){
    ex.printStackTrace();
    private void changeLineNos(int lineNo) throws BadLocationException{
    int total=getLineCount();
    if(total > lineNo){
    while(lineNo < total){
    int offset=getLineStartOffset(lineNo);
    int collonLocation=getCollonLocation(offset, lineNo);
    replaceRange("" + ++lineNo, offset, collonLocation);
    private int getCollonLocation(int offset, int lineNo) throws BadLocationException{
    return getText(offset, getLineEndOffset(lineNo) - offset).indexOf(':') + offset;
    private int getCollonLocation(int caretPosition) throws BadLocationException{
    int lineNo=getLineOfOffset(caretPosition);
    int offset=getLineStartOffset(lineNo);
    return getText(offset, getLineEndOffset(lineNo) - offset).indexOf(':') + offset;
    public static void main(String argv[]){
    JFrame frame=new JFrame();
    MyTextArea area=new MyTextArea();
    frame.getContentPane().add(new JScrollPane(area));
    frame.setSize(300, 200);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    </code>
    Regards,

  • Tab and next line characters in text area

    Hi,
    I have an issue with the textarea. The page is inserting /t and /n in the text I type in and everytime I save.
    I defined a text area like following in my jsp:
                   <textarea class="textarea_value" name="explanation" rows="5" cols="100">
                   <bean:write name="tiptrackerEditForm" property="explanation"/>
                   </textarea>
    css:
         .textarea_value {
              font-weight: normal;
              font-size: 12px;
         text-align: left;
         wrap: soft;
    When I type in a word in textarea, it saves without any /t or /n. But when retreive the data and load it into the form again, the page shows with an inserted tab (the word is moved to the right after inserting a tab). Everytime I save, it inserts a tab and /n characters. I know for the fact that the database or the form is doing this. It's in the jsp.

    Put the whole <textarea> element in a single HTML line without newlines and spaces.
    Thus, so:<textarea class="textarea_value" name="explanation" rows="5" cols="100"><bean:write name="tiptrackerEditForm" property="explanation"/></textarea>

  • Director imposes maximum line length for text?

    I'm trying to learn Director again after years away and so much has changed. I can't find the answer for this after searching. To the best of my knowledge, I'm using the default installed settings for Dir. 11
    I've been opening and updating old Dir. 6.5 files in Dir 11 and the text gets mangled. Long lines (10-20 inches) of headline text get the right side chopped off. My new movie size is 2560x1550 (for 30" monitor).
    I'm trying to recreate these long lines of headline text (most are 48 pt helvetica x 20 + inches wide, some much bigger pt. size) by typing it in the text panel. This is difficult to describe: After 20 inches of text, according to the ruler, Director begins condensing the whole line, compacting it more as the text panel double-vertical-line expander bar is dragged right and expanded, opening the text field so lines don't break to a second line. Director alters the letter width and spacing of the line more as the panel expander is dragged to the right, basically smashing the line of text flush left more with every increment the panel is expanded right. If the text entry panel is expanded to the full width of my 30" monitor before typing any letters, then all the characters subsequently typed are distorted and compressed as they are typed in.  This occurs with every font.
    What is going on here? How to create  line of live text longer than 20" that Director doesn't smash together?
    TIA!
    Mac OS 10.5.8 / MacPro 2 x 2.26 GHz Quad-Core Intel Xeon / 6GB ram / 30" Apple Cinema Display / Director 11

    Hi,
    I'm not following what's happening. Could you attach a sample DIR with the problem text? Otherwise, you could email the file at [email protected]
    Dean
    Director Lecturer / Consultant / Director Enthusiast
    http://www.deansdirectortutorials.com/
    http://www.multimediacreative.com.au

  • Need a JavaScript to enable/view Multi-line option for Text fields.

    Hello All,
    I need a JavaScript to enable/view Multi-line option for all the Text fields in PDF Form.
    Assume that I have a PDF form of Fields from F1 to F100 and it contains 25 Checkboxes, 25 Combo Box and 50 Text Fields. Now i need a javascript for which i need to enable Multiline for only Text Fields. So Is there any JS for which i can enable the Multiline option for only Text fields and not for ComboBox or Checkbox.

    Hi timo,
    Thanks for your help. iam trying to use the iteraor approch to do this. but i don't know how to fetch the data entered in the form that was built by the iterator. can you please tell me .
    thanks

  • ButtonMode for Text Area

    Hi,
    I'm hoping to use text areas as "buttons."  After setting a text area's buttonMode = true and editable = false, still no "hand."  Can this work?
    Thanks.
    Doug

    I tried this, but still no hand.  Please let me know if I implemented correctly (code below).  I wondering if my Flash Player might be the problem.
    <s:TextArea 
    x="1" y="87" width="147" height="42" text="5. Complete and Assign&#xd; in COMIT Tracking" borderVisible="false" toolTip="line one of text line two of text etc etc etc line three of text line 4 of text and on and on" useHandCursor="true" buttonMode="true" editable="false"/>
    Thanks.
    Doug

  • Carriage Return for text area

    Hello All,
    I have a text area that I am pre-populating from a column in a database and I need to do a carriage return. When inserting the information into the column I put 'chr( 10 )|| chr( 13 )||' after each place where I need to do a carriage return, for some reason it is not being saved in the database that way.
    The sql I used to insert the information into the column looks like:
    update 456.xyz
    set 123 = a || chr( 10 )|| chr( 13 )||
    b || chr( 10 )|| chr( 13 )||
    c || chr( 10 )|| chr( 13 )||
    where abc=def;
    I need the output in the text area to be:
    a
    b
    c
    But it populates as:
    abc
    Any help would greatly be appreciated!

    I just tested this code:
    select 'The date '||sysdate||chr(10)||'is a '||to_char(sysdate, 'DAY')||chr(10)||chr(13)||'Week :'||to_char(sysdate, 'WW') from dual;The output was:
    The date 03.06.2010
    is a TORSDAG
    Week :22I put this in the source of the textarea and set it to update and replace content ( source used always )
    Edited by: Olav Alexander Mjelde on Jun 3, 2010 1:17 PM

  • FXML - Line break for text-attribute (LABEL)

    Hi!
    How to define a text with a line break for a label in FXML?
    For example, I cant get this to work (\n):
    <Label text="Break\nLine"/> Thanks,
    Jörn

    Hi,
    If you use SceneBuilder Developer Preview 1.1 you will see that SceneBuilder generates this:
       <Label layoutX="266.0" layoutY="172.0" text="Break&#10;Line" />To enter a new line in a text label in SceneBuilder is easy (even though a bit hidden).
    If you hover the mouse over the label text property in the Inspector (right hand side), you will see a little cog menu fading in. If you click on it - you will be able to 'Switch to multi-lines mode' - you can then enter a text with new lines - then save the file and see how it's been handled...
    hope this helps,
    -- daniel

  • Print Preview for Text Area in Web UI

    Hi,
    The notes section has text area in WEB UI. After typing in the text with more than 10 lines, and directly going to browser's print preview is not showing all the text entered. Instead it shows only 5 lines of text. But my client's requirement is to see all the text and take print out. I tried chaning the CSS of THTMLB_STYLES ( thtmlb_stand.css) with the below statement, but it didnt work.
    <style>
       @media print {
          content {
             overflow: visible;
    </style>
    Please suggest a solution.
    Thanks
    Manassha

    Hi ,
    Can you please elaborate on this.
    I have tried doing what you said but didnt face any issue....
    Regards,
    Ravikanth

  • Way to get line count from text areas?

    the getLineCount method on JTextArea only returns the number of linebreak characters in the stream, but I am looking to get the number of rows the text is taking in the text area. When you have word wrap activated, and the text wraps around, no linebreak is inserted so the getLineCount method will return a wrong number. anyway to get around this?

    http://forum.java.sun.com/thread.jsp?forum=57&thread=122550

  • Line separator for text files

    Hello
    I am writing a tab limited file which gets its data from a string[][] array . When i try opening the file its messed up with square blocks in notepad and looks great with wordpad. I do know that Unix has '\n' as the line separator, whereas windows has '\r\n' and mac has '\r'.
    The problem is the file is created on unix system, but its opened on windows or mac systems. Does anyone has a suggestion how can i fix this. I did tried using 'line.separator' but that doesn't help..which is obvious since it uses the unix separator.
    Please let me know if anyone can help
    I am writing to the file using PrintWriter
    thanx

    isn't there a way just to know whats the line
    separator used in the original file?The following will check out the line separator of a file..
    final public class TestSeparator{
    public static void main(String[] args) throws Exception{
    java.io.BufferedReader br =null;
    int k=0x0,temp=0x0;
    try{
    br =new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream("TestSeparator.java"),"UTF8"));//file and encoding are arbitrary
    while((k=br.read())!=-1){
    if((temp==(char)0xd)&&(k!=(char)0xa)) System.out.println();
    if(k==(char)0xd||k==(char)0xa){
       if(k==(char)0xd) {
          System.out.print("r");
       if(k==(char)0xa) {
          System.out.print("n");
        if(temp==(char)0xd||k==(char)0xa) System.out.println();
        temp=k;
    }//end of while
    System.out.println("");
    }finally{
         if(br!=null) br.close();
    }

  • Text Area in Web Dynpro

    Hello,
    I would like to use a <b>text area</b> in Web Dynpro for Java. The content of this text area shall be transferred to the ERP backend system using an own RFC function module. In the backend the text information (text format & text line) shall be stored using the standard text function.
    How can I get the text format (such as ‘* ‘for left justified or ‘C’ for center) and the text lines from the text area defined in the Web Dynpro application?
    Does a text area function in Web Dynrpo exist to handle texts and formats?
    Thanks for your hints in advance.
    Regards,
    Kurt.

    Hi
    You can use string operations to retrieve the lines entered in the TextArea.
    e.g.you can retrieve the enter and return index by indexOf("\r\n",beginIndex) method of string.Which gives you the index of the new line character starting from beginIndex.Now you can get the substring between beginIndex and this index by above function(which is actual text in the line) and then you can set this line to the tline of your RFC.
    You can loop this until the whole String assigned to the Text area is covered.
    Regards,
    Ajay

  • Text Area - Urgent

    Hello,
    I have a string lets say..Hello World.... i want to get this string displayed as
    Hello
    World
    in a text area... i have tried embedding CRLF characters but it doesnt work. Please help me.. its urgent
    Thanks in advance

    thanks for the reply. It works fine for me on the console... but text area has a strange behavior.. i.e. when I read a multiple line string from text area... then it contains only Line Feed (ASCII value 10) character. When i write the same string back to text area... it does not go to next line..like
    Hello
    World
    becomes HelloWorld
    Please reply as soon as possible
    Thanks in advance

  • Creation of Line Item for TDS

    Hi
    I am facing an issue while posting the vendor invoice. When posting the vendor invoice, system is automatically creating a debit entry to TDS account for Ecess, whereas the other Line items for TDS are created correctly. We have maintained the posting keys, and the account assignment is also there for both debit and credit parts. The tax code and tax types are correctly assigned to the vendor master and the rates maintained are also correct. The system is giving this error for the particular tax code for INV and PAY for one particular section, say Sec 194H
    Regards
    Sanil Bhandari

    Hi Sanil,
    In CIN, surcharges like Education Cess are automatically shown separately from the basic taxes and are over and above the basic withholding tax, why because this is mandatory as per IT Act. For that to function, please check IMG>Tax deducted at Source>EWT>Calculation of Surcharges, to see whether you have maintained settings for separate line item.
    S Jayaram

Maybe you are looking for

  • Configuring WLS to invoke a web service on SSL

    Hi, It will be really helpful if I get some pointers on this. Stuck with this without any progress. I havent experimented too much working with Certificates and so on... I have a web service on my WLS...This has to invoke an external web service (pro

  • Strange SMS problem - stumped the Genius bar

    My wife and I both have 3GS phones on a family plan. We are able to send and receive text messages freely from each other and anyone else. I can send SMS (pics and video) to her and anyone else, and she can receive. She can send SMS to everyone EXCEP

  • [SOLVED] Dual boot windows 7 and arch Linux with seperate hard drives

    Ok so I'm stuck trying to get my computer to dual boot windows 7 and arch. They are installed on different hard drives and I have grub 2 as the boot loader. I can't find any tutorials on how to do it with seperate hard drives I know how to do it if t

  • Totals for Groups not adding

    Hello, I created a report for our Scheduling team here and I thought it was working nicely and someone found  that my totals are not adding up. In the Group Header Reset I have: WhilePrintingRecords; Shared NumberVar PastDue :=0; Shared NumberVar Day

  • What's up with this awful new calendar?  Cannot change start time!

    Ever since "upgrading" to Mavericks 10.9 I cannot change the start time on an event.  It's not clickable.  Only the end time is.  If I click the start time nothing happens.  If I click the end time I can adjust it easily.  What's up with this?