Trying to amend textArea

I have a textArea(attached is a document listenter and a CaretListener) where I am trying to amend the contents. What I am trying to accomplish is when a user inputs text into the textArea that he/she cannot enter text past a certain point (ie caret postion 200). Also, if the text that gets inserted causes the text to go longer than caret position 200, then the text gets cut off.
The problem is I get the following error when I try and replace or set the textArea.
(java.lang.IllegalStateException: Attempt to mutate in notification)
Yet I have another program where the same thing works fine in an actionListener. I do not understand why I can not get it to work in the document listener. The textArea gets locked for some reason and I can not ammend it. I f someone can help me that would be nice of you.
java.lang.IllegalStateException: Attempt to mutate in notification
public void setCursor()
if(textArea.getCaretPosition() >= 200)
textArea.setCaretPosition(200);
public void delText()
if(textArea.getText().length() > 200)
String area = textArea.getText().substring(0, 199);
textArea.setText(" ");
textArea.replaceRange(area, 0 , 199); /* java.lang.IllegalStateException: Attempt to mutate in
notification */
class TextDocListener implements DocumentListener
public void insertUpdate(DocumentEvent e) {delText();}
public void removeUpdate(DocumentEvent e) {}
public void changedUpdate(DocumentEvent e) {}
class TextCaretListener implements CaretListener
public void caretUpdate(CaretEvent e) { setCursor(); }

Hi!
Subclass javax.swing.text.PlainDocument
then:
public void insertString(int offset, String newString, javax.swing.text.AttributeSet set) throws javax.swing.text.BadLocationException
           String s = this.getContent()+newString;
           if(s.length()<200)
                   super.insertString(offset, newString, set);
            else
               int cap = 200-this.getContent().length();
               if(cap>0)
                      String ins = newString.subString(0, cap);
                      super.insertString(offset, ins, set);
}Finally, when creating the TextArea call:
myTextArea.setDocument(myPlainDocument);:)

Similar Messages

  • Deployment of ESB for 10.1.3.4 (trying to amend Endpoint properties)

    I have downloaded the new deployment code (esbdeploymentautomation) to enable you to deploy an ESB between environments.
    I am deplying an ESB process from Dev to Systest.
    I have amended the build_tst.properties file to include all the relevant info and the build.properties.
    At the bottom of this file I have added
    # Values required for replace tasks.
    code_dir=C:\Project\Client\jdev\jdev\mywork\dii\esbInt110Flow
    search_text=/u01/esb/out/XX/int110_01
    replace_text=/u01/esb/XX/INT110/out
    These lines are trying to change the Endpoint property of a FileAdapter where the directories are different in the new environment.
    I run extract.sh and it successfully creates a deploymentPlan_tst.xml. Great!!
    I can then successfully run the deploy.sh and it deploys my ESB into the new environment but it doesn't change the Endpoint property.
    When you look at the log files generated it doesn't even appear to try and run the replaceToken process.
    Any ideas if this replaceTokens actually works?
    When the extract.sh is run it also generates logging which seems to suggest the replaceTokens runs after the DeployESBSuitcase:
    *Build sequence for target(s) `ExtractESBDeploymentPlan' is [ExtractESBDeploymentPlan]*
    *Complete build sequence is [ExtractESBDeploymentPlan, DeployESBSuitcase, replaceTokens, usage, UndeployESBEntities, ]*
    But from what I can see when you finally run the deploy.sh it only runs the DeployESBSuitcase process and nothing else.
    The only reason for using this automaytion process is so that we can amend Endpoint properties and URLs as we deploy but this is the part that doesn't seem to work....
    Help!!
    Regards
    Stuart

    You need to run the replaceToken before the deployESBSuitecase.
    Here is my example, it does a find and replace on host name
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <project name="ESBDeploymentProject" default="usage">
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Properties
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <property environment="env"/>
    <property name="esbProjectToDeploy" value="${basedir}/deployment"/>
    <property name="deploymentPlanFilename" value="${esbProjectToDeploy}/deploymentPlan.xml"/>
    <property name="ImportFilename" value="${env.ORACLE_HOME}/Deployment/deploy/lib/ESBMetadataMigrationTaskdefs.xml"/>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Environment specific properties
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <echo>Property Files ${env.ORACLE_HOME}/Deployment/deploy/resources/esb.${env.paramtarget}.properties</echo>
    <property file="${env.ORACLE_HOME}/Deployment/deploy/resources/esb.${env.paramtarget}.properties" />
    <property name="targetDeploymentPlanFilename" value="${esbProjectToDeploy}/${esb.deployTargetPlan}"/>
    <target name="param-target-chk" unless="env.paramtarget">
    <fail message="Target deployment environment parameter not set" />
    </target>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Import, to enable the custom ESB Metadata Deployment ant tasks
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <echo>Import ${ImportFilename}</echo>
    <import file="${ImportFilename}"/>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - ESB Deployment Automation
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <target name="DeployESBProject" depends="param-target-chk">
    <deployESBProjects
    esbMetadataServerHostname="${soa.suite.hostname}"
    esbMetadataServerPort="${soa.suite.port}"
    userName="${soa.suite.admin.username}"
    password="${env.soapassword}">
    <esbProject directory="${basedir}"/>
    </deployESBProjects>
    </target>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - List the GUID's for the UndeployESBEntities target e.g.:
    <system guid="8D61C3F0871111DB8F2675C60E6C31C6"/>
    <serviceGroup guid="0EB5F380896111DBBFBC9530C01627AC"/>
    <service guid="0547F370841611DBBFCF2D9BF80323FA"/>
    <serviceGroup guid="B90E6B70895F11DBAF1483EEF470B835"/>
    <system guid="A62C91C1841511DBBFCF2D9BF80323FA"/>
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <target name="UndeployESBEntities" depends="param-target-chk">
    <undeployESBEntities
    esbMetadataServerHostname="${soa.suite.hostname}"
    esbMetadataServerPort="${soa.suite.port}"
    userName="${soa.suite.admin.username}"
    password="${env.soapassword}">
    <system guid="ED8243D1B9A211DCAF33D38D99DD8682"/>
    <service guid="63085310B9A311DCAF33D38D99DD8682"/>
    </undeployESBEntities>
    </target>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Metadata Promotion to different ESB Metadata Servers (environments)
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <target name="ExtractESBDeploymentPlan">
    <mkdir dir="${esbProjectToDeploy}"/>
    <delete file="${deploymentPlanFilename}" verbose="true"/>
    <extractESBDeploymentPlan
    sourceDir="${basedir}"
    deploymentPlanFile="${deploymentPlanFilename}"/>
    </target>
    <target name="ModifyESBDeploymentPlan" depends="param-target-chk">
    <!-- <xmltask source="${deploymentPlanFilename}" dest="${targetDeploymentPlanFilename}">
    <replace path="/deploymentPlan/systemDeploymentPlan/properties/property[@name = 'Host']/@value" withText="${soa.suite.hostname}" />
    <replace path="/deploymentPlan/systemDeploymentPlan/properties/property[@name = 'Port']/@value" withText="${soa.suite.port}" />
    </xmltask> -->
    <copy file="${deploymentPlanFilename}" tofile="${targetDeploymentPlanFilename}"/>
    <replaceregexp file="${targetDeploymentPlanFilename}"
    match="http://[^/]*/"
    replace="http://${soa.suite.hostname}:${soa.suite.port}/"
    byline="true" />
    </target>
    <target name="DeployESBSuitcase"
    depends="param-target-chk, ExtractESBDeploymentPlan, ModifyESBDeploymentPlan">
    <deployESBSuitcase
    esbMetadataServerHostname="${soa.suite.hostname}"
    esbMetadataServerPort="${soa.suite.port}"
    sourceDirectory="${basedir}"
    deploymentPlanFilename="${targetDeploymentPlanFilename}"
    forcedDeployment="true"/>
    </target>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Usage
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <target name="usage">
    <echo>
    ======== Environment =====================================================
    SOA_DA_HOME = ${env.SOA_DA_HOME}
    CLASSPATH = ${env.CLASSPATH}
    ANT_HOME = ${env.ANT_HOME}
    ENVIRONMENT = ${env.paramtarget}
    ======== Properties =====================================================
    basedir = ${basedir}
    SOA Suite server = ${soa.suite.hostname}:${soa.suite.port}
    OC4J instance = ${soa.suite.oc4j.instancename}
    ==============================================================================
    </echo>
    <exec executable="ant" dir="${basedir}" vmlauncher="false">
    <arg value="-projecthelp"/>
    </exec>
    </target>
    </project>
    cheers
    James

  • Iam trying to amend text on a pdf 1.7 (Acrobat8.x) document with with photoshop elements 8, Can I? or do I need another program?

    Can I amend text in a 1.7(acrobat 8.x) documnet? What program do I need?

    Can I amend text in a 1.7(acrobat 8.x) documnet? What program do I need?

  • Trying to amend a chip on NWBC 4 but get NWBC look and feel?

    Hiya,
    I'me just trying to customize a SAP standard report chip and, from 'documentation', I'd expect to see something like this (rendered in Corbu and it lets me edit):
    But instead I see this (unable to edit without an access key and rendered in NWBC HTML or NWBC 3.5):
    Would anyone know why?
    Thanks!

    Hi Robert,
    Have you checked the configuration you have in NWBC_CFG?
    Also this might help:
    NWBC 4.0 - Gui Theme
    Hope this helps,
    V

  • I'm trying to register for an iCloud account with my apple ID but it's telling me it needs to be an email address. I try and amend my username so it's the same as my email address but nothing happens! HELP?!

    Hi - I'm trying to register for an iCloud account (I've just had a baby and am terrified I'm going to lose all my photos of him!) but when I try and register, it tells me it needs an email address so I go to edit my username and try and amend it so my email address and username are the same thing but nothing is happening.  I keep going round in circles - can someone help?!

    Where are you trying to amend your username?
    It should be done at http://appleid.apple.com/

  • Error trying to add a new UDF field

    Hello,
    I have a SAP 2005 A (6.80.320) SP:01 PL:36 system and have encountered a problem trying to amend an existing User Defined Field.
    If I go into Tools -> User Defined Fields -> Manage Fields -> Marketing Documents -> Rows. There is a line called 'Package'. If i highlight this line and select 'Update' then try and add option in here of 572kg/ctn I get the following error when trying to perform an update: " WTR1. The addition is not retained nor is it updated. We have ensured all users are out of SAP when this update if being performed too.
    Any advice/assistance would be greatly appreciated.
    Regards,
    Juan

    Hi Juan
    just wanted to verify have u upgarded any patch level of sap upgradation
    also please confirm are there any SP running if yes then please comment them and check abt the status of your problem
    Regards,
    Manish

  • Why is ken burns effect not working on individual slides I have amended when sent to iDVD

    When making a slideshow in iPhoto, I changed the zoom and scan on individual slides as instructed in the Help dialog; these showed perfectly when played.  However, when I shared the slideshow to iDVD, those particular slides were just 'still' and there was no Ken Burns effect at all.  Why did this happen?

    The Slideshow was created in iPhoto and then shared to iDVD.  The Ken Burns effect works on all the photos that used the basic "Ken Burns' setting.  However, on some of the photos I tried to amend the scanning to zoom into particular faces or parts of the photo.  When I played the slideshow in iPhoto, these amended photos were exactly as I wanted, but after 'sharing' it and viewing it in iDVD, those photos I had altered were 'frozen' and the Ken Burns effect did not work at all, neither the automatic version, nor the specific way I had set it.  All the other photos still had the Ken Burns effect as expected.  I am using  iPhoto 11, 9.1.5, I haven't had this problem in the past.
    If you have any ideas why this should have happened I'd be grateful.
    Thanks

  • How to amend Rules in Mail

    I am using Mail on my Mac and also have it configured on my iPhone and iPad.
    I have an alias e-mail address and set up a rule for any mails to that e-mail address to go straight into a specific folder (mailbox) within Mail.
    I am now trying to amend the rule but cannot access it.
    I have tried via Mail > Preferences but no rules are displayed.
    I have also tried to delete the folder and then send a test mail to the e-mail address, but when the mail arrives in the inbox it just creates a new folder again.
    How can I amend the rule in Mail?
    Thank you

    Many thanks. Would be more helpful if the rules in Mail on my Mac reflected those in iCloud but I followed your advice and made the change successfully.
    Two other linked questions:
    1. Why can't I access icloud.com on my iPad? (to effect the change, I had to use my Mac to go to icloud.com)
    2. Can the e-mail alias addresses be colour coded so that I can easily identify incoming mail?
    Thank you

  • Amend a FYI Notification

    Dear All,
    I hope that you can guide for this issue.
    We have a need to include Absence Details in our FYI Notifications for Absences.
    The Notification that we receive has no details and FYI Recipients do not have an insight of the Absence.
    We tried to include a FYI Group in our AME Configuration.
    By doing so, we managed to send a copy of the Notification for Approval to the FYI.
    However, what we have noticed is that once the Approver acts on this Notification and closes it, the FYI Notification is closed as well.
    We tried to amend the Workflow Notification by setting the Expand Roles Checkbox after some RnD, but still same issue.
    But one thing that we did not do was to bounce the server after setting the Expand Roles Checkbox.
    Pls. advise people
    Thks
    Ravi

    Hi,
    If you want to send the absence type also along with FYI then take the back up of message and add the fuction (in this func set the attribute with the absence type) to get the absence type before this FYI noti. Use this attribute in your seeded message.
    Note : Before makig ay change to seeded message take its back up.

  • Using textarea in a blog

    Hi
    It might seem a bit strange but still i would go on and ask.
    Actually I am trying to use
    <textarea rows="20" cols="20">xyzasfg</textarea>
    in my Blog.
    I thought this tag would put the code enclosed inside it in a textarea.
    But nothing of the sort is happening.
    Check the following Blog for the code snippets in textarea. i want something similar
    /people/prakash.singh4/blog/2005/08/05/useful-undocumented-javascript-code-for-portal
    Kindly suggest what needs to be done.
    Thanks and Regards
    Avinash

    Hi Avinash,
    See above the text area in blog drafting page. You will find an html button.
    On clicking it u will see the html version of your blog.
    You have to enclose your code there in the textarea  dag.
    This will give the desired format.
    I hope it helps.
    Regards,
    Sumit

  • How to disable 'Hello'tried about loop:enabled -not working

    I have the new version of Mozilla Firefox and it starts up with 'Hello' that allows video talking. I have tried to amend about:config, loop:enabled to disable it but this does not work, each time I start up my machine 'Hello' is back.
    Any suggestions? Could the fact that my History clears daily mean the change to Hello is not being saved?

    hello DivaDiva, are you referring to the current hello promotion on the firefox start page? this is different from the actual feature itself which you can disable through the loop.enabled preference & will be featured on the homepage for just a few days...

  • Help with TextArea

    Hi, I've tried creating a TextArea that will take user input and store it in a String.
    This is what I've tried:
    opinion = "Please type any suggestions or comments that may you have: \n";
    JTextArea textArea = new JTextArea (opinion,8,40);
    getContentPane().add(textArea);
    textArea.setLineWrap(true);
    comment = textArea.paramString();
    it cannot resolve getContentPane(), paramString() is protected.
    Thank you, your comments & suggestions are appreciated...

    first... getContentPane() only works in JFrame and JApplet, basically it's only used in swing components.
    second... what are you trying to do here?
    comment = textArea.paramString();
    Is comment the string you are trying to save the users comments into? If so, try:
    comment = textArea.getText();

  • I am trying to set an iMessage account and trying to us my Apple ID but it keep telling me its wrong.I even had to reset and possibly create a new one.So what should I do then?

    I am trying to create an IMessage account and it would not accept my Apple ID.What should I then do to create one?

    Where are you trying to amend your username?
    It should be done at http://appleid.apple.com/

  • Help needed with amending a script

    I am trying to amend an Apple Script (called Narcolepsy) that forces insomniac Macs to go to sleep when the normal energy saving prefs do not work as with my G4MDD. The script, as it stands, works perfectly. The G4 now sleeps as it should. What I want the script to do is not send my Mac to sleep when Super Duper! is running which I've scheduled to do every day. I've amended the original script that prevented sleep if EyeTV is recording to the following - except this doesn't work. All I actually did was substitute "SuperDuper!" for "EyeTV' under the tell application command thingy.
    --Stay awake if SuperDuper! is playing or recording
    tell application "SuperDuper!"
    if it is running then
    if «class Plng» is true then return nextCheck * 60
    if «class IRcd» is true then return nextCheck * 60
    end if
    end tell
    What I should change it to?

    You don't have the full script, so I can't see what the rest of it is doing.
    However, it seems to me that it's likely that SuperDuper! does not know what the Ping and IRcd classes are.
    You could try just putting this before everything else in your script. It will pause processing for a minute at a time whilst an application is still running. In this example, I have used Address Book (which you'll need to change to SuperDuper!) and a dialog to show what happens when you close the app, but you can remove that last line.
    tell application "System Events"
    set ProcessList to (name of every process)
    repeat while ProcessList contains "Address Book"
    delay 60
    set ProcessList to (name of every process)
    end repeat
    end tell
    display dialog "Address Book just Closed"

  • I had $100 in my account. Got an email telling me someone was trying to download "掌上三国". I restore my password only to see my money's gone. What can I do?

    I had $100 in my account. Got an email telling me someone was trying to download "掌上三国". I restore my password only to see my money's gone. What can I do?
    The most horrible thing is that I got two emails from Apple: One saying that I was purchasing the above item with a device not linked to my account... the second email said I downloaded the item to a device not linked to my account (why does Apple permit this anyway?)
    Is there a way to recover my money?
    Thanks in advance.

    Where are you trying to amend your username?
    It should be done at http://appleid.apple.com/

Maybe you are looking for