How can detect certain text (String) was input in a JTextArea?

Hi friends,
while trying to simulate a telnet shell, i create a JTextArea and put all the input and output text (from telnet) in it. I want to do some info updating in another JPanel when user logs in. Hence I need to detect if user correct logged in, say, a prompt will appear in JTextArea, such as :
[remote host]>
I need here a Listener for detecting, could someone tell me how i can do it, or which Class or Interface or Methods i should use? Many thanks in advance!!!
eedych

I found something that I hope helps:
The java.awt.TextArea could be monitored for changes by adding a TextListener for TextEvent's. In the JTextComponent based components, changes are broadcasted from the model via a DocumentEvent to DocumentListeners. The DocumentEvent gives the location of the change and the kind of change if desired.
Example code :
DocumentListener myListener = ??;
JTextArea myArea = ??;
myArea.getDocument().addDocumentListener(myListener);
Just use the DocumentListener like any other listener. :) Good luck.

Similar Messages

  • How can i remove text in between the tags

    Hi 
    I want to remove the text inside the xml tags and am failing to do so. i have tried this codding with no results.
    <value>yes</value> = <value></value>
    <value>yes</value> = <value></value>
    <value>yes</value> = <value></value>
    my code:
                    string text = File.ReadAllText(outputFilePath);
                    text = DeleteBetween1(text,"<value>", "</value>");
     public string DeleteBetween(string STR, string FirstString, string LastString)
                string regularExpressionPattern1 = @"(?:\" + FirstString + @")(<^<>+)\<\/" + LastString;
                Regex regex = new Regex(regularExpressionPattern1, RegexOptions.Singleline);
                MatchCollection collection = regex.Matches(STR.ToString());
                var val = string.Empty;
                foreach (Match m in collection)
                    val = m.Groups[1].Value;
                    STR = STR.Replace(val, "");
                return STR;

    hi,
    you can try below.
    https://social.msdn.microsoft.com/Forums/en-US/b9b4d8d6-38ba-4483-abfd-4939aca0593d/how-can-i-extract-text-string-between-two-tags-?forum=csharpgeneral
    hope that helps.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Please can someone explain how to retrieve deleted text, I was clearing old text when one came through at the same time so was also deleted.

    Can someone please tell me how to retrieve deleted text. i was clearing old texts when a new one came through at the same time and was deleted also.  My last update was  iOS 8.1.2

    You restore from a backup that was created after the text was received but before it was deleted.
    But if you literally deleted it right after it came in, then it's not recoverable.  Have the other person resend the text.

  • How can detect and remove scanned white pages in an OCRd pdf file?

    How can detect and remove scanned white pages in an OCRd pdf file?

    Acrobat does not support an automated way of doing this directly. You can
    remove completely blank pages (pages that don't have any "marking
    objects"), but a scanned page does contain an image, so Acrobat won't help
    you here. There are a number of 3rd party applications and plug-ins
    available. Try a Google search for
    remove blank pages from scanned
    pdf<http://www.google.com/search?client=safari&rls=en&q=removeblankpagesfromscanned+pdf&ie=UTF-8&oe=UTF-8>
    This will bring up a few different solutions.
    Another way is to use JavaScript to find text. You say that these documents
    are OCRed, so if you have a blank page, it should not have any text on it.
    With some JavaScript, you can identify pages that don't contain text. This
    may however fail if you have a page that contains just e.g. a photographic
    image. There won't be any text, but the page is certainly not blank.
    Karl Heinz Kremer
    [signature removed by host]

  • How can I hear text notification in Resound hearing aid when in vibrate mode?

    How can I hear text notification in Resound hearing aid when in vibrate mode?

    You should turn off "Auto input monitoring". I only have L8 and there you find it under Options->audio->Auto Input monitoring. Would guess that its in the same place in L9
    Morten

  • How can I apply text position attributes (e.g. lower third) to more than one title at a time?

    How can I apply text position attributes (e.g. lower third) to more than one title at a time?

    jhb3243
    What version of Premiere Elements are you using and on what computer operating system is it running?
    In the case of this theoretical lower third to be applied to more than one title at a time
    a. Is there text in the lower third besides a graphic of some kind?
    b. Are all the titles to which this lower third is to be applied all together on the Timeline or scattered?
    If no text in lower third and titles all together, then, with text titles on Video 1 and lower third on Video 2, drag out the lower third to cover the length of the text titles on Video 1.
    I do not find "lower third" title files to be in the same category as certain effects where the Copy and "Paste Attributes" or "Paste Effects and Adjustments" lend themselves so well.
    Let us see what others have to say about all this. I will continue to experiment with what you seek and how you would prefer to get there. I am not optimistic but I will try.
    Thanks.
    ATR

  • Mountain Lion Recovery DVD - How can I make one, ML was installed on my iMac and BBP

    Mountain Lion Recovery DVD - How can I make one, ML was installed on my iMac and MBP when I purchased them. When I look at the App Store, it dose not show ML as purchased (to download again) - do I have to purchase it again to make a Recovery DVD?
    Thanks for your help.
    Regards
    NGI

    do i have to purchase it again to make a Recovery DVD?
    No. You can still make a bootable recovery DVD, but you will not be able to make a full bootable copy of ML without purchase.
    1) Enable the debug menu for Disk Utility via Terminal Application. Navigate to terminal by typing "terminal" in   spotlight. Copy the bolded text below and enter it into the command prompt:
    defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true ; open -a "Disk Utility" ; exit
    2) From the Debug Menu > Select Show every Partition > Recovery HD should appear
    3) Right click (control + click) the Recovery HD partition and select "Mount"
    4) Right click again the partition again > "Reveal Recovery HD in Finder". Leave this window open
    5) At this point, you will need open terminal again and enter the following command:
    sudo chflags nohidden /Volumes/Recovery\ HD/com.apple.recovery.boot/BaseSystem.dmg ; exit
         Type your password when prompted.
    6) Navigate back to the Recovery HD finder Window > com.apple.recovery.boot > BaseSystem.dmg
    7) Drag "BaseSystem.dmg" into Disk Utility's sidebar.
    8) Insert your DVD
    9) Select "BaseSystem.dmg" in the sidebar and hit "Burn"
    Once the burn is completed, hold option down at startup and select the DVD to boot. This is a bootable Recovery partition, not a bootable copy of ML.
    Note: to disable the debug menu,
    defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool false

  • How can i highlight text in the Adobe Difital Editions?

    How can i highlight text in the Adobe Difital Editions?

    You have to remember that Digital Editions was never designed to have 'text
    editor' capabilities.  BTW: Bluefire and Overdrive also have such
    limitations.  Put in another frame of reference, DE presents you with the
    ebook, as you would be presented with a physical printed book.
    ==============

  • How can I show text sentence on XY graph

    Hello,,,, anyone knows??? How can I show text sentence on XY graph?
    I just know that the only numeric data type can be the input data but my case I have both the number and message to show on the same graph.
    Thanks in advance
    Mannie

    You start out with an array of zero size. Since replace array subset does not change the size of an array, you stay with zero annotations. If nothing is there, you cannot replace it.
    Possible solutions:
    (A) Instead of reading the current annotation list (which is zero!), you could initialize the shift register with a diagram constant (right-click...create constant), expand it to the desired number of elements and make them all e.g. with a blank text.
    (B) Alternatively, you can manually create the desired number of annotation by right-clicking on the graph and select "data operations...create annotations". Now you start of with an array of the correct size if you read the annotation list with a property node and you can replace them programmatically with new annotations as desired.
    (C) You can also initialize the shift register with an empty array, then use built array to add annotations.
    LabVIEW Champion . Do more with less code and in less time .

  • How to search specific text/string in pdf files from command prompt?

    Hi,
    How to search specific text/string in pdf files from command prompt?
    Will be great if you can refer to any adobe provided command base utility to achieve the above target.
    Best Regards,

    You can't. The commandline parameters for Acrobat and Adobe Reader do not allow any type of commands to be run.

  • How can I determine which image was clicked in 3D carousel?

    I have been modifying some 3D carousel code that I found in hopes that I can get it such that when image "resolv2.jpg" (or any of my other images) is clicked on at the front of my carousel, it goes to a specific webpage. By just replacing "moveBack(event.target) from the toggler section of the code with "navigateToURL:(newURLRequest('http://google.com'), the target DOES sucessfully go to google when clicked on. However, I want to modify this code by altering the else statement to say something to the effect of "else if event.target (clicked on object) is 'resolv2.jpg' THEN go to google". So essentially, my question is how can I determine which image was clicked? Here is the entire code with the area I was altering bolded:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init();" backgroundGradientColors="[#000033, #000033]" backgroundGradientAlphas="[1.0, 1.0]">
    <mx:Script>
              <![CDATA[
    //Import Papervision Classes
                   import org.papervision3d.scenes.*;
                   import org.papervision3d.cameras.*; 
                   import org.papervision3d.objects.*;
                   import org.papervision3d.objects.primitives.*;
                   import org.papervision3d.materials.*;
                   import org.papervision3d.materials.shadematerials.*;
                   import org.papervision3d.materials.utils.MaterialsList;
                   import org.papervision3d.lights.*;
                   import org.papervision3d.render.*;
                   import org.papervision3d.view.*;
                   import org.papervision3d.events.*;
                   import org.papervision3d.core.*;
                   import org.papervision3d.lights.PointLight3D;
                   import flash.filters.DropShadowFilter;
                         import caurina.transitions.*;
                         private var numOfItems:int = 5;
                         private var radius:Number = 600;
                         private var anglePer:Number = (Math.PI*2) / numOfItems;
                         //private var dsf:DropShadowFilter = new DropShadowFilter(10, 45, 0x000000, 0.3, 6, 6, 1, 3);
                   public var angleX:Number = anglePer;
             public var dest:Number = 1;
                   private var theLight:PointLight3D;
            //Papervision Engine
                   private var viewport:Viewport3D; 
                   private var scene:Scene3D; 
                   private var camera:Camera3D;
                   private var renderer:BasicRenderEngine;
             private var planeArray:Array = new Array();
             [Bindable]
             public var object:Object;
             private var arrayPlane:Object;
             private var p:Plane;
             //Initiation function           
             private function init():void 
             viewport = new Viewport3D(pv3dCanvas.width, pv3dCanvas.height, false, true); 
             pv3dCanvas.rawChildren.addChild(viewport); 
             viewport.buttonMode=true;
             renderer = new BasicRenderEngine();
             scene = new Scene3D(); 
             camera = new Camera3D();
             camera.zoom = 2; 
             createObjects(); 
             addEventListeners();
    //Create Objects function          
              private function createObjects():void{
              for(var i:uint=1; i<=numOfItems; i++)
                        /* var shadow:DropShadowFilter = new DropShadowFilter();
                        shadow.distance = 10;
            shadow.angle = 25; */
                        var bam:BitmapFileMaterial = new BitmapFileMaterial("images/resolv"+i+".jpg");
                        bam.oneSide = false;
                        bam.smooth = true;
            bam.interactive = true;
                        p = new Plane(bam, 220, 200, 2, 2);
                        p.x = Math.cos(i*anglePer) * radius;
                        p.z = Math.sin(i*anglePer) * radius;
                        p.rotationY = (-i*anglePer) * (180/Math.PI) + 270;
                        scene.addChild(p);
                        //p.filters=[shadow];
                        p.extra={pIdent:"in"};
                        p.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
            planeArray[i] = p;
              // create lighting
            theLight = new PointLight3D();
            scene.addChild(theLight);
            theLight.y = pv3dCanvas.height;
              private function toggler(event:InteractiveScene3DEvent):void
                            // if the cube's position is "in", move it out else move it back
                            if (event.target.extra.pIdent == "in")
                                    moveOut(event.target);
                            else
                                   moveBack(event.target);
                    private function moveOut(object:Object):void
                              trace(object +" my object");
                            // for each cube that was not selected, remove the click event listener
                            for each (var arrayPlane:Object in planeArray)
                                    if (arrayPlane != object)
                                            arrayPlane.removeEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
                            //right.enabled=false;
                            //left.enabled=false;
                            // move the selected cube out 1000 and rotate 90 degrees once it has finished moving out
                            Tweener.addTween(object, {scaleX:1.2, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            Tweener.addTween(object, {scaleY:1.2, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            // set the cube's position to "out"
                            object.extra = {pIdent:"out"};
                            // move the camera out 1000 and move it the to same y coordinate as the selected cube
                            //Tweener.addTween(camera, {x:1000, y:object.y, rotationX:0, time:0.5, transition:"easeInOutSine"});
                    private function moveBack(object:Object):void
                            // for each cube that was not selected, add the click event listener back
                            for each (var arrayPlane:Object in planeArray)
                                    if (arrayPlane != object)
                                            arrayPlane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
                            // move the selected cube back to 0 and rotate 90 degrees once it has finished moving back
                            Tweener.addTween(object, {scaleX:1, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            Tweener.addTween(object, {scaleY:1, time:0.5, transition:"easeInOutSine", onComplete:rotateCube, onCompleteParams:[object]});
                            // set the cube's position to "in"
                            object.extra = {pIdent:"in"};
                            // move the camera back to its original position
                            //Tweener.addTween(camera, {x:0, y:1000, rotationX:-30, time:0.5, transition:"easeInOutSine"});
                            //right.enabled=true;
                            //left.enabled=true;
                    private function goBack():void
                            // for each cube that was not selected, add the click event listener back
                            for each (var arrayPlane:Object in planeArray)
                                    if (arrayPlane != object)
                                            arrayPlane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, toggler);
                    private function rotateCube(object:Object):void
                            //object.rotationX = 0;
                            //Tweener.addTween(object, {rotationZ:0, time:0.5, transition:"easeOutSine"});
              private function addEventListeners():void{
        this.addEventListener(Event.ENTER_FRAME, render);
    //Enter Frame Listener function             
    private function render(e:Event):void{ 
                     renderer.renderScene(scene, camera, viewport);
                     camera.x = Math.cos(angleX) * 800;                                                  
                     camera.z = Math.sin(angleX) * 800;
    private function moveRight():void
              dest++;
              Tweener.addTween(this, {angleX:dest*anglePer, time:0.5});
              //goBack();
    private function moveLeft():void
              dest--;
              Tweener.addTween(this, {angleX:dest*anglePer, time:0.5});
              //goBack();
              ]]>
    </mx:Script>
              <mx:Canvas width="1014" height="661">
              <mx:Canvas id="pv3dCanvas" x="503" y="20" width="400" height="204" borderColor="#110101" backgroundColor="#841414" alpha="1.0" backgroundAlpha="0.57"> 
              </mx:Canvas>
              <mx:Button x="804" y="232" label="right" id="right" click="moveRight(),goBack()"/>
              <mx:Button x="582" y="232" label="left"  id="left"  click="moveLeft(),goBack()" />
              </mx:Canvas>
    </mx:Application>

    Your answer may be correct, but I am very much a beginner to actionscript, and I was wondering moreso if it is possible to determine the root/url (i.e. images/resolv2.jpg)? Or even if InteractiveScene3DEvent calls a variable that holds this url? However, specifically, I'm just wondering if the actionscript itself could determine the url in a line of code such as "if object == BitmapFileMaterial("/images/resolv2.jpg"); "? Also, here's a copy of InteractiveScene3DEvent in more detail if you think that will help:
    public class InteractiveScene3DEvent extends Event
                         * Dispatched when a container in the ISM recieves a MouseEvent.CLICK event
                        * @eventType mouseClick
                        public static const OBJECT_CLICK:String = "mouseClick";
                         * Dispatched when a container in the ISM receives an MouseEvent.MOUSE_OVER event
                        * @eventType mouseOver
                        public static const OBJECT_OVER:String = "mouseOver";
                         * Dispatched when a container in the ISM receives an MouseEvent.MOUSE_OUT event
                        * @eventType mouseOut
                        public static const OBJECT_OUT:String = "mouseOut";
                         * Dispatched when a container in the ISM receives a MouseEvent.MOUSE_MOVE event
                        * @eventType mouseMove
                        public static const OBJECT_MOVE:String = "mouseMove";
                         * Dispatched when a container in the ISM receives a MouseEvent.MOUSE_PRESS event
                        * @eventType mousePress
                        public static const OBJECT_PRESS:String = "mousePress";
                         * Dispatched when a container in the ISM receives a MouseEvent.MOUSE_RELEASE event
                        * @eventType mouseRelease
                        public static const OBJECT_RELEASE:String = "mouseRelease";
                         * Dispatched when the main container of the ISM is clicked
                        * @eventType mouseReleaseOutside
                        public static const OBJECT_RELEASE_OUTSIDE:String = "mouseReleaseOutside";
                         * Dispatched when a container is created in the ISM for drawing and mouse interaction purposes
                        * @eventType objectAdded
                        public static const OBJECT_ADDED:String = "objectAdded";
                        public var displayObject3D                                        :DisplayObject3D = null;
                        public var sprite                                                            :Sprite = null;
                        public var face3d                                                            :Triangle3D = null;
                        public var x                                                                      :Number = 0;
                        public var y                                                                      :Number = 0;
                        public var renderHitData:RenderHitData;
                        public function InteractiveScene3DEvent(type:String, container3d:DisplayObject3D=null, sprite:Sprite=null, face3d:Triangle3D=null,x:Number=0, y:Number=0, renderhitData:RenderHitData = null, bubbles:Boolean=false, cancelable:Boolean=false)
                                  super(type, bubbles, cancelable);
                                  this.displayObject3D = container3d;
                                  this.sprite = sprite;
                                  this.face3d = face3d;
                                  this.x = x;
                                  this.y = y;
                                  this.renderHitData = renderhitData;
    Thank you so much!

  • How can I sync text files into iPhone?

    How can I sync text files into iPhone? like doc. txt. for reading or editing

    The native iPhone OS doesn't allow that. I think there are several solutions to this, some of which may be against the AT&T or Apple rules. One legitimate solution is The Missing Sync for iPhone by mark/space (http://www.markspace.com).
    Before I had an iPhone, I owned a copy of The Missing Sync for Windows Mobile. It was a pretty decent app. In my opinion, though, their app for the iPhone is NOT worth the price ($40 new, $25 for a cross-grade).
    Also, check the App Store (if you have 2.0 software)--there may be an app that does this, probably for a lot less $.

  • How can I put text in transparent background?

    How can I put text in transparent background?
    Message title was edited by: Brett N

    Good day!
    You can create a new document (»Background Contents« set to »Transparent«), use the Type Tool (T) to create text and then save in a format that supports layers like psd, psb, tif.
    If the receiving application can’t handle those png24 is another option.
    Regards,
    Pfaffenbichler

  • How can I disable Text Messaging on my Iphone?

    How can I disable Text Messaging on my Iphone -- so I do not receive any texts. I do not have nor currently want an AT&T text plan, and I really don't want to be charged .20 for the text messages that will inevitably be sent my way from friends & coworkers who do not know I don't want texts.
    AT&T had a link only for blocking spam texts, but I don't think this will stop standard SMS texts.
    Anyone do this? Does this involve a call to AT&T. There must be a way to disable it, no?
    Thanks in advance!
    Message was edited by: motifone

    You would have to ask AT&T if they can turn off your text capabilities.

  • How can i extract data strings (temp. press. rel.hum etc) using a Virtual interface through an RS-232 connection​?

    How can i extract data strings (temperature, pressure, relative humidity etc) using a Virtual interface through an RS-232 connection?

    Try this.  It is in LV 8.5.
    Note the double % in the format string.  This is so the % in the input string is treated as a percent rather than a code.
    You may also have to work with the line feed characters in case they are different in the string coming in compared to how the string shows up in the web browser.
    Message Edited by Ravens Fan on 02-12-2008 10:19 PM
    Attachments:
    Example_BD.png ‏4 KB
    Untitled 11.vi ‏9 KB

Maybe you are looking for