Cursor Position in TextArea

Hi,
I want to paste the text saved in the clipboard on to the textarea at the specified cursor position.I have some text already in the textarea.

First you need to get the caret position like so:
int pos = textArea.getCaretPosition();
then you can paste your code like so:
textArea.insert("Your Text", pos);
This will insert "Your Text" into the text area at the current caret position. Hope this helps.
There are plenty of methods in the JTextComponent class for manipulating text. Have a browse.

Similar Messages

  • How can I set cursor position inside TextInput or TextArea

    Hallo.. I can't find the way for changing che cursor position inside a String in the TextInput or TextArea Component.. I hope you can help me..
    Thx
    Max

    setSelection(index, index);

  • How can I get a cursor position?

    Hi Everyone!
    In my TextArea, there is a blinking cursor.
    How can I get the cursor position not the mouse position.
    Thanks,

    Thanks JefferyGong!
    That is selection index number, not the coordinate point.
    I want to know point position.
    Gyi

  • Cursor Position Discrepancies

    Hi, and first off --- thanks for reading this! 
    The issue I have encountered with AS has been mentioned by a few people on this vast land of the internet, but I have found no solution, yet.
    When a text field / textarea is set to render as HTML, I can access the cursor position of the "plain" text quite easily even if some HTML has already been inserted either by setting it through ---
         field.htmlText = . . . ;
    OR
         setTextFormat( . . . );
    However, to know exactly how many characters precede the cursor (both "plain" and hidden HTML characters), there is no setting.
    This doesn't make sense to me since AS obviously knows how many hidden HTML characters are coming before the cursor. Otherwise, the built-in formatting functions would corrupt the code.
    Of course, I could be misinterpreting it, and the built-ins just run through checking for < characters . . . this seems repetitive to me, though, and thus unlikely.
    Is there something I am missing? I have tried so many workarounds that didn't work that I'm even more impressed by the fact that I can't find one . . .

    Well, after working with it all day, I have concluded that this will not work --- in my application. Even if I could work out the final bug, it's much too expensive in computation time to be used.
    The final bug that I mentioned is getting it to recognize new lines. Currently, it interprets a new line as nothing at all. I tried getting it to backtrack the cursor position to a recognizable character, but no soap.
    I could keep trying different options, but this is becoming too expensive with my time, as well.
    I plan on taking this up with Adobe Support, and I'll post their response here for posterity.
    Anyway, thank you very much, kglad, for your help. I really appreciate it.
    For anyone who's interested, here's the solution I tried based on kglad's suggestion:
    function html_caret(plain_caret:Number, html_area:Object):Number {
           var match:String = html_area.text.charAt(plain_caret);
           var matches:Array = html_area.text.substring(0, plain_caret).split(match);
           var match_number:Number = matches.length;
           var html_length:Number = html_area.htmlText.length;
           for(var new_caret:Number = 0; new_caret < html_length; new_caret ++) {
                  if(html_area.htmlText.charAt(new_caret) == "<") {
                         while(html_area.htmlText.charAt(new_caret) != ">") {
                                new_caret ++;
                  } else if(html_area.htmlText.charAt(new_caret) == match) {
                         if(match_number > 1) {
                                match_number --;
                         } else {
                                break;
           return new_caret;

  • Javascript: set or get caret position in textarea -not in IE?

    Hi all
    another javascript question...
    I'm using a javascript function that gets the caret position
    (the cursor position) in the textarea,
    and stores it when the textarea gets out of focus, so that
    text can be inserted by clicking on a
    button, where the caret was previously in the textarea.
    I suppose many cms or html editors do that successfully
    somehow.
    But my function works in all browsers BUT IE.
    I remember giving up with the same problem years ago after I
    found documentation on how impossible
    or unreliable it was to make this work in IE.
    But I thought times had changed, and IE7 would improve on
    that matter.
    Apparently not?
    I found many that claim to work in all browsers, but the one
    I choose to use obviously does not...
    So do you guys know a script that does that and WORKS with
    IE?
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    An Ingenious WebSite Builder:
    http://sitelander.com

    I'll link you something tonight - I wrote it like five years
    ago when I was in grade eleven. It's ugly code (as far as I can
    remember), but it has really advanced features and is REALLY easy
    to adapt to most situations.

  • Java GUI cursor position in the window, mixed text editable and uneditable

    Hello,
    I primarily program in VBScript for Client Acces; but, I wanted to start creating user interfaces with Java.
    VBScript is not compiled on the private drive and anyone can learn how to do a program from well documented code; however, a compiled .class Java program does not have to be sent with the .java source code to work. The compiled program is unreadable by others and uneditable by others. Although I can do what I want with ActiveX programming, I want to use Java instead because it will prevent others from knowing how I program my solutions.
    The NetBeans IDE allows for controls to be dragged and dropped onto a screen; however, I want to know how to have uneditable and editable fields on the same page while allowing the cursor to be anywhere on the page and report its cursor position just as it is reported in Client Access.
    Does Java support the .Net Framework; or, does it have its own objects and methods to pull the cursor position in a window? I need the row and column, not the x and y coordinates.
    Java How To Program, Sixth Edition, has some deprecated code examples and I found working solutions from the Java Almanac. However, I did not see an example of this sort.
    What I will do once I know how to track the cursor position in the window is generate a Java based training module. Every computer at my workplace has Java runtimes installed, none of them have the .Net Framework installed. Java has a lot of tools that allow me to replace all my ActiveX programming with Java programming.
    Have a great Day!
    Jesse Grune.

    textArea.getCaret().getDot();
    or the shorter
    textArea.getCaretPosition();

  • ITunes 6.0.1.3 "forgets" last cursor position in the library

    Hi there,
    I've a minor issue with my iTunes library. When I'm comfortably browsing my library using the "Browse"-Button, switching to e.g. my CD in iTunes and after that returning to the library the last cursor position with selected title and/or album is lost. So anew I've always to navigate manually to the previous selected album which it's bit annoying especially when you've to manage a larger library.
    Any hints?
    Thanx!
    Steve
    5G 60GB (European version) Windows XP
      Windows XP  

    DEZ3124,
    I want to change the default location of the music libary, so I went through the edit | preferences | consolidate library processes...which seemed to work fine.
    This method will change the location of the iTunes Music folder but the the iTunes folder itself will be left behind in its original place: C:\Documents and Settings\user name\My Documents\My Music. This makes iTunes (and by extension will also make you) much happier and in this case you'll be well-advised to let it have its way.
    Note that all the actual music files you now have, as well as those you will add in the future(which take up the bulk of the space on your hard drive), will be in the new location. The iTunes folder will be left behind with the iTunes Library files which don't take up much space at all ... if that's a concern.

  • Pda cursor position property does not work

    Hi!
    I have a problem with cursor positionX propery on PDA.
    I use PDA Module 8.2 and Windows Mobile 5 OS on PocketPC.
    Actually problem is only when I try to get value of two cursors, it return the same value for both cursors (you can test it with attached VI), but when I set values it work fine.
    I have also worked with PDA Module 8.0.1 in past and I remember that get cursor position value worked, so I have no idea why it doesn't work in newer version.
    Thanks,
    andrej
    Attachments:
    cursor test.vi ‏21 KB

    Hello andrej,
    Unfortunately I also see the same behavior on a PDA using this "active cursor" property. It appears to me that this property is not being written successfully. I say this because it appears that the value displayed is always from the most recently repositioned cursor rather than either the 0 or 1 which is set by the property node.
    What I will do at this point is to file a corrective action request so that this behavior is corrected for a future release of the LabVIEW PDA module. I apologize for the inconvenience that this causes for your application. Please let me know if I can help at all as you modify your application to work around this behavior. Thanks,
    Mike D.
    National Instruments
    Applications Engineer

  • Invalid Cursor Position Error

    Help!
    I am using JRun3.1 and developing a web interface to a database. In this particular screen, I am using CachedRowSet (I downloaded this and added it to jrun classpath). I am getting "Invalid cursor position" error.
    I feel there is a problem with the usebean tag.
    This is my code:
    what is wrong with this?
    <%@ page language = "java" import="java.sql.*, java.util.*, javax.sql.*, sun.jdbc.rowset.*" %>
    <%
    String indSub = request.getParameter("indSub");
    String areaname = request.getParameter("selarea");
    %>
    <jsp:useBean id="crs" class="CachedRowSet" scope="session" >
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    crs.setUrl("jdbc:odbc:asphData");
    crs.setCommand("SELECT siccode, sicdesc from siccode where sictitle = '" + indSub + "'");
    crs.execute();
    %>
    </jsp:useBean>
    <%@ include file="header2.htm" %>
    <link rel="stylesheet" href="http://localhost:8100/empData/almis.css" type="text/css">
    <br>
    <br>
    <table align="center">
    <tr><td class="moduleDesign" align="center">Employers Database</td></tr>
    </table>
    <br><br>
    <font size="+2" face="verdana sans-serif">
    <form action="employerDetail.jsp" method="post">
    <p><center><font color="Blue">Employers in the �<%= indSub %>� Industry
    <br>
    SIC Code:�<%= crs.getString("siccode") %>
    <br>State: Utah<br>
    Region: �<%=areaname %><br>
    </font></center></p>
    <p>
    <b>Description:</b>�<%= crs.getString("sicdesc") %>
    </p>
    </form>
    <jsp:include page="footer2.htm" />
    </body>
    </html>
    srajaman2

    Never mind!
    I have to issue a next() command to get to the first line of the resultset!
    srajaman2

  • DataTable Exception: Invalid operation for the current cursor position

    I have a JSF application that lists rows from a view in a SQL Server database. I have set up a commandLinks in an extra columns.
    The data is displayed properly, but when I select one of the commandLinks I get the "Invalid operation for the current cursor position" exception.
    Here's the source
    Domain.jsp
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
            <html lang="en-US" xml:lang="en-US">
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>Page1 Title</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                    <h:form binding="#{Domains.form1}" id="form1">
                        <h:dataTable binding="#{Domains.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd"
                            value="#{Domains.dataTable1Model}" var="currentRow">
                            <h:column binding="#{Domains.column9}" id="column9">
                                <h:selectBooleanCheckbox binding="#{Domains.checkbox2}" id="checkbox2"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText9}" id="outputText9" value="Select"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column10}" id="column10">
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText4}" id="outputText4" value="Name"/>
                                </f:facet>
                                <h:commandLink action="#{Domains.groupList}" binding="#{Domains.linkAction1}" id="linkAction1">
                                    <h:graphicImage binding="#{Domains.image1}" id="image1" url="resources/images/domain16.gif" value="resources/images/domain16.gif"/>
                                    <h:outputText binding="#{Domains.linkAction1Text}" id="linkAction1Text" value="#{currentRow['name']}"/>
                                </h:commandLink>
                            </h:column>
                            <h:column binding="#{Domains.column3}" id="column3">
                                <h:outputText binding="#{Domains.outputText5}" id="outputText5" value="#{currentRow['description']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText6}" id="outputText6" value="Description"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column4}" id="column4">
                                <h:selectBooleanCheckbox binding="#{Domains.checkbox1}" id="checkbox1" value="#{Domains.domainviewRowSet.currentRow['enabled']}==1"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText8}" id="outputText8" value="Enabled"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column7}" id="column7">
                                <h:outputText binding="#{Domains.outputText13}" id="outputText13" value="#{currentRow['userCount']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText14}" id="outputText14" value="Users"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column8}" id="column8">
                                <h:outputText binding="#{Domains.outputText15}" id="outputText15" value="#{currentRow['groupCount']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText16}" id="outputText16" value="Groups"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column5}" id="column5">
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText17}" id="outputText17" value="Actions"/>
                                </f:facet>
                                <h:commandLink action="#{Domains.editDomain}" binding="#{Domains.linkAction2}" id="linkAction2">
                                    <h:graphicImage binding="#{Domains.image2}" id="image2" title="Edit" value="resources/images/edit.gif"/>
                                </h:commandLink>
                                <h:commandLink binding="#{Domains.linkAction3}" id="linkAction3">
                                    <h:graphicImage binding="#{Domains.image3}" id="image3" title="View" url="resources/images/view.gif" value="resources/images/view.gif"/>
                                </h:commandLink>
                                <h:commandLink binding="#{Domains.linkAction4}" id="linkAction4">
                                    <h:graphicImage binding="#{Domains.image4}" id="image4" title="Delete" value="resources/images/delete.gif"/>
                                </h:commandLink>
                            </h:column>
                        </h:dataTable>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>
    Domains.java
    * Page1.java
    * Created on October 28, 2004, 12:45 PM
    * Copyright Gordon.Bell
    package usergroupmgt;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import javax.faces.component.*;
    import com.sun.sql.rowset.*;
    import javax.faces.convert.*;
    public class Domains extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlDataTable dataTable1 = new HtmlDataTable();
        public HtmlDataTable getDataTable1() {
            return dataTable1;
        public void setDataTable1(HtmlDataTable hdt) {
            this.dataTable1 = hdt;
        private JdbcRowSetXImpl domainviewRowSet = new JdbcRowSetXImpl();
        public JdbcRowSetXImpl getDomainviewRowSet() {
            return domainviewRowSet;
        public void setDomainviewRowSet(JdbcRowSetXImpl jrsxi) {
            this.domainviewRowSet = jrsxi;
        private HtmlOutputText outputText4 = new HtmlOutputText();
        public HtmlOutputText getOutputText4() {
            return outputText4;
        public void setOutputText4(HtmlOutputText hot) {
            this.outputText4 = hot;
        private UIColumn column3 = new UIColumn();
        public UIColumn getColumn3() {
            return column3;
        public void setColumn3(UIColumn uic) {
            this.column3 = uic;
        private HtmlOutputText outputText5 = new HtmlOutputText();
        public HtmlOutputText getOutputText5() {
            return outputText5;
        public void setOutputText5(HtmlOutputText hot) {
            this.outputText5 = hot;
        private HtmlOutputText outputText6 = new HtmlOutputText();
        public HtmlOutputText getOutputText6() {
            return outputText6;
        public void setOutputText6(HtmlOutputText hot) {
            this.outputText6 = hot;
        private UIColumn column4 = new UIColumn();
        public UIColumn getColumn4() {
            return column4;
        public void setColumn4(UIColumn uic) {
            this.column4 = uic;
        private HtmlOutputText outputText8 = new HtmlOutputText();
        public HtmlOutputText getOutputText8() {
            return outputText8;
        public void setOutputText8(HtmlOutputText hot) {
            this.outputText8 = hot;
        private UIColumn column7 = new UIColumn();
        public UIColumn getColumn7() {
            return column7;
        public void setColumn7(UIColumn uic) {
            this.column7 = uic;
        private HtmlOutputText outputText13 = new HtmlOutputText();
        public HtmlOutputText getOutputText13() {
            return outputText13;
        public void setOutputText13(HtmlOutputText hot) {
            this.outputText13 = hot;
        private HtmlOutputText outputText14 = new HtmlOutputText();
        public HtmlOutputText getOutputText14() {
            return outputText14;
        public void setOutputText14(HtmlOutputText hot) {
            this.outputText14 = hot;
        private UIColumn column8 = new UIColumn();
        public UIColumn getColumn8() {
            return column8;
        public void setColumn8(UIColumn uic) {
            this.column8 = uic;
        private HtmlOutputText outputText15 = new HtmlOutputText();
        public HtmlOutputText getOutputText15() {
            return outputText15;
        public void setOutputText15(HtmlOutputText hot) {
            this.outputText15 = hot;
        private HtmlOutputText outputText16 = new HtmlOutputText();
        public HtmlOutputText getOutputText16() {
            return outputText16;
        public void setOutputText16(HtmlOutputText hot) {
            this.outputText16 = hot;
        private HtmlSelectBooleanCheckbox checkbox1 = new HtmlSelectBooleanCheckbox();
        public HtmlSelectBooleanCheckbox getCheckbox1() {
            return checkbox1;
        public void setCheckbox1(HtmlSelectBooleanCheckbox hsbc) {
            this.checkbox1 = hsbc;
        private UIColumn column5 = new UIColumn();
        public UIColumn getColumn5() {
            return column5;
        public void setColumn5(UIColumn uic) {
            this.column5 = uic;
        private UIColumn column9 = new UIColumn();
        public UIColumn getColumn9() {
            return column9;
        public void setColumn9(UIColumn uic) {
            this.column9 = uic;
        private HtmlSelectBooleanCheckbox checkbox2 = new HtmlSelectBooleanCheckbox();
        public HtmlSelectBooleanCheckbox getCheckbox2() {
            return checkbox2;
        public void setCheckbox2(HtmlSelectBooleanCheckbox hsbc) {
            this.checkbox2 = hsbc;
        private HtmlOutputText outputText9 = new HtmlOutputText();
        public HtmlOutputText getOutputText9() {
            return outputText9;
        public void setOutputText9(HtmlOutputText hot) {
            this.outputText9 = hot;
        private UIColumn column10 = new UIColumn();
        public UIColumn getColumn10() {
            return column10;
        public void setColumn10(UIColumn uic) {
            this.column10 = uic;
        private RowSetDataModel dataTable1Model = new RowSetDataModel();
        public RowSetDataModel getDataTable1Model() {
            return dataTable1Model;
        public void setDataTable1Model(RowSetDataModel rsdm) {
            this.dataTable1Model = rsdm;
        private BooleanConverter booleanConverter1 = new BooleanConverter();
        public BooleanConverter getBooleanConverter1() {
            return booleanConverter1;
        public void setBooleanConverter1(BooleanConverter bc) {
            this.booleanConverter1 = bc;
        private HtmlCommandLink linkAction1 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction1() {
            return linkAction1;
        public void setLinkAction1(HtmlCommandLink hcl) {
            this.linkAction1 = hcl;
        private HtmlOutputText linkAction1Text = new HtmlOutputText();
        public HtmlOutputText getLinkAction1Text() {
            return linkAction1Text;
        public void setLinkAction1Text(HtmlOutputText hot) {
            this.linkAction1Text = hot;
        private HtmlGraphicImage image1 = new HtmlGraphicImage();
        public HtmlGraphicImage getImage1() {
            return image1;
        public void setImage1(HtmlGraphicImage hgi) {
            this.image1 = hgi;
        private HtmlCommandLink linkAction2 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction2() {
            return linkAction2;
        public void setLinkAction2(HtmlCommandLink hcl) {
            this.linkAction2 = hcl;
        private HtmlGraphicImage image2 = new HtmlGraphicImage();
        public HtmlGraphicImage getImage2() {
            return image2;
        public void setImage2(HtmlGraphicImage hgi) {
            this.image2 = hgi;
        private HtmlCommandLink linkAction3 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction3() {
            return linkAction3;
        public void setLinkAction3(HtmlCommandLink hcl) {
            this.linkAction3 = hcl;
        private HtmlGraphicImage image3 = new HtmlGraphicImage();
        public HtmlGraphicImage getImage3() {
            return image3;
        public void setImage3(HtmlGraphicImage hgi) {
            this.image3 = hgi;
        private HtmlCommandLink linkAction4 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction4() {
            return linkAction4;
        public void setLinkAction4(HtmlCommandLink hcl) {
            this.linkAction4 = hcl;
        private HtmlGraphicImage image4 = new HtmlGraphicImage();
        private HtmlOutputText outputText17 = new HtmlOutputText();
        public HtmlOutputText getOutputText17() {
            return outputText17;
        public void setOutputText17(HtmlOutputText hot) {
            this.outputText17 = hot;
        public HtmlGraphicImage getImage4() {
            return image4;
        public void setImage4(HtmlGraphicImage hgi) {
            this.image4 = hgi;
        // </editor-fold>
        public Domains() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
                domainviewRowSet.setDataSourceName("java:comp/env/jdbc/HBird");
                domainviewRowSet.setCommand("SELECT ALL dbo.DomainView.id, dbo.DomainView.name, dbo.DomainView.description, dbo.DomainView.enabled, dbo.DomainView.created, dbo.DomainView.modified, dbo.DomainView.userCount, dbo.DomainView.groupCount  FROM dbo.DomainView");
                dataTable1Model.setDataCacheKey("com.sun.datacache.Domains.domainviewRowSet");
                dataTable1Model.setRowSet(domainviewRowSet);
                dataTable1Model.setSchemaName("");
                dataTable1Model.setTableName("");
            } catch (Exception e) {
                log("Page1 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e : new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
    //        try {
    //            domainviewRowSet.execute();
    //            domainviewRowSet.next();
    //        } catch (Exception ex) {
    //            throw new FacesException(ex);
        protected usergroupmgt.ApplicationBean1 getApplicationBean1() {
            return (usergroupmgt.ApplicationBean1)getBean("ApplicationBean1");
        protected usergroupmgt.SessionBean1 getSessionBean1() {
            return (usergroupmgt.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
            domainviewRowSet.close();
        public String groupList() {
            // User event code here...
            return "groupList";
        public String editDomain() {
            // User event code here...
            return "editDomain";
    }and the exception stack:
    Stack trace:
    com.sun.jsfcl.data.ResultSetPropertyResolver$RowData.getData(Unknown Source)
    com.sun.jsfcl.data.ResultSetPropertyResolver.getValue(Unknown Source)
    com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
    com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
    com.sun.faces.el.MixedELValueBinding.getValue(MixedELValueBinding.java:80)
    javax.faces.component.UIOutput.getValue(UIOutput.java:147)
    javax.faces.component.UIInput.validate(UIInput.java:639)
    javax.faces.component.UIInput.executeValidate(UIInput.java:838)
    javax.faces.component.UIInput.processValidators(UIInput.java:412)
    javax.faces.component.UIData.iterate(UIData.java:969)
    javax.faces.component.UIData.processValidators(UIData.java:781)
    javax.faces.component.UIForm.processValidators(UIForm.java:170)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:904)
    javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:342)
    com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:78)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:236)
    org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:141)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
    org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:214)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:168)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:133)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:539)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:114)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
    com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:936)
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:165)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:683)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:604)
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:542)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:647)
    java.lang.Thread.run(Thread.java:534)Any help is appreciated.

    Hi,
    Looks like some inconsistency in the jsp source:
    in the 2nd link the url property is set. I don't think
    you need to set this.
    I couldn't tell what action you want to occur when you
    click. If you want some action to occur such as
    navigating to another page then you can use Page Navigation. Then you would need an action handler
    for the LinkAction component.
    <h:commandLink action="#{Domains.editDomain}" binding="#{Domains.linkAction2}" id="linkAction2">
    <h:graphicImage binding="#{Domains.image2}" id="image2" title="Edit" value="resources/images/edit.gif"/>
    </h:commandLink>
    <h:commandLink binding="#{Domains.linkAction3}" id="linkAction3">
    <h:graphicImage binding="#{Domains.image3}" id="image3" title="View" url="resources/images/view.gif" value="resources/images/view.gif"/>
    </h:commandLink>
    <h:commandLink binding="#{Domains.linkAction4}" id="linkAction4">
    <h:graphicImage binding="#{Domains.image4}" id="image4" title="Delete" value="resources/images/delete.gif"/>
    </h:commandLink>
    John
    JSC QA

  • How to get the current cursor position in word report?

    I am generating a word report. But I would like to keep the table in one page. However, I did not find the way to do it in labview. Somebody would give me some suggestions? I appreciate a lot.
    One way I think I can do is to find the current cursor position. Since I know the table size so I can figure out if the left space in the current page is enough to hold the table. But I do not know how to locate the curent cursor position in word document in labview programmatically. I appreciate any suggestions on this question.
    Thanks.

    Hi,
    when you insert data in a word document you have to refer to bookmarks rather than cursor position.
    If you are using the Report Generation Toolkit for Office it is explained in the manual chapter 3-1.
    See also the example: Generate Report From Template (Word).vi included in the toolkit.
    If you aren't using the toolkit, you still have to refer to bookmark as reference points to insert and/or fetch data.
    The principle is:
    - First create a document in which you insert bookmarks where you wish and save it as a template
    - In LV open your template document and insert in it your data referring to bookmarks as insertion points
    - At the end save your report with another name, so you still have the template
    I hope I have been clear enough, if not just as
    k!
    Good luck,
    Alberto

  • Accessing cursor positions on Tek TDS3052 oscilloscope

    Hello,
    I'm trying to program a LabVIEW application using a Tektronix TDS3052 digital oscilloscope that I access via GPIB.
    I have a got most of it running using the tkds30xx driver library that came with LabVIEW. However, I am missing one function: I need to query the user cursor positions set by the user on the scope. What I'm looking for is pretty much what the "TekTDS read cursors.vi" from the vi lib for the older Tek scopes does. I didn't find its equivalent in the TDS30xx lib, and unfortunately these routines cannot be intermixed.
    Does someone know whether that function exists at all and, if yes, how to access it (where is it and what its name?)?
    Thanks in advance for your help!
    Best regards
    K
    ristian Laß

    Hello,
    For horizontal cursors try:
    CURS:HBA?
    The instrument should give a response in this format:
    Horizontal Pos1;Pos2;Delta;Selected Cursor;Units
    For Vertical try these:
    CURS:VBA:HDELT?
    Returns horizontal difference
    CURS:VBA:HPOS? x = 1 or 2
    Returns value of vertical bar ticks
    CURS:VBA:UNITS?
    Return measurement units
    CURS:VBA:VDELTA?
    Returns value difference between the bars ticks
    If you are using the IVI driver, use the write to instrument and read from instrument VIs. If you are using the LabVIEW native one, VISA write and read should do the trick. Hope this helps.

  • Cursor position

    I ahve a program written and all but it looks like I distorted the cursor position. I want to set the cursor position to where it can be moved by clicking and i cant figure it out. I know i have the magnify on is that why if so is there a way to keep both.
    Attachments:
    windchime2.vi ‏53 KB

    Press Here.
    Tim
    Johnson Controls
    Holland Michigan

  • Java.sql.SQLException: Invalid cursor position on saving

    Dear all
    I'm having a problem with saving components on a JSF page. The page is plit in two parts:
    1. Save report details, which are being saved correctly. Here is the code
    public String btnSaveReport_action() {
            // TODO: Process the button click action. Return value is a navigation
            // case name where null will return to the same page.
            System.out.println("Saving the report ... forsi");
            int seqNumber = SequenceNumber.getNextSequenceNo("TB_REPORTS");
            getSessionBean1().setReportFK(seqNumber);
            String reportId = "REP_" + ((String)tfReportName.getText()).replace(' ', '_').trim();
            System.out.println("ReportFK in btnSaveReport: " + getSessionBean1().getReportFK());
            //SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
            System.out.println("Start Date: " + calRepStartDate.getSelectedDate());
            //error(calRepStartDate.getValue().toString());
            //System.out.println("getvalue" + calRepStartDate.getValue());
            try {
                rk = tb_reportsDataProvider.appendRow();
                tb_reportsDataProvider.setCursorRow(rk);
                System.out.println("Setting Values ...");
                tb_reportsDataProvider.setValue("REP_PK", new Integer(seqNumber));
                tb_reportsDataProvider.setValue("REP_ID", reportId);
                tb_reportsDataProvider.setValue("REP_ACTIVE", "Y");
                tb_reportsDataProvider.setValue("REP_SESSION_FK", new Integer(getSessionBean1().getSessionId()));
                tb_reportsDataProvider.setValue("REP_NAME", (String)tfReportName.getText());
                tb_reportsDataProvider.setValue("REP_START_DATE", new java.sql.Date(calRepStartDate.getSelectedDate().getTime()));
                tb_reportsDataProvider.setValue("REP_END_DATE", new java.sql.Date(calRepEndDate.getSelectedDate().getTime()));
                System.out.println("Committing Changes ...");
                tb_reportsDataProvider.commitChanges();
                System.out.println("Refreshing Row ...");
                tb_reportsDataProvider.getCachedRowSet().refreshRow();
                getSessionBean1().getTb_reportsRowSet().refreshRow();           
    //            tb_reportsDataProvider.refresh();
    //            System.out.println("Refreshing Row ...");
    //            tb_reportsDataProvider.setCursorRow(tb_reportsDataProvider.findFirst("REP_PK",new Integer(seqNumber)));
                info("Report Data Saved Successfully!");
            } catch (SQLException sqle) {
                /* error("Cannot update report (SQLException): " +
                        reportId +
                        " : " + sqle.getMessage()); */
                log("Cannot update report (SQLException): " +
                        reportId +
                        " : " + sqle);
                info("Could not save report: " + sqle.getMessage());
                sqle.printStackTrace();
            //tfReportName.setValueBinding("sourceData", getApplication().
            //    createValueBinding("#{newReport.tb_reportsDataProvider}"));
            //tfReportName.setValueBinding("text", getApplication().createValueBinding            ("#{newReport.tb_reportsDataProvider.value['REP_NAME']}"));
            // calRepStartDate.setValueBinding("sourceData", getApplication().
            //    createValueBinding("#{newReport.tb_reportsDataProvider}"));
            //calRepStartDate.setValueBinding("selectedDate", getApplication().createValueBinding            ("#{newReport.tb_reportsDataProvider.value['REP_START_DATE']}"));
            //calRepEndDate.setValueBinding("sourceData", getApplication().
            //    createValueBinding("#{newReport.tb_reportsDataProvider}"));
            //calRepEndDate.setValueBinding("selectedDate", getApplication().createValueBinding            ("#{newReport.tb_reportsDataProvider.value['REP_END_DATE']}"));
            info("Report Name: " + tb_reportsDataProvider.getValue("REP_NAME"));
            tfReportName.validate(this.getFacesContext());
            calRepStartDate.validate(this.getFacesContext());
            calRepEndDate.validate(this.getFacesContext());
            tfReportName.setDisabled(true);
            calRepStartDate.setDisabled(true);
            calRepEndDate.setDisabled(true);
            btnNewQuery.setDisabled(false);
            btnSaveReport.setDisabled(true);
            return null;
        }The problem is that the reportFK is losing its value when I submit the page the second time! I am trying to get the value from the provider or from the rowset, but none work. Here is the code I am trying ...
    public String btnSaveQuery_action() {
            // TODO: Process the button click action. Return value is a navigation
            // case name where null will return to the same page.
            int seqNumber  = 0;
            // Save the query header details to the database  
            try {
                // Start with the query - needed for the link table
                seqNumber = SequenceNumber.getNextSequenceNo("TB_QUERY");
                String queryId = "QRY_" + ((String)tfQueryName.getText()).replace(' ', '_').trim();
                tb_queryDataProvider.setCursorRow(queryRowKey);
                tb_queryDataProvider.setValue("QRY_PK", new BigDecimal(seqNumber));
                tb_queryDataProvider.setValue("QRY_CODE", queryId);
                tb_queryDataProvider.setValue("QRY_NAME", (String)tfQueryName.getText());
                tb_queryDataProvider.setValue("QRY_ACTIVE", "Y");
                tb_queryDataProvider.setValue("QRY_SESS_FK", new BigDecimal(getSessionBean1().getSessionId()));
                System.out.println("Committing Changes ...");
                tb_queryDataProvider.commitChanges();
                System.out.println("Refreshing Row ...");
                tb_queryDataProvider.setCursorRow(tb_queryDataProvider.findFirst("QRY_PK",new Integer(seqNumber)));
                getSessionBean1().getTb_queryRowSet().refreshRow();
                info("Query Data Saved Successfully!");
            } catch (Exception ex) {
                error("Error while saving query: " + ex.getMessage());
                log("Error while saving query" + ex);
                ex.printStackTrace();
            // Now save the link
            try {
                // Start with the query - needed for the link table
                String sql = "INSERT INTO TB_LINK_REPORT_QUERY ( " +
                   "LRQ_PK, LRQ_REP_FK, LRQ_QRY_FK, " +
                   "LRQ_TYPE, LRQ_START_DATE, LRQ_END_DATE, " +
                   "LRQ_ACTIVE, LRQ_SESS_FK) " +
                   "VALUES (?,?,?,?,?,?,?,?)";
                System.out.println("Trying to do the link");
                int linkSeqNumber = SequenceNumber.getNextSequenceNo("TB_LINK_REPORT_QUERY");           
                PreparedStatement pstmt = DBConnection.getConnection().prepareStatement(sql);
                if (getSessionBean1().getReportFK() == -1 || getSessionBean1().getReportFK() == 0)
                    System.out.println("reportFK = -1 or 0!!! Trying from provider.");
                    System.out.println("Report PK is: " + getSessionBean1().getTb_reportsRowSet().getBigDecimal("REP_PK"));
                    getSessionBean1().setReportFK(((Integer)tb_reportsDataProvider.getValue("REP_PK")).intValue());
                System.out.println("Report Foreign Key: " + getSessionBean1().getReportFK());
                System.out.println("Query Foreign Key: " + seqNumber);
                pstmt.setInt(1, linkSeqNumber);
                pstmt.setInt(2, getSessionBean1().getReportFK());
                pstmt.setInt(3, seqNumber);
                pstmt.setString(4, (String)dropDownQueryType.getSelected());
                pstmt.setDate(5, new java.sql.Date(calendarQueryStartDate.getSelectedDate().getTime()));
                pstmt.setDate(6, new java.sql.Date(calendarQueryEnd.getSelectedDate().getTime()));
                pstmt.setString(7, "Y");
                pstmt.setInt(8, getSessionBean1().getSessionId());
                System.out.println("Committing Changes for Link ...");
                pstmt.executeUpdate();
                DBConnection.getConnection().commit();
                System.out.println("Refreshing Row in link ...");
                getSessionBean1().getTb_link_report_queryRowSet().setObject(
                        1, new Integer(linkSeqNumber));
                getSessionBean1().getTb_link_report_queryRowSet().setObject(
                        2, new Integer(getSessionBean1().getReportFK()));
                getSessionBean1().getTb_link_report_queryRowSet().setObject(
                        3, calendarQueryStartDate.getSelectedDate());
                getSessionBean1().getTb_link_report_queryRowSet().setObject(
                        4, calendarQueryEnd.getSelectedDate());
                tb_link_report_queryDataProvider.refresh();
                info("Link Data Saved Successfully!");
            } catch (Exception ex) {
                error("Error while saving query: " + ex.getMessage());
                log("Error while saving link: " + ex);
                ex.printStackTrace();
            return null;
        }The part saving the query with the provider is working correctly. But the part with the link is not working at all (the part with the PreparedStatement). The fact is that the PreparedStatement cannot be executed because I am getting the error at the line
    System.out.println("Report PK is: " + getSessionBean1().getTb_reportsRowSet().getBigDecimal("REP_PK"));Can anyone help please?
    Thanks and Regards
    Joseph

    guys if any of you have an idea just post it. It would be of great help for me. I can't figure out my mistake and its been 2days already and still i am stuck with my problem.
    It displays the table but there is an error "java.sql.SQLException: Invalid cursor position" so i cannot put the counter to the session.

  • Invalid Cursor Position Error on Windows XP using CachedRowSet

    Hello, I don't know if this question lies here, but I thought it would be the well suited place so please pardon me if it isn't. I am trying to access multiple pages from my database on my XP machine but I am getting an "invalid cursor position" error when trying to access the next page. I don't know how this error is coming about because it works well on a Vista machine with no errors. I don't know if it is my drivers or something that brings about the problem. I am using mysql connecter 5.1.10, JRE 1.6.0_02 and windows XP SP2
    Below is a simple code that brings the error.
    package Admin; import javax.sql.rowset.CachedRowSet; import com.sun.rowset.CachedRowSetImpl; public class test { public void table() { try { CachedRowSet crs=new CachedRowSetImpl(); crs.setUrl("jdbc:mysql://host:3306/database");         crs.setUsername("User");         crs.setPassword("password"); crs.setCommand("select * from myTable"); int[] keys = {1}; crs.setKeyColumns(keys); crs.execute(); crs.last(); if(crs.getRow()>500){ //new overLimit(); } crs.setPageSize(3); crs.execute(); while (crs.next()) { System.out.print("page one----"); System.out.println(crs.getString(1)); } while(crs.nextPage()){ System.out.println("page two---"); while (crs.next()) { System.out.println("in page two"); System.out.println(crs.getString(1)); } } } catch (Exception e) { e.printStackTrace(); } } public static void main(String []args){ new test().table(); } }

    Yes I am running the same code on both machines. The output I get on the XP machine is shown below. I modified the code I posted earlier and replaced the "page two" text with "page (then page number)" and also omitted the "in page two" text for better readability---------PAGE 0---------
    DB09140110
    DU35463010
    EX29201810
    ---------PAGE 1---------
    EX38341510
    EX40471810
    KZ280299
    ----------PAGE 2---------
    LA130299
    LC130299
    MC081009
    ----------PAGE 3---------
    RZ300502
    VA130299
    VI020209
    ----------PAGE 4---------
    YX101008
    ZE220299
    ZF231105and vista....
    ----------PAGE 0---------
    EX38341510
    EX40471810
    KZ280299
    ----------PAGE 1---------
    LA130299
    LC130299
    MC081009
    ----------PAGE 2---------
    RZ300502
    VA130299
    VI020209
    ----------PAGE 3---------
    YX101008
    ZE220299
    ZF231105

Maybe you are looking for