Best way to detect a change in a JTextBox

I need to store the contents of a JTextBox when it changes, what is the best way?

Attach a DocumentListener to the Document object associated with each edititable text component. as in:
textField.getDocument().addDocumentListner(new DocumentListener() {
...

Similar Messages

  • What's the best way to detect that text fits into ContainerControllers without scrolling?

    Hi.
    Question
    What's the best way to detect that text typed by user (or added programmatically) exceeds available container space and find out where starts truncated part? Is there available some other (than described bellow) easy way to detect it or disallow set of controllers to receive more characters that can be displayed in given composition area?
    My partialy failed attempt (simplified)
    For example lets say that I've got an editable textflow with attached two instances of ContainerController.
    var flow:TextFlow = createSomeFlowFromGivenString(sampleText),
        firstController = new ContainerController(firstSprite, 100, 30),
        lastController = new ContainerController(secondSprite, 600, 30);
    flow.interactionManager = new EditManager(new UndoManager());
    flow.flowComposer.addController(firstController);
    flow.flowComposer.addController(lastController);
    flow.flowComposer.updateAllControllers();
    With enabled vertical scroll policy I can compare height of the composition in last controller with height of the content:
    var bounds:Rectangle = lastController.getContentBounds(),
        overflow:Boolean =  lastController.compositionHeight < bounds.height;
    trace('Content does not fit into given area?', overflow)
    But when I switch vertical scroll policy off (lastController.verticalScrollPolicy = ScrollPolicy.OFF) - unfortunately this no longer works...(In my case scrolling should be dissabled, since text areas might have only one line with restricted width)
    Use case
    I want to create fillable form. Field might have a single or multiple lines. One field might start in the middle of the page, continue in the next line where it spreads through whole page and end in the - quarter of page width long  - third line. Text typed by the user can't exceed given area since it might cover some static text that sits right after/below field.
    Something like ascii image bellow:
    |                <PAGE>                    |
    |                                          |
    |                                          |
    |                                          |
    |               [Field starts here........ | 
    | ........................................ |
    | ........................................ |
    | Ends here..]                             |
    |                                          |
    |                                          |
    | [Another field] xxxx  xxxx xxxxxxxx x xx |
    | xxxxxxxxxxxxxxxxxxx                      |
    |                                          |
    |                              [One more.. |
    | .....]                                   |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    Info:
    [......]  <-- form fields starts with '[' character, and ends with ']'
    xxx       <-- sample, static text
    | and _   <-- page borders

    I've tried something like that previously, but it didn't work because then I've got vertical scroll policy to set to 'auto'. After changing verticalScrollPolicy to ScrollPolicy.OFF  in the last container it worked like a charm.
    Thanks zhen bian

  • Best way to remove all changes

    What is the best way to remove all changes that were done to an image in Camera Raw, to get the image back to the way it was originally?

    Thanks for the suggestion. That would probably work if the file was still open in Camera Raw. But when the file has been opened in Camera Raw, changes are made, then click Done and the image is closed -- the next time it is opened in Camera Raw, Alt/Option clicking the Reset button does not return the image to it's original condition.

  • What is the best way to detect loss of OPC Server connection when using DSC Tags?

    I'm using the DSC Module on a new project and I'm pretty impressed so far. The HMI Wizard has saved me quite a bit of time.
    My application is configured where the DSC Tags are connected to remote OPC Server Tags.
    The issue I'm having is that I cannot detect a loss of the OPC Server when the application is running. Read's of the front panel controls/indicators still return values and the little "connection" icon next them is still green. Even if the connection icon turned red it wouldn't help since the Front Panel is not visible when the main application is running. It is a Sub-VI that's in charge of OPC Data Interfacing. The rest of the application uses the data from the OPC Sub-
    VI.
    I cannot effect a change on the OPC Servers, so I need a method of detection when the Server is lost on my end.
    Any ideas on the best way to do this?
    Thanks,
    Jim

    Hi Jim,
    Ideally, error-reporting and -handling should be the way to handle this. However, if errors are not reported/handled as is sometimes the case with OPC, a quick-n-dirty way to do this would be to check for a "heartbeat" signal from your OPC Server. This could be a boolean tag which toggles On and Off (or a counter ticking). You then read this Tag in DSC in a slow loop using the Read Tag VI (not the front-panel control). And keep track of the Changed? output from this Read Tag VI.
    As long as the 'Changed?' output is true, you are receieving data from the OPC Server, and hence it's alive. You may add some deadband logic to wait for a specific period of time before declaring the Server's really dead!
    Hope this helps,
    K
    halid

  • What's the best way to create and change local workstation account details?

    Hi,
    I need to change local password of an account on a number of our domain based machines. Or create the user if it doesn't exist.
    We have over 200 machines so this will need to be done as a bulk job.
    I've looked into doing this by GPO Preferences, but it appears that MS have removed this functionality with a hotfix.
    What's the best way of doing this now, as I would have through that this is a feature that most organisations would require.
    Thanks

    Hi,
    I understand you. However, based on my understanding, from the standpoint of security, Microsoft has chosen to deprecate this function, for it’s not secure to set passwords
    in Group Policy Preferences.
    The following article sheds more light on this topic and can be referred to for more information.
    Why Passwords in Group Policy Preference are VERY BAD
    http://www.grouppolicy.biz/2013/11/why-passwords-in-group-policy-preference-are-very-bad/
    Best regards,
    Frank Shen

  • What is the best way to detect peak to peak voltage for the following waveform ?

    I have two channels of waveform train ( ie W1 & W2 ), each of them is of frequency 64KHz.
    Each channel of waveform train consists of sinewaves of 64KHz of fixed amplitude, say 2 V pk to pk, running for 100 cycles, and then rest for 0.15 sec continue with a sinewave of 64KHz of another fixed amplitude, say 1 V pk to pk running for 100 cycles as well, and then rest for 0.15 sec. The above cycle considered as a complete waveform cycle.
    The above complete waveform cycle repeat for 10 cycles and rest for 1.3 sec and repeated itself.
    From the two simulated waveforms (ie W1 & W2), I need to detect and measure the peak to peak voltage of each of the 100 cycles sinewaves.
    What is th
    e best way to achieve that ?

    The waveform is free running as described above, ie sinewave running at approximate 64 KHz for about 100 cylce at fixed amplitude, say 2V ( actual number of cylce unknown, could slightly more or sightly less, depanding on the machine ) then rest for approximately 0.15sec, another sinewave running at approx. 64KHz at fixed amplitude, say 1.5V ( actual number of cylce unknown, could slightly more or sightly less, depanding on the machine ) running for approx 100 cycles continue...then rest for approx. 0.15 sec .....the above waveform repeated itself and free running .....I would like to capture or trigger each of the 100 cycles sinewave (rest time of 0.15 sec between each approx100 cycles of sinewave) to measure the peak to peak voltage and st
    ore them in array for analysis purpose....what is the best way to achieve that as I do not have time reference, I only know that the waveform is running at the pattern described above.
    Thanks for your help !

  • Best way to detect failure in Metro ethernet networks

    Hello ,
    I am working for a well known provider and I am currently migrating one of my client from Frame-relay to Metro-ethernet link .
    I am actually looking for advices on what sort of mechanism to implement to detect a failure in the ME parth .
    As you probably know , failure on one of the links might cause the CE-SWITCH-PE interfaces to stay up/up and the network will not neceseraliy start converging .
    So far I have implemented BFD along with IP SLA route tracking , I am happy with BFD but the IP SLA is acting "weird" .
    - IP SLA ICMP tracking rely on ICMP packets and was too sensitive to packets lost
    - We switched to ip route sla tracking but I am still unsure about the best way to use or implement this .
    Is there some sort of best practices available somewhere for this ?
    thanks ¨
    T

    Hello Thomas,
    From what i have seen BFD is best bet as it allows to relax the L3 protocols timers ( BGP / any other protocol used between CE- PE ). Another option is to have gre tunnel between the PE - CE link and track this tunnel interface.
    Regards,
    Shreeram

  • Best way to isolate and change color of object

    I have a client that wants hundreds of product photos edited in 8 weeks. The color of the product item needs to be changed for each of the color choices available. The product is shown in a full room display, meaning lots of background imagery and color.
    What's the best (quickest and most accurate) way to select the product? What's the best way to change it to the accurate color?

    Selective color, color range, replace color, convert to LAB, use channels...all methods work. But in the production of "hundreds" of images, you have to outline objects and set up the color shift through adjustment layers. Then it's actionable and not pure drudgery!

  • Best way to detect memory usage etc. on mobile device for debugging?

    Hi
    What's the best way, when developing, to detect memory usage and such while the app is running on the device?
    So you can test it and see if something is causing it to run wild. I'm making an iOS/Android device so I want to try it on both slow and fast phones and I have a script that "adds on" memory usage as the user continues. I would like to monitor this (either in app, or from the debugger) to see what happens.
    Any ideas?
    Thank you

    Wow thanks Yacine! Didn't know this one, it will be a life saver for my IOS debugging !!
    Cheers!

  • The best way to backup and change the macbook pro drive in Lion

    Anyone knows how can i
    backup totally my macbook hard drive including :
    Macintosh HD + Recovery HD + Bootcamp partition
    Without loss of data
    and clone to a bigger Hard disk. (resizing Macintosh HD and Bootcamp Partitions to fit all the new Drive)

    djbabybokchoy wrote:
    Nothing specific, just speaking in general. Ex-wives, governments, bad guys...anyone really. I'm just looking to make my Mac a bit more private and secure, especially when on public networks.
    Governments and ex's will/may have recourse to the legal process (or in the case of the Gov they can choose to ignore the legal system if they feel like it) when they want to see something of yours, good luck hardening your Mac against that. The best way to avoid the possibility of snooping over public networks is to avoid them but if you can't then Kappy's suggestion will help.
    Strong passwords (everywhere) and don't use the same password in multiple locations.
    If you really want to secure your home wireless use Mac address connection authentication, do not allow unknown Mac addresses to connect. It's much stronger than a WPA password alone.

  • Best way of cloning and changing to a new internal harddrive

    Hello all,
    I have bought a 500gb seagate momentus 7200 harddrive that I want to upgrade my macbookpro with.
    Is the best solution to first clone the internal drive to this new drive with superduper, and then do the actually change, or is there another better way to do this??
    The machine is a 4.1, from March 2008 with a current 200gb internal drive.

    kenbrox,
    kenbrox wrote:
    But wouldn't this be a bit risky if the time machine restore doesn't work. I remind you that I'm not doing the actual change myself due to warranty issues...
    I have restored from a Time Machine backup many, many times. It works like a charm. However, it is never a good idea to place all one's eggs in one basket. Can I assume that you already have an external enclosure in which to place either the old or the new drive? If you run into problems restoring from Time Machine, you'll always have Disk Utility and its "Restore" function. Your fallback would be to place the old drive in the enclosure, boot to the Leopard DVD, connect the enclosure/old drive, then use Disk Utility's Restore function to "clone" the old drive to the new. Still, I would recommend using Time Machine, with the cloning option held in reserve.
    Does a Time Machine backup hold all program installs etc also?
    Provided you have chosen to backup application and system files (the default), YES! Performing a full restore from a Time Machine backup restores...... everything. There are only two "byproducts" of performing a full restore:
    1) Your startup volume must be re-indexed by Spotlight when you boot to the restored installation the first time. This takes a while, and uses a lot of CPU while it is in progress.
    2) Mail will take a minute or so to "re-import" your mailbox folders the first time it is run after performing the restore. If I am not mistaken, this is only to re-index.
    Scott

  • [CS3] Whats the best way to track model changes? Document Observer? Selection Observer?

    Hello,<br /><br />Usecase I am working on needs to track following events:<br />1. A page item was created/deleted/resized/moved/etc..<br />2. A text was inserted/deleted<br />3. A page was created/deleted<br /><br />Since the list is quite broad I am wondering if there are known best practices to follow. <br /><br />I have tried attaching to Command manager via Document Observer:<br /><br />  InterfacePtr<IDocument> iDocument(this, UseDefaultIID());<br />  InterfacePtr<ISubject> iSubject(iDocument, UseDefaultIID());<br />  iSubject->AttachObserver(ISubject::kRegularAttachment,this, IID_ICOMMANDMGR, IID_IMYDOCOBSERVER);<br /><br />Then during "update" call:<br /><br />  if (protocol != IID_IHIERARCHY_DOCUMENT) break;<br /><br />  ICommand* iCommand = (ICommand*)changedBy;<br />  if (iCommand->GetCommandState() != ICommand::kDone) break;<br /><br />  const UIDList itemList = iCommand->GetItemListReference();<br />  if (itemList == nil || itemList.IsEmpty()) break;<br /><br />  ClassID commandClassID = ::GetClass(iCommand);<br />  if(commandClassID.Get() == kAddToHierarchyCmdBoss || kPlacePICmdBoss) {<br />      // do something at new item creation<br />  }<br /><br />Problem is "kAddToHierarchyCmdBoss" is not just the one command that is sent while creating a new item. There are dozen others and hence I am not sure if I am watching the right one.<br /><br />Second I tried implementing a selection observer and hope to use HandleSelectionAttibuteChanged. A quick search didnt resulted in any suite that lets me implement my use cases.<br /><br />I was inclined towards command observer because thats at low enough level (and right above database layer) allowing me to trap all model changes.<br /><br />I am not looking for a specific answer/code but more of a guideline how to approach the problem.<br /><br />Suggestions? Comments? Thanks in advance

    There is no silver bullet, and while the command mgr can be useful to find out what's going on in general, it is definitely not the place for own dispatching. You'll have to revisit every command before and after execution, and plenty obscure sub-commands nested within larger sequences. If you handle them all this will seriously degrade performance. One good use of command manager notifications is to yield and inspect the matching commands for UI activities, from within your debug build.
    In your quoted update(), when you check the protocol you're anyway already discarding the command mgr notifications, because the protocol then would be IID_ICOMMANDMGR. Probably you already have attached a bunch of other protocols?
    Comparing to previous versions, the changes listed in 1) are pretty simple, you just subscribe at the document boss, and listen for the protocols IID_IHIERARCHY_DOCUMENT, IID_ITRANSFORM_DOCUMENT, eventually IID_IGEOMETRY_DOCUMENT, IID_IPATHGEOMETRY_DOCUMENT, IID_IINVALSHAPE. These also have an advantage that you get a meaningful theChange (rather than the command mgr's kBeforeDoMessageBoss and alike) and can dispatch on those.
    If you have a previous version of InDesign, there used to be a wildcard protocol IID_IPMUNKNOWN that would yield any notifications on the subject so you could dump them out and search for details. Apparently for performance reasons this was removed with CS3 after some plugins used it for release code, IMO Adobe should just have limited the feature to the debug build.
    Besides to observers, the service registry is full of other notifications, have a look the the cross reference in sdkdocs/html/classISignalMgr.html for the most prominent ones. One exception here, 2) For text edits, you won't even use observers or signals but kEditCmdPreProcessService / IID_ITEXTEDITPREPROCESS service instead, or its sister IID_ITEXTEDITPOSTPROCESS.
    3) Probably you'll again observe the kDocBoss for IID_ISPREADLIST and IID_IMASTERSPREADLIST.
    Regarding selection observers and suites, we're talking model changes here so please just forget about them in this place. Selection observers are used to follow the selection from within UI widgets, such as a palette or control strip.
    Regards,
    Dirk

  • Backing up iTunes folder,best way to just backup changes (extra to TM backu

    Hi
    I now have my iTunes library running off a USB powered portable HDD. I have setup Time Machine to back up the iTunes library from here to.
    I also however as an extra backup, copy the iTunes folder to my NAS. When I add stuff to iTunes, I dont want to keep copying the whole folder over to the NAS, so how can I easily just copy over whats new?
    Any easy way to do this?
    cheers

    the loc-man wrote:
    Any Mac programs that compare 2 folders ? preferably free
    again, Carbon Copy Cloner is free and can be configured to incrementally backup any changes. it can also be scheduled to run @ certain times or e.g. when the target disk is mounted.
    i'm just not 100 % certain if CCC can backup from a NAS. check the site. however, ChronoSync will be able to do that.
    my iTunes lives on a 2 TB firewire drive. i have an identical 2 TB drive acting as backup. when the backup drive is mounted, CCC automatically kicks in, compares the two disks, and copies the new content over. it's fire-and-forget if you will.
    JGG
    edited by the Jolly Green Giant (where Green stands for environmentally friendly)

  • Best way to create a "change user password" site?

    Hi,
    I want to provide my users with a page where they can change their password. I thought that I could just use the one from the system application (changepw.htm). But it doesn't feature the design2003 and my application has to have a consistent look and feel.
    So I copied it and tried to get it working but that wasn't possible because it relies on an application class which I can't get working (it relies on the IF_BSP_APPLICATION_EVENTS) because I don't want to use it as a general application-class and so some methods will not be called.
    It seems that the only choice left is to start my own site which will reuse most of the code from the system application class. But before I start reinventing the wheel I would like to know: How have you implemented this functionality?

    Hi Deepak,
    My approach was the following. I created a new controller and a new view for the password site. Then I extracted all the useful methods from the CL_BSP_LOGIN_APPLICATION class and put it in my controller class. I recycled all the translation stuff so that the page is available in different languages and I also used a lot code from the CHANGE_PW_PROCESSING method. I think it took me nearly a day to get everything working. The most annoying part was testing it because our sap system didn't allow you to change your password twice a day so I had to use lots of test user accounts
    Regarding your other question. I have never worked with the BW but from a technical standpoint I am sure that it's possible to change your password when https/SSO is not enabled. But I would never allow my users to change their password when they are not using https.

  • Synching.  In the past I have synched my iPhone and ipad to my iMac.  I would like to now synch my iPhone and ipad to a macbook pro.  What is the best way to make that change without losing something ?  To stop synching to the seldom used iMac.

    My dumb question.      I have been synching iphone and ipad to imac.    I want to start syncing those devices to my mac book as I use that primarily and the imac seldom.    I do use Time machine and have backups but was concerned I might create a problem for myself if I didn't  check the right box somewhere.    I imagine there is a simple simple way to do this  ?

    You have 90 days of free AppleCare on all new Macs, and if you purchased AppleCare (STRONGLY RECOMMENDED) you also have 3 years of telelphone support. I'd recommend calling AppleCare to to support  your MBP.

Maybe you are looking for

  • Sales Orders :: OpenSum differs from OpenQty*Price

    Hello all, Creating a backlog report for a customer, I've found that, for partially delivered Sales Orders rows the OpenSum = LineTotal when, in my opinion, it should be OpenSum = OpenQty x Price. Can anyone confirm what should be the correct value o

  • 11.0.06 crashes at data entry

    Windows XP, Service Pack 3 I never had any trouble with Adobe Reader until I installed v.11, now it frequently crashes when entering data into IRS forms or when saving the forms.  When I write "crash" I mean the application closes.  I've sent so many

  • I have an old Airport any want to install it on my Mac OS X

    How do I install an old Air Port to my Mac OS X

  • Catching Exception of a function in a procedure

    Hi, I have a procedure named P calling a function named F. If function F returns no value.. I want to catch that exception in the procedure/function itself and display to the user that the function named F has returned without any values. Thanks in a

  • Plz help me in my Analog Clock  !!!

    Hi everyone,this is super007remo.I am in a way of developing an Analog Clock n finished with clock structure and seconds hand.Can anyone help in adding minutes and hours hands ,plzzzzz.Any kinds os suggestions r invited. /*<applet code=time.class wid