Fixed no of rows in JTextarea

I want to have only 5 rows in my textarea and no scrollbars. I specified it in constructor. Also set the linewrapproperty to be true.
But When I press enter or when the line wraps it adds a row.
any property or method to set this behaviour.
help appreciated

When you specify 5 in the constructor when creating the textarea you only specify how big to paint the textarea. A textarea can contain a large amount of data. To edit the data as it is entered into the textarea you need to create a 'Custom Document'. Here is a link to the Java Swing tutorial that shows you how to create a custom document that limits the number of characters to a maximum of 300.
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#customdocument
You would want to modify this document to limit the number of 'newline' characters. Only 4 newline characters should be allowed in the document.

Similar Messages

  • Create spreadsheet file with a fixed number of rows

    What is the most straight forward way to create a series of spreadsheet files each with a new file name and fixed number of rows.  We have a data acquisition process that creates a new 1D array every 2 seconds.  We'd like to build a series of spreadsheet files each having two hours or 3600 rows of data.  Is there a best way to do this in LV9?
    john

    Use the low-level FileI/O Vis with Write to Text File.vi where you open a new file with every N iteration like this:
    You just have to convert your 1D Array to string before.
    If you would like to have a new file every N hours you should create a FGV which checks the elapsed time using Get Date/Time in Seconds.vi, which is more appropriate for longtime applications.
    Christian

  • How to show  a fixed number of rows in JTable

    Hi,
    I have to show only a fixed number of rows in the table .
    After scrolling number of rows must not be changed.

    I don't understand the question.
    The number of visible rows is dependent on the size of the scroll pane.
    Scrolling does not change the number of rows that are visible.

  • How to display a fixed number of rows in a page when using CL_GUI_ALV_GRID

    Hy experts
    How to display a fixed number of rows in a page when using CL_GUI_ALV_GRID?? lets say 500 ?? because my display table it may contain in some cases 10.000 and evidently I can t see all of them..
    I have a button in my toolbar witch triggers this event
    (display 500 records ) but I don t have the logic to do this only with methods of CL_GUI_ALV_GRID.
    can you tell me a standard method of CL_GUI_ALV_GRID witch can help me do this?? any hint will be good..
    Till now I was used to add a column to my structure witch represents a flag that is a number corresponding to every 500 records (a batch containing 500 records )
    first       500 - flag -> 1
    second  500 - flag -> 2
    etc..but I m convinced that exists a way of doing this more easy..without damaging my structure..
    thanx in advance..don t be shy..reply if you have any hints..

    Hi,
    if method SET_FILTER_CRITERIA doesn´t help, I think that you must work with 2 internal tables, a counter and a loop for filtering the records to be displayed:
    case counter.
      when 1.
         loop at int_table1 from 1 to 500.      "<-- your table with all records
           move int_table1 to int_table2
        endloop.
      when 2.
         loop at int_table1 from 501 to 1000.     
           move int_table1 to int_table2
        endloop.
    etc, etc.
    Call grid-->SET_TABLE_FOR_FIRST_DISPLAY
       exporting
         IT_OUTTAB = int_table2                "<-- instead of your currently table int_table1

  • Fixed number of rows in ADF table

    Can we specify fixed number of rows for ADF table so even no rows displayed it will still show 10 empty rows.

    the rangesize property determines how many rows will be displayed and controls paging. If there are no rows to begin with (if I understand the question correctly) rangesize won't have any effect.

  • Fixed number of rows

    hi,
    all.
    i wnt to dispaly only fixed no of row in output but there  mayee to more record in internal table .how can i do that
    suppose i want to dispaly only 10 record in output but there maye be more that 10 record in inetrnal table,we will
    not fixe in selection query,how we will do that.

    Hi,
    Use a counter and move the fixed number of records to another internal table and display it.
    loop at itab.
    count = count + 1.
    move-corresponding itab to itab1.
    append itab1.
    if count > 10.
    exit.
    endif.
    endloop.
    Now use itab1 to display the output.
    Regards,
    Vikranth

  • How to Fix the 1st row in Table

    How to Fix the 1st row in Table
                 In EP, one of the page we are getting out put in the table format. It's working fine, but as per the new requirement we have to fix (freeze) the first row of the table. (.i.e. whenever I click the page down button first row should be visible in the table). Can you help regarding the above issue?
    For Example: in Table having 6 rows. In 1st row display Year Month and 2,3,4---etc Rows will display Quantity. Click on Page down Button in Table we are able to staring 2row. First was a movie up. So End user canu2019t find which year/moth under the Quantity is available.
    So I have to fix in 1st row. Click on page down button table 1st row is fixed but comes to another Quantity Records.
    It is Possible in Table?  If possible please tell me.
    Regards
    Vijay Kalluri

    Hi KalluriVijay 
    I don't think there is direct availabe method available to fix the row. However, there are two ways using which you can achieve the requirement:
    To go ahead with the custom table. This way you can set your own properties for the table. However, this may impact performance handling large data.
    Second option is to use other features of NW04s (Not available in NW04) like Table Popins using which you can achieve something similar.
    For Table Popins refer [TablePopin|http://help.sap.com/saphelp_nw70/helpdata/EN/23/5e9041d3c72e7be10000000a1550b0/frameset.htm]
    Hope this helps.
    Regards
    Abhinav Sharma

  • Fixed No of rows in the table

    Hi,
    I have the below xml structure :-
    CTRLS
    CTRL
    PYTO
    STMENTS
    STMENT ( company name , company address)
    POS ( po number , po balance amt)
    INVs
    INv     ( invoice number , invoice amount , invoice type )
    Every CTRLS will have multiple CTRL and every CTRL record represents a invoice record for a customer so it has to go on a new page. Also, each CTRL will have only 1 PYTO.
    STMENTS represents multiple companies for a customer and every company will have multiple POS and each POS will have mutiple invoices.
    I have created a rtf wherein CTRL , PYTO is the header and have a single table which will have all the fields from STMENT, POS and INV and i want to restrict the no of rows per page to 36. I saw the example on the blog http://blogs.oracle.com/xmlpublisher/newsItems/departments/templates/2007/03/27#a211 but it has only a single detail group g_invoice_lines in the table and in my case i have multiple groups in the table.
    Can anybody help me out with this.
    Thanks.

    So are your groups as listed -
    STMTS - group by Company
    POS - group by PO number
    INVS - group by invoice number
    and then each invoice should have a fixed row setting, ie 36 in your case. If you understand the blog code you can certainly use the same logic to limit the row numbers.
    I would like to mention a simpler method which may work in your case too - you need to create one more grouping, this is grouping by expression and make sure you insert this code using MS Word text form fields.
    <xsl:variable name="lpp" select="number(36)"/>
    <?for-each-group:current-group();floor((position() - 1) div $lpp)?><?if:position()!=1?><xsl:attribute name="break-before">page</xsl:attribute><?end if?>
    ----your content ---
    <?end for-each-group?>

  • Click a row in jTextArea and get the content of the row.

    I have an array of strings display in a textarea, once a user click on a row, i will like to display the content of the clicked row. I am new in java swing. how should i achieve it? thank you all!!

    Working example with CaretListener:
    package org.apex.sunforums;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    * TextAreaLineSelectionTest.java
    * @author mrityunjoy_saha
    * @version 1.0
    * @since Apex 1.2
    public class TextAreaLineSelectionTest {
        public void createUI() {
            final JFrame frame = new JFrame("TextAreaLineSelectionTest");
            frame.setSize(400, 400);
            JPanel panel = new JPanel();
            panel.setLayout(new GridLayout(2, 1));
            final JTextArea textField = new JTextArea(
                    "Hello\nThis is a test class.\nTo show line selection\nType some text and see the magic.",
                    10, 20);
            JScrollPane scroll = new JScrollPane(textField,
                    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                    JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
            final JLabel display = new JLabel();
            textField.addCaretListener(new CaretListener() {
                public void caretUpdate(CaretEvent e) {
                    String lineText = "";
                    try {
                        int dot = e.getDot();
                        int rowStart = Utilities.getRowStart(textField, dot);
                        int rowEnd = Utilities.getRowEnd(textField, dot);
                        lineText = textField.getDocument().getText(rowStart,
                                (rowEnd - rowStart));
                    } catch (BadLocationException ex) {
                        ex.printStackTrace();
                    display.setText(lineText);
            panel.add(scroll);
            panel.add(display);
            frame.getContentPane().add(panel);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        public static void main(String[] args) {
            final TextAreaLineSelectionTest test = new TextAreaLineSelectionTest();
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    test.createUI();
    }Thanks,
    Mrityunjoy

  • How to display fixed number of rows on rtf file

    Hi everyone,
    I have the following requirement. The pdf output should have fixed number of 33 lines in a group by. The rows in group by can vary for each group . For eg: If a group has 3 rows , the pdf output should print 3 lines and 30 empty lines, and if group has 2 lines, the out put should print 31 emty lines.
    can anyone please help me with this requirement?
    Thanks
    Sunny

    Take a look at this blog post: http://blogs.oracle.com/xmlpublisher/entry/anatomy_of_a_template_i_fixed
    Thanks,
    Bipuser

  • How to Efficiently Sample a Fixed Number of Rows

    Good afternoon. I need to select a specific number of random rows from a table, and while I believe my logic is right it's taking too long, 30 minutes for a routine data size. Hopefully someone here can show me a more efficient query. I've seen the SAMPLE function, but it just randomly selects rows on a one-by-one basis, without a guaranteed total count.
    This is the idea:
    INSERT INTO Tmp_Table (Value, Sequence) SELECT Value FROM Perm_Table, DBMS_RANDOM.VALUE;
    SELECT Value FROM Tmp_Table WHERE ROWNUM <= 1234 ORDER BY Sequence;I'd need to put the ORDER BY in a subselect for ROWNUM to work correctly, but anyway that's just an illustration. My actual need is a little more complicated. I have many sets of data; each set has many rows; and for each set I need to return a specific (different) number of rows. Perhaps project A has three rows in this table, and I want to keep two of them; project B has two rows, and I want to keep one of them. So I need to identify, for each row, whether it's valid for that project. This is what my data looks like:
    Project Person  Sequence Position Keeper
    A       Bill    1234     1        Yes
    A       Fred    5678     3        No
    A       George  1927     2        Yes
    B       April   5784     2        No
    B       Janice  2691     1        YesI populate Sequence with random values, then calculate the position of each person within their project, and finally discard people who's Position is greater than Max_Targets for the Project. Fred and April have the highest random numbers, so they're cut. It's not the case that I'm just trimming one person from each project; the actual percentage kept will range from zero to 100.
    Populating the list with random values is not time-consuming, but calculating Position is. This is my code:
    UPDATE Tmp_Targets T1
    SET Position =
      SELECT
       COUNT(*)
      FROM
       Perm_Targets PT1
       INNER JOIN Perm_Targets PT2 ON PT1.Project = PT2.Project
       INNER JOIN Tmp_Targets T2 ON PT2.Target = T2.Target
      WHERE
           T1.Target = PT1.Target
       AND T2.Sequence <= T1.Sequence
      );The Target fields are PKs, and the Project and Sequence fields are indexed. Is there a better way to approach this? I could write a cursor that pulls out project codes and performs the above operations for each project in turn; that would be logically simpler and possibly faster. Has anyone here addressed a similar problem before? I'd appreciate any ideas.
    This is on 9.2, in case it matters. Thank you,
    Jonathan

    You've not given any indication of how max targets for a given project is determined, so for my example I'm using the ceiling of 1/2 of the number of records in each project which gives the same number of yes and no responses per project as you had:
    with dta as (
      select 'A' project, 'Bill' person from dual union all
      select 'A', 'Fred' from dual union all
      select 'A', 'George' from dual union all
      select 'B', 'April' from dual union all
      select 'B', 'Janice' from dual
    ), t1 as (
      select project
           , person
           , row_number() over (partition by project order by dbms_random.value) ord
           , count(*) over (partition by project) cnt
           , rownum rn
        from dta
    select project
         , person
         , ord
         , cnt
         , case when ord <= ceil(cnt/2) then 'Yes' else 'No' end keep
      from t1
      order by rn
    PROJECT PERSON ORD                    CNT                    KEEP
    A       Bill   2                      3                      Yes 
    A       Fred   3                      3                      No  
    A       George 1                      3                      Yes 
    B       April  1                      2                      Yes 
    B       Janice 2                      2                      No  
    5 rows selectedIn this example I use an analytic function to assign a random ordering for each record within a project in the middle query, in the final output query I am determining the yes no status based on the order within a project and the count of records in the project. If you had a table of projects indicating the thresh hold you could join to that and use the thresh hold in place of the ceil(cnt/2) portion of my inequality in the case statement.

  • 3 queries, how to make it fixed number of rows

    Hi. I have the 3 queries with the following structure. Q1 customer, Q2 sales order, Q3 lines in the sales orders
    Q1
    Q2
    Q3
    Q3
    Q2
    Q1
    I followed the one suggested in thread: Can you limit returned rows in a loop?
    regarding value for each text form field as follows
    text1 = <xsl:variable name="lpp" select="number(5)"/>
    text2 = <?for-each@section:LIST?> <xsl:variable xdofo:ctx="incontext" name="group" select=".//LINES"/>
    <?for-each:$group?><?if:(position()-1) mod $lpp=0?><xsl:variable name="start" xdofo:ctx="incontext" select="position()"/>
    text3 = <?for-each:$group?><?if:position()>=$start and position()<$start+$lpp?>
    text4 = <?LINE?>
    text5 = <?end if?><?end for-each?>
    text6 = <?sum($group[(position()>=$start) and (position()<($start+$lpp))]/LINE)?>
    text7 = <?if:not(count($group) mod $lpp=0) and ($start+$lpp>count($group))?>
    text8 = <?end if?><?end for-each?><?end if?>
    text9 = <?if:count($group)<$start+$lpp?>
    text10 = <?end if?>
    text11 = <xsl:if xdofo:ctx="inblock" test="$start+$lpp<=count($group)"><xsl:attribute name="break-before">page</xsl:attribute></xsl:if>
    text12 = <?end if?><?end for-each?><?end for-each?>
    and it worked for me if i have only 2 queries. but now when im using it in 3 queries. how to apply the said format in involving 3 queries?
    Thanks.

    Hi,
    if method SET_FILTER_CRITERIA doesn´t help, I think that you must work with 2 internal tables, a counter and a loop for filtering the records to be displayed:
    case counter.
      when 1.
         loop at int_table1 from 1 to 500.      "<-- your table with all records
           move int_table1 to int_table2
        endloop.
      when 2.
         loop at int_table1 from 501 to 1000.     
           move int_table1 to int_table2
        endloop.
    etc, etc.
    Call grid-->SET_TABLE_FOR_FIRST_DISPLAY
       exporting
         IT_OUTTAB = int_table2                "<-- instead of your currently table int_table1

  • How can I get a fixed number of rows on a SELECT?

    I'm interested on get the last xx records of one specific query that returns an higher number of rows than xx. How can I do this?

    you can use "where rownum < xx" if you
    write "select * from (select ... from ... order by ...) where rownum < 10"
    but you can't write "rownum > 10" because no record will be returned.
    therefor you have to do like this:
    select * from (select ..., rownum as nummer from (select ... from ... order by ...)) where nummer > 10
    ~
    pascal

  • Fixed Column changing Row

    Hi,
    I'm fairly sure there is no formula for what I would like to achieve ??
    Is there a Macro? that can be used.??
    I have a spreadsheet that I would like to be able to recognise a variable cell reference.
    I.E. the formulas will look similar to this when complete.
    Cell "F1000" =SUM(F8:F28), Cell "G1000" = SUM(G29:G34)...
    Cell "F1001" = SUM(F29:34)...
    Cell "F1002" = SUM(F35:64)...
    etc
    The Row numbers will change until I complete that portion of the spreadsheet.
    I have found a way to display the final row numbers as they correspond to a date.
    A way I can do this manually is to type the cell reference & formula then Fill Right.
    I have never had any joy creating Macro's & don't understand the language or how they work.
    Cheers for any Ideas
    Cliff

    Hi Cliff,
    Following on from SG's suggestion of small, discrete tables, this may work.
    Enter dates of each payment in column A of Data Entry. Column B will extract the month number from A. Formula in B2 (and Fill Down)
    =MONTH(A2)
    Column C finds the Bimonthly Period by looking up the month number in the Lookup Period table and returning the Period. Formula in C2 (and Fill Down)
    =VLOOKUP(B2,Lookup Period::A:B,2,FALSE)
    I have set the periods to start in January. Adjust if you are using financial years starting in July.
    Enter payments in Column D. You can hide columns B and C to make a neater data entry table (and less chance of accidentally typing into B or C).
    Third table, Summary by Period, uses SUMIF
    Formula in B2 (and Fill Down
    =SUMIF(Data Entry::C,A2,Data Entry::D)
    Each table has a Header Row and a Footer row so the SUM formulas in the footers are as SG said.
    After hiding B and C of Data Entry, and moving Lookup Period to another sheet, here is your work area:
    Regards,
    Ian.

  • HOw to fix No of Rows per page in SSRS

    HI,
    I have 400 records in my report , i  want display 20 records per page , how can i do the same in ssrs.
    Thanks in Advance.

    I need to do 100 rows per page.  I tried the technique above but I am still just getting about 16 rows per page.  (I believe I followed the instructions correctly.)
    I know...100 rows is a ton but the users want it (and, thus, my boss wants it).  They only display the report; they do not print it.
    Here is what I did...
    1. Right click on the table
    2. Select Properties
    3. Select the Groups tab
    4. Select Add...
    5. Enter a group Name: "Group_for_PageBreak" (I have no other groups)
    6. Enter an expression:  =Ceiling(RowNumber(Nothing)/100)
    7. Uncheck "Include group header" and "Include group footer"
    8. Check "Page break at start"
    9. Select "OK"
    Re #6, I also read to try this so I did: =CInt(Ceiling(RowNumber(Nothing)/100))
    Re #8, I also tried "Page break at end"
    Is "Details grouping..." relevant?
    Thanks.

Maybe you are looking for

  • X201 Woes - Do not buy one

    I offer this as my story as an X201 owner and the 'support' i have been given by Lenovo. It is a sad but causionary tale and I would suggest that anyone planning to buy a Lenovo laptop takes note. I initially sent this email on the 8th March and have

  • Two finger scroll doesn't function in mail

    Hi, two finger scroll , using trackpad, doesn't function anymore. Mavericks was installed some weeks ago. Also, trackpad gestures: three finger and four finger swipes do not function. all options are swichted on in preferences. now what? help will be

  • Exporting Audio from Captivate 5.5

    Hello, Please accept my apology if this question has already been posted in this forum, I searched but didnt see this particular question. My department currently has Captivate version 3.3. We would like to upgrade to Captivate 5.5 so we can take adv

  • Sync help requiered!!

    If I don't sync my iPod for 3-4 weeks, and the next time i connect it to iTunes, it requieres all the songs and movies to be deleted and re-synced. Why?

  • R12 Installation on Windows 2003  Error

    pl help me when post-install checks HTTP checking URL = http://jarry.cppw.com:8000 RW-50015: Error: - HTTP Listener is not responding. The service might not have started on the port yet. Please check the service and use the retry button. Help Page ch