Controlling amount of rows in a jtextfield with jscrollpane

As part of a school assignment, I we have output going to a textfield that is scrolled with JScrollPane. Part of it is for when it comes to 400 lines, and another line is added, that the first line of the output is erased, and the new one is added. Are there simple methods of the API to do this, or should I perhaps store all the output in a string, use an int to count, and then substring it to the first \n ?
Thanks for the replies. Please dont give me direct answers, but help to find the answer, as I do not want to cheat.

While I did not do a SSCCE, mine is not overly complicated on output. The first part of this was building a console client to connect to a server. This part is adding a GUI to it, with a bit of extra functionality. My writeMessage method of the console did a System.out.println. It now does a output.setText(output.getText() + "\n"+ date + msg); msg being the String parameter in the method. output is the JTextArea I have, and is passed to my Client object.
The output works fine, its just trying to cut the first line out when max is reached. Just doing 20 lines for now. I tried adding this, but it started cutting more and more off the start of the text.
if(output.getLineCount() > 20) {
     try {
          int firstRow = output.getLineEndOffset(0);
          output.setText(output.getText().substring(0, firstRow));
     catch(BadLocationException e) {
          e.printStackTrace();
}Edited by: agm_ultimatex on Jun 29, 2009 12:35 PM

Similar Messages

  • HT1752 I am working on a chart in paged with 7 columns. Problem has occurred with amount of row. I have completed 999 rows and it won't allow me to continue. As I need to do approx 3000+ rows, can anyone explain to me how to add extra rows. Thanks Jane

    I am working on a chart in pages with 7 columns.
    Problem has occurred with amount of rows. I have completed 999 rows and it won't allow me to continue. As I need to do approx 3000+ rows, can anyone explain to me how to add extra rows. Thanks Jane

    Try posting in the Pages forum
    https://discussions.apple.com/community/iwork/pages

  • How to control number of rows displayed in a report  by user?

    Hi All!
    I have provided a select list called 'Number of rows' in my report page.User can choose any number in the list, and accordingly he should be able to see so many number of rows in that report page.
    For example: if user selects 50 from the list, he will be able to see 50 records at a time out of say 2000 records retrieved. I want to control number of rows displayed per page dynamically. And if he selects 25 in the select list, he should be able to see 25 records at a time out of 2000.
    How to do it? Please give me ideas.
    Thanking in advance.
    Regards,
    Deepika.

    Hi Deepika,
    If you have a Select List with Submit called, say "P1_ROWS", you just enter P1_ROWS into the Report Attribute's "Number of Rows (Item)" setting.
    Regards
    Andy

  • Control amount value based on payment terms in obb9 and me21n

    Dear Sapgurus,
    In OBB8 Create Payment Terms.
    Create 4 Payment terms PT , PT1, PT2, PT3.
    For the 1st one PT you select Installment Payment CheckBox.
    For PT1, PT2 & PT3 give the no of days as per your requirement.
    Go to OBB9 and assigned.
    PT -- PT1 -- 20% (Document Date)
    PT -- PT2 -- 50% (Posting date)
    PT -- PT3 -- 30% (Posting date) in me21n i assign pt payment terms based on this one i want control amount in f-48 like first accroiss 20% is not allowed 1000 rs total value 200 allowed in f-48 how do i make logic, if i assigned in me21n payment terms i want ot check this payment terms in assigned obb9 if i take first payment terms if document date is their i want to take advance payment if payment date is their its normal payment. Whther it is correct or not & If i given any payment terms in  me21n i want check background how many payment terms is assigned in this one if payment terms is document date i want to check in f-48 and if posting date in payment terms i want to check in f-53 control how do i prepare logic please give me suggessions.
    Regards
    Umi

    Hi Sridhar,
      it would be helpful if you could share with us as how you did?.
    Regards,
    Siva

  • How to get control on each row in advance table

    hi, i have a advanced table with some data, in each row i have two radio buttons which i need to set depending on some column value in the row, i tried by following code
    for(SoftCompVORowImpl row2 = (SoftCompVORowImpl)svo.first();row2!=null;row2=(SoftCompVORowImpl)svo.next())
    if(row2.getAttribute("CommitEndDate")==null || row2.getAttribute("CommitEndDate").equals(""))
    onetime.setSelected(true);
    recurring.setSelected(false);
    else
    onetime.setSelected(false);
    recurring.setSelected(true);
    but this code is making set only one radio button (onetime), which ever i am making first true its getting selected, i need to know how to get control of each row....

    Babu,
    Basically you should use the decode function in your sql query itself and attach it with BC4J properties of radio buttons.In that case you don't have to worry about setting them declaratively !
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Adding a check box control for each row of data in a DataModel

    Hi all,
    I need to add a checkbox control for each row of data on a DataModel object.
    I have a "commandButton" at the bottom of DataModel, and whenever someone checks some of the rows on that list of rows,
    I need to get the selected dataModel(fragment of the list) in my backing bean.
    How do I achieve this functionality in JSF?
    Thanks,
    Meghasyam.

    Hi all,
    I need to add a checkbox control for each row of data
    on a DataModel object.
    I have a "commandButton" at the bottom of DataModel,
    and whenever someone checks some of the rows on that
    list of rows,
    I need to get the selected dataModel(fragment of the
    list) in my backing bean.
    How do I achieve this functionality in JSF?
    Thanks,
    Meghasyam.You'll want to have a wrapper class as suggested above, which has a "selected" boolean in it. Then use the "binding" attribute of the h:selectBooleanCheckbox component to bind the checkbox to that property... Make the property public and specify the properties exact name in the binding... bindings do not append "get" to the EL.
    Here is an example of what your table might look like... This code would display the list of names with a checkbox to the left of each name... When the check box is selected, the "selected" property of that wrapper class is set to true or false as needed. Then when the form is submitted, and you are inside your actionListener or action method call, you can look through your collection of wrapper classes asking each one if it was selected or not... Then do whatever you want with them... In this example, replace "myBackingBean" with the name of your backing bean, and "names" with the name of the method in your backing bean which returns the collection of wrapper classes... create a flag "public boolean selected" or similar in your wrapper class..
    <h:dataTable id="namestable"
    value="#{myBackingBean.names}"
    var="aName">
    <h:column>
    <h:selectBooleanCheckbox binding="#{aName.selected}"/>
    <h:outputText value="#{aName.nameText}"/>
    </h:column>
    </h:dataTable>
    Let me know if that isn't clear enough and I'll see if I can find a better way to explain it...
    -Garrett

  • Return Set Amount Of Rows

    Hello All,
    Quick question I hope... How do I request a set amount of terms and have the Oracle Agent stop, once the amount of rows has been reached.
    I am not looking for (example):
    select * from
    (SELECT rownum ROW_NUM, empID, empName FROM employees)
    where empName like '%SM%'
    AND
    ROW_NUM <= 10
    This works in most cases, but Oracle is still evaluating all results, and only returning rows where the ROW_NUM meets the criteria. If I have a million rows with matching empName , and only want to return 10 results it still evaluates all million rows. and break the query, this does not work...

    Statement 1 is faster - rownum criteria is used along with the last_name
    Statement 2 is slower - rownum criteria is used after all the last names are fetched.
    --#1
    SQL> select first_name, last_name from emp2 where last_name like 'W%' and rownum < 10 ;
    FIRST_NAME           LAST_NAME
    Alana                Walsh
    Alana                Walsh
    Alana                Walsh
    Alana                Walsh
    Alana                Walsh
    Alana                Walsh
    Alana                Walsh
    Alana                Walsh
    Alana                Walsh
    9 rows selected.
    Execution Plan
    Plan hash value: 3151743630
    | Id  | Operation                    | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |       |    "9"|   234 |    13   (0)| 00:00:01 |
    |*  1 |  COUNT STOPKEY               |       |       |       |            |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID| EMP2  |  5145 |   130K|    13   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN          | EMP2X |       |       |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM<10)
       3 - access("LAST_NAME" LIKE 'W%')
           filter("LAST_NAME" LIKE 'W%')
    Note
       - dynamic sampling used for this statement
    Statistics
             15  recursive calls
              0  db block gets
            157  consistent gets
              8  physical reads
              0  redo size
            552  bytes sent via SQL*Net to client
            380  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              9  rows processed
    --#2
    SQL> select * from ( select first_name, last_name, rownum rn from emp2 where last_name like 'W%'  ) where  rn< 10 ;
    FIRST_NAME           LAST_NAME                         RN
    Matthew              Weiss                              1
    Alana                Walsh                              2
    Jennifer             Whalen                             3
    Matthew              Weiss                              4
    Alana                Walsh                              5
    Jennifer             Whalen                             6
    Matthew              Weiss                              7
    Alana                Walsh                              8
    Jennifer             Whalen                             9
    9 rows selected.
    Execution Plan
    Plan hash value: 2594185790
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |      | "5145"|   195K|   619   (3)| 00:00:08 |
    |*  1 |  VIEW               |      |  5145 |   195K|   619   (3)| 00:00:08 |
    |   2 |   COUNT             |      |       |       |            |          |
    |*  3 |    TABLE ACCESS FULL| EMP2 |  5145 |   130K|   619   (3)| 00:00:08 |
    Predicate Information (identified by operation id):
       1 - filter("RN"<10)
       3 - filter("LAST_NAME" LIKE 'W%')
    Note
       - dynamic sampling used for this statement
    Statistics
             13  recursive calls
              0  db block gets
           2371  consistent gets
              0  physical reads
              0  redo size
            745  bytes sent via SQL*Net to client
            380  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              9  rows processed

  • Sap.ui.table.Table.addRow(): The control manages the rows aggregation. The method "addRow" cannot be used programmatically!

    Hi there,
    I'm using a sap.ui.table.Table and want to add rows. However, I get the error message stated above in the title of this thread.
    The same happens when adding the rows via XML view by defining the rows aggregation.
    Coding in Table-dbg.js
    * @see JSDoc generated by SAPUI5 control API generator
    sap.ui.table.Table.prototype.addRow = function() {
      jQuery.sap.log.error("The control manages the rows aggregation. The method \"addRow\" cannot be used programmatically!");
    Any ideas?
    Regards
    Tobias

    Hi Tobias,
    A row could be added to the model instead.
    Below post might help.
    Re: Adding 1 row to a table in SAPUI5 with local data(textfields etc...)
    Thanks and Regards, Venkatesh

  • I am trying to insert rows for alert_id 22 with diff abc_id and xyz_id

    I am trying to insert rows for alert_id 22 with diff abc_id and xyz_id
    these inserts will store in two tables that I have to join in the cursor.
    I have written cursor without passing cursor parameters. but here i need to pass acb_id and xyz_id along with alert_id.
    then if these are saticified with alert_id 22 then I want to stop the loop run, else i need to continue the loop. bcause the abc_id and xyz_id are diff for alert_id 22
    This is the issue I am facing!
    Please let me know if you have any idea. Let me know how to use cursor parameters here and in loop.
    Sample proc like this::
    Declare
    main_cursor
    another_cur
    alert_cur
    begin
    need to check first abc_id,xyz_id is already exist with alert_id 22
    if this set of records already exists then
    exit from the loop
    else
    continue with
    loop
    here coming the insert statements with different condition getting from first two cursors.(this part is ok for me)
    end loop
    end if
    Please write the logic if any idea on this.
    -LRK

    I want to stop if already alert_id is exist!

  • Error inserting a row into a table with identity column using cfgrid on change

    I got an error on trying to insert a row into a table with identity column using cfgrid on change see below
    also i would like to use cfstoreproc instead of cfquery but which argument i need to pass and how to use it usually i use stored procedure
    update table (xxx,xxx,xxx)
    values (uu,uuu,uu)
         My component
    <!--- Edit a Media Type  --->
        <cffunction name="cfn_MediaType_Update" access="remote">
            <cfargument name="gridaction" type="string" required="yes">
            <cfargument name="gridrow" type="struct" required="yes">
            <cfargument name="gridchanged" type="struct" required="yes">
            <!--- Local variables --->
            <cfset var colname="">
            <cfset var value="">
            <!--- Process gridaction --->
            <cfswitch expression="#ARGUMENTS.gridaction#">
                <!--- Process updates --->
                <cfcase value="U">
                    <!--- Get column name and value --->
                    <cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
                    <cfset value=ARGUMENTS.gridchanged[colname]>
                    <!--- Perform actual update --->
                    <cfquery datasource="#application.dsn#">
                    UPDATE SP.MediaType
                    SET #colname# = '#value#'
                    WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
                    </cfquery>
                </cfcase>
                <!--- Process deletes --->
                <cfcase value="D">
                    <!--- Perform actual delete --->
                    <cfquery datasource="#application.dsn#">
                    update SP.MediaType
                    set Deleted=1
                    WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
                    </cfquery>
                </cfcase>
                <cfcase value="I">
                    <!--- Get column name and value --->
                    <cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
                    <cfset value=ARGUMENTS.gridchanged[colname]>
                    <!--- Perform actual update --->
                   <cfquery datasource="#application.dsn#">
                    insert into  SP.MediaType (#colname#)
                    Values ('#value#')              
                    </cfquery>
                </cfcase>
            </cfswitch>
        </cffunction>
    my table
    mediatype:
    mediatypeid primary key,identity
    mediatypename
    my code is
    <cfform method="post" name="GridExampleForm">
            <cfgrid format="html" name="grid_Tables2" pagesize="3"  selectmode="edit" width="800px" 
            delete="yes"
            insert="yes"
                  bind="cfc:sp3.testing.MediaType.cfn_MediaType_All
                                                                ({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
                  onchange="cfc:sp3.testing.MediaType.cfn_MediaType_Update({cfgridaction},
                                                {cfgridrow},
                                                {cfgridchanged})">
                <cfgridcolumn name="MediaTypeID" header="ID"  display="no"/>
                <cfgridcolumn name="MediaTypeName" header="Media Type" />
            </cfgrid>
    </cfform>
    on insert I get the following error message ajax logging error message
    http: Error invoking xxxxxxx/MediaType.cfc : Element '' is undefined in a CFML structure referenced as part of an expression.
    {"gridaction":"I","gridrow":{"MEDIATYPEID":"","MEDIATYPENAME":"uuuuuu","CFGRIDROWINDEX":4} ,"gridchanged":{}}
    Thanks

    Is this with the Travel database or another database?
    If it's another database then make sure your columns
    allow nulls. To check this in the Server Navigator, expand
    your DataSource down to the column.
    Select the column and view the Is Nullable property
    in the Property Sheet
    If still no luck, check out a tutorial, like Performing Inserts, ...
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp
    John

  • HT1947 Can I control the volume of my MacBook Pro with the remote app on my IPhone or IPad?

    Can I control the volume of my MacBook Pro with the remote app on my IPhone or IPad?

    Welcome to the Apple Community.
    To an extent yes. You can't control the master volume, but tou can turn the volume up and down, up to the maximum set manually on your computer.

  • Rounding Tax amount in row

    Hi Experts,
    One of our customer wants to round the tax amount in each row of marketing documents.
    When searched the help of 'Document Settings:General Tab",  we found a setting field for this called 'Round tax amount in rows'.
    But the same is missing from the Document Settings window, General Tab.
    We are using SAP Business One 2007B, PL13
    Please Help.
    Thanks and Regards
    Ajith G

    Hi Ajith,
    Tax Definition Functions.
    Choose ->> Administration.
    -> Setup.
    -> Financials.
    -> Tax.
    -> Tax engine config.
    Tax Code Determination.
    ->> Tax Formula.
    Select your Formula which you want to ROUND OFF
    then pull down from Operation Round and kip your variable.
    Simple example,
    Service_BaseAmt=Total
    Service_TaxAmt=Round(Service_BaseAmt*Service_Rate,0)
    It will round off 0.5 to 1.0 and less than 0.5 to 0.0.............
    IF you want to Round off final Tax amount(ex. VAT_TaxAmt).
    see the example Tax Creation,
    Service_BaseAmt=Total
    Service_TaxAmt=Service_BaseAmt*Service_Rate
    HigheCess_ST_BaseAmt=Service_TaxAmt
    HigheCess_ST_TaxAmt=HigheCess_ST_BaseAmt*HigheCess_ST_Rate
    VAT_BaseAmt=Total(Total*Service_Rate)((TotalService_Rate))Cess_ST_Rate+((TotalService_Rate)HigheCess_ST_Rate)
    [VAT_TaxAmt= Round(VAT_BaseAmt*VAT_Rate,0)]
    Regards,
    Madhan.

  • BizTalk 2006 Event Log Warnings - Cannot insert duplicate key row in object 'dta_MessageFieldValues' with unique index 'IX_MessageFieldValues'.

    We have been seeing the following 'warnings' in the event log of our BizTalk machine since upgrading to BTS 2006. They seem to occur randomly 6 or 8 times per day.
    Does anyone know what this means and what needs to be done to clear it up? we have only one BizTalk server which is running on only one machine.
    I am new to BizTalk, so I am unable to find how many tracking host instances running for BizTalk server. Also, can you please let me know that we can configure only one instance for one server/machine?
    Source: BAM EventBus Service
    Event: 5
    Warning Details: Execute batch error. Exception information: TDDS failed to batch execution of streams. SQLServer: bizprod, Database: BizTalkDTADb.Cannot insert duplicate key row in object 'dta_MessageFieldValues'
    with unique index 'IX_MessageFieldValues'. The statement has been terminated..

    Other than ensuring that there exists a separate and single tracking host instance, you're getting an error about duplicate keys.. which implies that you're trying to Create a BAM Activity twice with the same data.
    I suggest you have a in-depth examination of the BAM (TPE or API) associated with the orchestration. In TPE ensure that the first binding you select is the "Instance Id" or "Message Id" before going ahead to map the ports or others.
    Regards.

  • Control key is set for u2018Process manufacturing with Inspectionu2019

    Hi,
    Which control key is set for u2018Process manufacturing with Inspectionu2019?
    What is the meaning of FS Relationship

    Hi,
    Control Key for "Process manufacturing with Inspection" is PI02.
    It is meant for Manufacturing is with Process Order with Quality inspection.
    Further this Control key you need to set in CR01/CR02 -Default Values-> Operation Default Values----> Control Key
    Regards,
    Tejas
    Edited by: Tejas  Kantilal Pujara on May 21, 2008 8:54 AM

  • DataTemplate Not showing data but showing correct amount of rows

    I just started using Datatemplates to convert our Answers Reports over to Publisher. Basicly I am using the direct SQL to BI Server method.
    Copy the SQL from the advanced SQL field in BI Answers.
    Place new SQL in DataTemplate
    Construct DataStructure
    It seems to be getting the proper amount of rows but none of the data is shown. I have checked the data multiple times for spelling errors and other simple items but I can't find it. It seems to be making a connection just fine but it does not show and value in the data elements. It just returns 6 empty rows.
    Example XML Attached:
    <dataTemplate name="FiveDayCo" defaultPackage="" dataSourceRef="OracleRPD">
         <properties>
    <property name="include_parameters" value="true"/>
    <property name="include_null_Element" value="true"/>
    <property name="include_rowsettag" value="false"/>
    <property name="scalable_mode" value="off"/>
    <property name="db_fetch_size" value="300"/>
    </properties>
         <parameters/>
         <lexicals/>
         <dataQuery>
              <sqlStatement name="COOR" ><![CDATA[SELECT "- Correspondence"."% 5 Day Correspondence Response Time" saw_0, '90%' saw_1, "- Correspondence"."% 5 Day Correspondence Response Time"-90 saw_2, "- Correspondence Details"."Correspondence Type" saw_3 FROM Finance WHERE ("- Correspondence Details"."Correspondence Type" IN ('Customer Service', 'Routine', 'Undeliverable', 'Privacy')) AND ("Business Unit"."Business Unit ID" = 6.00) AND ("- Record Details"."Record Type" = 'CORE') AND ("- Correspondence Details"."Correspondence Status" <> 'Closed') AND (("- Primary Expected Completed Date"."Primary Expected Year" = cast (YEAR( date '2010-07-01') as char(4)) ) AND ("- Primary Expected Completed Date"."Primary Expected Calendar Month" = MONTH( date '2010-07-01'))) ORDER BY saw_1, saw_3]]></sqlStatement>
         </dataQuery>
         <dataStructure>
              <group name="Coorespondence" source="COOR" >
                   <element name="FiveDayCoorespondenceTime" source="saw_0" function=""/>
                   <element name="KPIValue" source="saw_1" function=""/>
                   <element name="Variance" source="saw_2" function=""/>
                   <element name="CoorespondenceType" source="saw_3" function=""/>
              </group>
         </dataStructure>
    </dataTemplate>

    A few things to check. Does the sql by itself return data?
    Also, do you need the following: <dataTemplate name="FiveDayCo" defaultPackage="" dataSourceRef="OracleRPD"> ? If a package is not used/necessary, remove the reference.
    The following tag should be enough.
    <dataTemplate name="FiveDayCo">
    Your datastructure code should be: (for element name use value (instead of source = ) and I removed function syntax since you didn't specify any function like sum, average)
    <dataStructure>
    <group name="Coorespondence" source="COOR" >
    <element name="FiveDayCoorespondenceTime" value="saw_0" function=""/>
    <element name="KPIValue" value="saw_1"/>
    <element name="Variance" value="saw_2"/>
    <element name="CoorespondenceType" value="saw_3"/>
    </group>
    </dataStructure>
    For a good data template reference, check out the following: http://blogs.oracle.com/xmlpublisher/2009/06/data_template_progression.html
    Hope that helps!

Maybe you are looking for

  • How to get time spent in the repaint(long delay) method of component?

    Hi, I'm trying to get the time spent in the repaint method of Component. I tried to surround the method with time information: long time = System.getTime(); component.repaint(400); time = System.getTime() - time; System.out.println("Time spent in rep

  • OAF: *PG.xml is read-only. Unable to extend the LOVRN to add lovmappings

    Hello All, I am trying to extend the PG.xml to add additional lovmappings using JDev. But the PG.xml is readonly. Unable to create new items on lovmappings! I have imported all the server.xml for the VO extension. That worked fine. ( I tried to add t

  • Steps to create a simple formula for 2 KF

    Hi, Can someone please give me steps to create a formula for 2 KF or redirect me.  Do I need to create a formula variable?  I just need to add KF1 + KF2.  I RClicked on KF structure in columns and i can see only structure elements and formula variabl

  • Yet another comping thread

    Sorry, but I can't seem to find this specific problem in a search of "comping" so here's yet one more thread. Personally, I'm loving the comping feature. I've gotten some great results from it, and I find it easy and intuitive to use. However, my pro

  • Configurator 1.4 - installing a free app

    iOS 7.0.2 Configurator 1.4(351) Mac OS 10.8.5 IPads have been set up in Supervised mode with one VPP app.  When we've added a free app to Configurator, checked it in the App tab and pressed Refresh or Apply, the Device line items do very quick refres