Is it possible(lines numbering JTextArea)?

is it possible to have the line numbers on the margin of the JTextArea? what i am looking for is something like what is in JCreator, and CuteHTML.
sample code is appreciated

Well two ways I can think of:
1. Create a custom 'Document' class that inserts line numbers and keeps track of where they should be (in the beginning of each line) as editing is performed.
This seems more cumber some.
2. Create a container that is composite of JTextArea on the right, and a panel on the left that contains line numbers. As user scrolls, update the numbers in the panel on the left, making it look like it's part of the JTextArea.
I am sure there are many more ways to do this.

Similar Messages

  • Is it possible to view line numbers in the search results in Dreamweaver CS5?

    Is it possible to view line numbers in the search results in Dreamweaver CS5?
    If so how do I switch it on.
    Thanks

    I don't think so. 
    Just double click on results in your Results Panel. 
    DW will open the page to that line of code.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/

  • Is it possible to obtain line numbers in the stack trace of an exception

    Is it possible for e.StackTrace in the following code to contain line numbers?
    try
    catch(Exception e)
    LogStackTrace("Stack Trace:" + e.StackTrace);}
    Hong

    Thank you for your response.
    The linked article is for Windows Phone and it points out "it's not possible to deploy the PDB alongside the EXE/DLL". Is this also the case for Windows Store app, or Windows Store app is different and it can be deployed with a .pdb file as you
    pointed out?
    The Windows Store app package is like the following:
    My App_1.3.0.5_AnyCPU.appxupload
    It is a zip file that contains the following two files:
    My App_1.3.0.5_AnyCPU.appx
    My App_1.3.0.5_AnyCPU.appxsym
    Hong

  • Line Numbering? Possible?

    does Pages do line numbering? can't find it anywhere. Thanks,
    armando

    Hi Jerrold
    I respond here because maybe it would be useful for other users.
    (1) Enter the MobileMe Web. Just type www.me.com, Safari will complete by itself.
    (2) click the white gear on the right side of the window to get the "Actions" menu.
    (3) Click the "Preferences" menu item to display  … the preferences pane.
    I guess that you checked the checkbox which I pointed with the yellow arrow.
    Uncheck it and your Public folder will be "Read enabled" for everybody.
    For safe, I never allow forum users to write in this folder.
    When they need to send files, I urged them to post the files as attachments or to use a free service like YpuSendIt.
    Hope that I was clear enough.
    Yvan KOENIG (VALLAURIS, France) samedi 23 avril 2011 21:34:13

  • 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,

  • How to print line numbers in NWDS for Java?

    Hi everyone,
    does someone know how to print out program code with line numbers from the Netweaver Developer Studio for Java? This is inevitable for code reviews.
    In Eclipse 3.4 this issue is solved. Is there possibly such a patch for NWDS as well?
    Thanks,
    Maria

    Hi Pascal,
    thanks for the quick reply. The setting you mention displays line numbers on the screen alright, but printing out does not work.
    We use: SAP NetWeaver Developer Studio for SAP NetWeaver 7.1 SP06 PAT0000, Build id: 200807051938.
    I guess it just does not work, because it was fixed only for Eclipse 3.4, and the above NWDS version bases on Eclipse 3.3.
    What do you recommend for code inspections - copy/paste into PSPad or do you know a more comfortable practice?
    Greetings
    Maria

  • Weird chars at end of line in JTextArea

    I am getting these weird characters at the end of the line in JTextArea when I use setText.
    I am doing the foll:
    //Creation of JTextArea
    JPanel p2 = new JPanel(); // for JTextArea and video
    displayText = new JTextArea(15,30);
    JScrollPane scrollPane = new JScrollPane(displayText);
    p2.add(scrollPane);
    //Wrapping the lines
    // I read the lines from a file, set a text and use foll code to wrap the lines.
    setLineWrap(true);
    setWrapStyleWord(true);
    The text from the file is displayed correctly. But the last line of the para is filled by weird characters like [] ( to complete the line I guess).
    Any idea of this strange behaviour?

    Hi,
    it seems that this text, you have read in, is not plain ASCII-text - perhaps there are some special byte sequences at the beginning of a paragraph, that you will have to filter out during input. Unfortunately that requires in most cases, that you know the basics about that format you want to read in.
    You said, you see [ like characters - hm ... ANSI-Sequences start with ESC [ - if you see something like this "[30;41;1m" with a weird char before it, that is an ANSI-Sequence specifying forground-color, background-color and bold for example. Also ESC [ 1m is possible, there are not all parts needed.
    If you have found out, which format that is, that your text file has, you can write a subclass of FilterInputStream to filter out these characters during you read it in.
    greetings Marsian

  • Showing Line Numbers?

    Hi,
    I write news articles for peer review, and one of the main features that I need to display in my drafts are the line numbers for every line. I've tried to search around the pages help as well as these forums, but I'm not finding a solution as to how to display the line numbers in the document as well as on the printed page. Any help? Thanks...
    -Owen

    Hi OwenStratospherical,
    Welcome to Numbers discussions.
    There isn't any built-in way to have line numbers. One possible suggestion, not elegant, is to create a Text Box to the left of the page then using the number keypad enter line numbers in that Text Box. As I said it isn't elegant but, it does work for me when I need it.
    Yes line numbering would be a nice feature for sure.
    The folks on these forums, discussion boards, are end users as yourself not Apple employees. Accept my suggestion for you to please at the top of your screen to the right of the blue Apple click "Pages" > "Provide Pages Feedback". This makes your request known to the Pages team directly. I've sent many as well.
    Let's hope that the next version of Pages (iWork) will incorporate many of the requested enhancements.
    Thank you in advance for doing that.
    Sincerely,
    RicD

  • Insert line numbers

    How do I insert line numbers in a text document in pages?  Or is this not possible?

    The feature is not available! There are workarounds. See on the right under More Like This

  • What is the proper way to record line numbers in Master/Detail records?

    Guys and Gals,
    Been thinking about this for awhile, but thought it best to ask the people who really know what they are doing.
    What is the proper way to record & show line numbers in a Master / Detail record set?
    For example, take Master/Detail relationship Orders and OrderItems. Orders has a column Document_Number and OrderItems has Document_Number, Line_Number. Line_Number should contain the row number 1,2,3,4 ... etc. for each row in a document.
    Should I ...
    <ol><li>Add a sequence and a trigger in the database? The FusionOrderDemo does this, but then the sequence never "resets" and I've got row numbers that keep incrementing. So one document has rows 4,5,6 and the next document has 7,8,9 when they should both have 1,2,3.</li>
    <li>Programmatically take care of the row numbers? This seems like I'm asking for trouble. Anytime an insert or delete operation gets done, I'll have to iterate through rows and re-assign row numbers.</li>
    <li>Is there a way to assign row numbers in a table iterator (or data collection?) to an entity?</li></ol>
    Any suggestions would be appreciated. It's looking like #2 is my only option, but if anyone knows different I'd love the input.
    Will

    Thank you both guys.
    As John said, I believe I'm looking for a gap-free sequence per master record.
    The line number of the OrderItems table is the second half of the primary key. The first half of the primary key (DocumentNumber) is the foreign key to the Orders table.
    Think of it like line items on an order or invoice. For example, if you were talking to someone on the phone concerning an invoice, you might say, "The pricing for line item #3 is incorrect." In this case, it's good to have a common reference. Or imagine a Microsoft Excel spreadsheet with no row numbers displayed! You'd never get anywhere if you had to explain something over the phone.
    If this is tricky to perform, I take it using a sequence and trigger such as the Fusion Order Demo is the best way to approach the challenge for simplicity's sake?
    Will

  • How to print continue Line Numbers  in PLD  Differen repetitve areas.

    Hi,
    We need to print line numbers continues in different Repetitive areas.
    Ex. Repetitve Area 0 we have item Discriptions
          Repetitve Area  Footer1 we created sotvalue() here it will display servicetaxes
          Repetitve Area Footer1 we created one text roundoff
    we need output like
    Ex:1. Dell        **Repetitve Area 0****           
          2.Mouse     **Repetitve Area 0****           
          3.Laptop      **Repetitve Area 0****             
          4.servicetax   **Repetitve Area Footer1****           
          5.cess             **Repetitve Area Footer1****           
          6.Hcess             **Repetitve Area Footer1****           
          7.Roundoff           **Repetitve Area Footer1****    as a text field       
      for above all we need to print Line numbers sequence how we can print sequence numbers for differen  areas.if i  assigned Linenum( ) in Repetitve Area 0 it will display one for Repetitve Area 0 only.and i applied Gouplinenum also it's not printing. please guide me how to print this.
    regds,
    sampath kumar devunuri.

    Hi,clint pow.
    Please we did what you said but we are not retreiving data.please tell me how we can get serieal numbers for different repetitve areas.
    regds,
    sampath.

  • Task Line Numbers Move Out of Order When Adding Resource to a Task

    I am using MS Project 2013 and we are in the process of setting up Project Server 2013. 
    When I add a resource to a task and close the summary task and re-open the task is moved to the bottom of that section and the line numbers are out of order.
    For example line number 382 is the third task under the summary task.  When I add a resource, hide the subtasks and then expand the subtasks line number 382 is now at the bottom after line 389.  The line numbers then go 381, 383, 384... until 389
    then 382 is after 389.
    I want to keep the tasks in sequential order.
    Has anyone seen this problem before?  I have done extensive research online and cannot seem to find any one with a similar issue.
    Thank you! :)

    Hi Dnbree,
    Do you have any filters applied to the view in Project Pro? Try to change view and check if you experience the same issue.
    Also check if the view uses a sorting in the view tab of the ribbon, such as sort by resources.
    Hope this helps.
    Guillaume Rouyre - MBA, MCP, MCTS

  • Bug with Worksheet Line Numbers in 2.1?

    I'm seeing an "issue" with line numbers enabled in the worksheet. When i have a plsql block with nested procedure/functions, and I collapse/expand the nested code, the line numbers in the worksheet don't consistently update till I resize the window.
    Example)
    1 [-] declare
    2 [-]   function f1
    3       return number
    4       as
    5         return null;
    6       end f1;
    7     begin
    8       dbms_output.put_line(f1) ;
    9     end;
    10    /turns into this when I collapse:
    1 [-] declare
    2 [+]   function f1...
    3     begin
    4       dbms_output.put_line(f1) ;
    5     end;
    6     /but turns into this when I resize sel developer:
    1 [-] declare
    2 [+]   function f1...
    7     begin
    8       dbms_output.put_line(f1) ;
    9     end;
    10    /I'm using the 2.1 release with the included JDK on a WinXpSP2 box.

    Hi Dylan,
    Thanks for this feedback.
    I have log a bug for tracking.
    Bug 8982049 - FORUM:LINENUMBER IS GUTTER NOT REFRESHED AFTER FOLDING
    Regards,
    Dermot.
    SQL Developer Team

  • How to insert line numbers in InDesign CS5

    I am creating a document that needs to have line numbers appear every for every 5 lines of text. Using the list function, I can get a number for every line, but can't find a way to just number line 5, 10, 15, 20, etc.
    All help appreciated,
    Cathy

    Thanks for the prompt reply, Bob, but from what I read in the comments on the script is that it inserts line numbers for every line and has no options for customizing to show numbers for only lines 5, 10, 15, etc. Also, using the list function in InDesign on selected text I can get the same result (including multi page if I select all text) and then convert the auto list numbers to text, which would allow me to remove unwanted numbers and leave just the ones I need (although that would be a painful manual process for a longer document.).
    Am I missing something about the script?
    I must admit that I'm shocked that this isn't a built in capability in InDesign!

  • JSP compiler obfuscates generated servlet debug line numbers

              Here's something that's been baffling me for a couple of days now.
              When WebLogic parses a JSP into servlet Java source, and then compiles the Java
              source into a class, it seems to perform a further step to obfuscate debug line
              numbers in the _jspService method. This converts the debug line numbers from Java
              source code line numbers into JSP line numbers.
              At first sight, this may appear to be useful- it means that when an exception
              is thrown then it references a line number in the original JSP rather than one
              in the generated servlet. However, it actually makes life more difficult when
              you consider included JSPs.
              Suppose you have a file loginresult.jsp, which uses @include to include a header.jsp
              and footer.jsp, both of which contain dynamic content. When WebLogic converts
              line numbers, it ignores the JSP that the code came from, so this causes a many-to-one
              mapping of line numbers. When an error occurs, the exception will tell you the
              line number that it came from, but it won't tell you which JSP caused it. The
              many-to-one mapping ensures a loss of information- and no way of retrieving the
              real line numbers.
              This is an even bigger nuisance when trying to debug JSPs- the debugger hops around
              in the generated servlet file without giving any clue as to whereabouts it really
              is in the code.
              My question is: is there any way of switching off this post-processor behaviour?
              One obvious way would be to locate the WebLogic class that does this post-processing,
              stub it out and run WebLogic with this class higher up in the classpath. But that's
              a last resort.
              Secondly, would there be any other impact in turning off this behaviour? Do other
              parts of WebLogic rely on this?
              Thanks in advance,
              Kevin.
              

    Actually, this option turns line-number table replacement on and off, for example,
              with jsp like this:
              test.jsp
              <%
              throw new Exception();
              %>
              and weblogic.xml:
              <!DOCTYPE weblogic-web-app PUBLIC "-//BEA
              Systems, Inc.//DTD Web Application 7.0//EN"
              "http://www.bea.com/servers/wls700/dtd/weblogic700-web-jar.dtd">
              <weblogic-web-app>
              <jsp-descriptor>
              <jsp-param>
              <param-name>debug</param-name>
              <param-value>true</param-value>
              </jsp-param>
              </jsp-descriptor>
              </weblogic-web-app>
              the stacktrace looks like this (note line number 2 - this is JSP line number):
              java.lang.Exception
              at jsp_servlet.__test._jspService(test.jsp:2)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:376)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
              at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5360)
              at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2468)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
              and with debug option turned off:
              <!DOCTYPE weblogic-web-app PUBLIC "-//BEA
              Systems, Inc.//DTD Web Application 7.0//EN"
              "http://www.bea.com/servers/wls700/dtd/weblogic700-web-jar.dtd">
              <weblogic-web-app>
              <jsp-descriptor>
              <jsp-param>
              <param-name>debug</param-name>
              <param-value>false</param-value>
              </jsp-param>
              </jsp-descriptor>
              </weblogic-web-app>
              exception stacktrace looks like this (note that line number now is from generated .java file):
              java.lang.Exception
              at jsp_servlet.__test._jspService(__test.java:87)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:376)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
              at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5360)
              at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2468)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
              Kevin Thomas <[email protected]> wrote:
              > But this isn't useful, as you don't know which JSP the line number is referring
              > to! (did it come from the main JSP, or one of the files that it included?)
              > Turning debug off is not an answer- because that will lose other useful information
              > that is useful to the debugger.
              > Kevin.
              > "Dimitri I. Rakitine" <[email protected]> wrote:
              >>Actually, this is useful when you want to debug .jsp's and not generated
              >>..java files. Did you try setting 'debug' jsp-param in the weblogic.xml
              >>to
              >>false? I think it turns class postprocessing on and off.
              >>
              >>Kevin Thomas <[email protected]> wrote:
              >>
              >>> Here's something that's been baffling me for a couple of days now.
              >>
              >>> When WebLogic parses a JSP into servlet Java source, and then compiles
              >>the Java
              >>> source into a class, it seems to perform a further step to obfuscate
              >>debug line
              >>> numbers in the _jspService method. This converts the debug line numbers
              >>from Java
              >>> source code line numbers into JSP line numbers.
              >>
              >>> At first sight, this may appear to be useful- it means that when an
              >>exception
              >>> is thrown then it references a line number in the original JSP rather
              >>than one
              >>> in the generated servlet. However, it actually makes life more difficult
              >>when
              >>> you consider included JSPs.
              >>
              >>> Suppose you have a file loginresult.jsp, which uses @include to include
              >>a header.jsp
              >>> and footer.jsp, both of which contain dynamic content. When WebLogic
              >>converts
              >>> line numbers, it ignores the JSP that the code came from, so this causes
              >>a many-to-one
              >>> mapping of line numbers. When an error occurs, the exception will tell
              >>you the
              >>> line number that it came from, but it won't tell you which JSP caused
              >>it. The
              >>> many-to-one mapping ensures a loss of information- and no way of retrieving
              >>the
              >>> real line numbers.
              >>
              >>> This is an even bigger nuisance when trying to debug JSPs- the debugger
              >>hops around
              >>> in the generated servlet file without giving any clue as to whereabouts
              >>it really
              >>> is in the code.
              >>
              >>> My question is: is there any way of switching off this post-processor
              >>behaviour?
              >>> One obvious way would be to locate the WebLogic class that does this
              >>post-processing,
              >>> stub it out and run WebLogic with this class higher up in the classpath.
              >>But that's
              >>> a last resort.
              >>
              >>> Secondly, would there be any other impact in turning off this behaviour?
              >>Do other
              >>> parts of WebLogic rely on this?
              >>
              >>> Thanks in advance,
              >>
              >>> Kevin.
              >>
              >>--
              >>Dimitri
              >>
              Dimitri
              

Maybe you are looking for

  • How to count number of rows in table

    can I get number of row in table except Count(*) in pl/sql is there any other way

  • "Use Query Drill" in Webi 4.1 patch 3.1 on BEx query

    Hi, We are working with Webi version 4.1 and creating reports on BEx queries (BW 7.31) Withn 6 months, BW will be migrated to HANA. Is it possible to use the option in Webi document "Use Query Drill" on BEX queries when using BICS? When using HANA, w

  • Field and Link T. Code selection for display transaction

    Hi, I want to know the transaction code with which we can customize whixh field to be disply when we execute  the display transaction like ME2L  ,ME2M  ,MB5B  , MB51 etc. and as when we click on PO in ME2M we directly switch to ME23N how to do config

  • How to reference Portal Theme in Web Dynpro Application?

    Hi All, I have implemented a WDA that is being embedded into the Portal. My customer has designed his own Portal Theme. However, the WDAs embedded into the Portal do not appear in the style of the Portal Theme. Now, my question is which means are req

  • Integration Process Config SAP Hana Cloud integration with SuccessFactors

    Dear, We are trying to connect SF with our SAP backend, I'm currently reading the following document: "Integration Add-On 3.0 for SAP ERP Human Capital and SF". I'm fairly new to SAP so I have a few questions, since I didn't found the answer on the r