Text components

Hello,
I thought copy/paste functions (ctrl v, ctrl c) were automatically included in Swing Text components but when they are on a JApplet, they don't always work. The keyword is always which is weird because on some computers it works, but others it only will copy/paste text internally in the applet (not from external programs). This is not a signed applet...but the copy and paste from external sources DO work on some computers, so I'm not sure if this is a permissions issue or not. Does anyone know any solutions?
Thanks.

Thank you camickr.
addHighlight() highlights a range of characters and this is exactly what I needed. What about highlighting lines. To highlight a line, I will have to count all characters before that line to get to line start, and then count all characters before next "\n" to get to line end. Then repeat this process for all lines that I need to highlight. Is there an easier way to highlight lines ?

Similar Messages

  • Text input in text components in swing?

    Hi,
    is there any UML diagram, or any site on how text input is carried out in text components? Is it just a simple matter of JTextComponent adding itself as a KeyListener to itself, and then updating the document with each key press? or is there a little more too it?
    thanks,
    J

    justinlawler wrote:
    or is there a little more too it?There's a lot more to it. I think good beginning reading is the summary at the top of the [Javadoc for JTextComponent|http://java.sun.com/javase/6/docs/api/javax/swing/text/JTextComponent.html] . It is a convoluted API that has many "kludges" that can't be completely removed because of the need for backwards compatibility.
    I'd also recommend reading up on the classes EditorKit, InputMap, ActionMap, Keymap, and (Basic)TextUI. Good luck!

  • Arabic numerals not displaying in Swing text components

    On a test system setup with Windows NT Arabic version, we had problems entering Arabic numerics into Swing text components.
    Other Arabic characters were displayed correctly, but numerals were all represented by Western characters ('0 to 9'). Even when using the "Alt-" method to enter the Unicode character codes via. the keypad, we still got incorrect characters.
    When using the keypad to enter the code '\u0660' (Arabic "1"), the code sent to the text component was '\u2022' (Bullet).
    We tried this on an English system and the same code was passed to the text component.
    Does anyone have any suggestions as to what might be the cause of this problem ?
    Thanks,
    Brian...

    hello!
    I am developing an arabic editor but i am unable to display the arbic numeric in swing text .Plz help me on this topic and send some code example on this topic.
    I have another problem about events i.e how can i handle the beckspace event, enter event, and spaceevent?
    plz send me mail .
    Thanx for advance.

  • Fetching all text components for query - RSRREPDIR / RSZELTXREF / RSZELTTXT

    Hi all,
    I am developing a tool to fetch all the text components for a BI query. The texts are then to be translated and uploaded back to the BI system, but right now we are first focusing on downloading the texts.
    In the tool, the user inputs the query technical name on the screen, after which my approach is as follows:
    1) Fetch Query UID from table RSRREPDIR using Query technical name.
    2) Fetch all element UIDs from table RSZELTXREF using Query UID and by resolving the hierarchies. Agreed, the hierarchies in the table RSZELTXREF are very complex.
    3) Provide all element UIDs, including root query UID, to the table RSZELTTXT, and fetch TXTSH and TXTLG texts.
    Now, my question is at step 2: Which are the UIDs that I should fetch? Specifically, should I fetch only those UIDs which have Layout Type as 'ROW' / 'COL' / 'SHT', or should I fetch all UIDs regardless of Layout Type?
    Secondly, my understanding is that because of the table hierarchy, I should continuously feed the field TELTUID back to SELTUID until the Layout Type is 'NIL'. When this happens, I am at the Element Level. Is this correct?
    Thanks in advance,
    Shailesh.

    Now in the following code, why are u creating a new form?
    Why dont you use the form which is input to the Action Class's execute methof?
    if(rs.next()){
    EditForm e=new EditForm();
    e.setEmpname(rs.getString(1));
    }Thanks and regards,
    Pazhanikanthan. P

  • Changing the Text Cursor for all Text Components

    Hi,
    The users have asked me to change the text cursor i.e, the vertical cursor for all the text components in our application.
    Is there a common way to change it , without having to call the setCaret method for each of the text components ?
    I saw that Cursor class has a Cursor type called TEXT_CURSOR. I'd like to be able to change that cursor.
    Any ideas, suggestions?
    Thanks!

    I was talking about the blinking vertical caret - sorry I got confused between the I-beam cursor and the caret(!).
    I wanted to change the caret color at the very least.
    Although preferably, I would like to make it a bit wider.
    I just found one solution to change the caret color across all the textfields using UIManager -
        Color caretColor = Color.GREEN;
        UIManager.put( "TextField.caretForeground", caretColor);
        UIManager.put( "FormattedTextField.caretForeground", caretColor);
        UIManager.put( "TextArea.caretForeground", caretColor);
        UIManager.put( "PasswordField.caretForeground", caretColor);Thanks

  • [svn:fx-trunk] 10214: This fixes the problem that if two text components share the same textFlow there is an infinite loop involving updateDisplayList - damageHandler - invalidateDisplaylist - back to updateDisplayList.

    Revision: 10214
    Author:   [email protected]
    Date:     2009-09-13 07:33:58 -0700 (Sun, 13 Sep 2009)
    Log Message:
    This fixes the problem that if two text components share the same textFlow there is an infinite loop involving updateDisplayList -> damageHandler -> invalidateDisplaylist -> back to updateDisplayList.  The bug file was for TextArea which is RET but the same bug was in RichText as well.
    This example with a renderer exposed it because the typicalItem that is composed to figure out sizes and the actual first item in the list share the same textFlow.  It actually has nothing to do with useVirtualDisplay other than it was sharing a textFlow.
    It turns out that the TextFlowFactory dispatches damage events every time the textFlow is composed.  Unlike when the flowComposer is used, it always considers the flow damaged.  It was exacerbated by each of the two components having a damage handler for the same textFlow.
    The solution is to use the textFlow generation number.  In the damageHandler if the generation is the last known generation number, assume no changes, and return immediately from the damage handler.
    QE notes: There are 1 TextArea, 6 TextInput and 2 NumericStepper failuers, with or without my changes.  The common link seems to be DispatchKeyEvent.  Most were testing maxChar, displayAsPassword and restrict.  I tested these and they seem to be working correctly.
    Doc notes:
    Bugs: SDK-23002
    Reviewer: Gordon
    Tests run: checkintests, TextArea, TextInput and NumericStepper
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23002
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichEditableText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/RichEditable TextContainerManager.as

    Revision: 10214
    Author:   [email protected]
    Date:     2009-09-13 07:33:58 -0700 (Sun, 13 Sep 2009)
    Log Message:
    This fixes the problem that if two text components share the same textFlow there is an infinite loop involving updateDisplayList -> damageHandler -> invalidateDisplaylist -> back to updateDisplayList.  The bug file was for TextArea which is RET but the same bug was in RichText as well.
    This example with a renderer exposed it because the typicalItem that is composed to figure out sizes and the actual first item in the list share the same textFlow.  It actually has nothing to do with useVirtualDisplay other than it was sharing a textFlow.
    It turns out that the TextFlowFactory dispatches damage events every time the textFlow is composed.  Unlike when the flowComposer is used, it always considers the flow damaged.  It was exacerbated by each of the two components having a damage handler for the same textFlow.
    The solution is to use the textFlow generation number.  In the damageHandler if the generation is the last known generation number, assume no changes, and return immediately from the damage handler.
    QE notes: There are 1 TextArea, 6 TextInput and 2 NumericStepper failuers, with or without my changes.  The common link seems to be DispatchKeyEvent.  Most were testing maxChar, displayAsPassword and restrict.  I tested these and they seem to be working correctly.
    Doc notes:
    Bugs: SDK-23002
    Reviewer: Gordon
    Tests run: checkintests, TextArea, TextInput and NumericStepper
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23002
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichEditableText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichText.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/RichEditable TextContainerManager.as

  • How to exclude accent characters in Text components

    How can I exclude accent characters in Text components. I
    just want the keystroke do nothing for accent characters.

    I assume you mean TextInput.
    Easiest way? You may want to do something like this, it
    restricts input to only the provided characters, so you'd have to
    add any others that you DO want:
    restrict="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    Harder way? Extend TextInput (but it only stops `):

  • GetCharBoundaries equivalent in spark text components

    Is there an easy way in the new text components to do what getCharBoundaries (in flex.TextField) does? (i.e. get the position of a particular character within a text field)
    So far, all I've come across is getAtomBounds in the TextLine class. But I'm not sure how to make use of this from the starting position of a TextArea or other spark component. Before I go delving into this further, is there an obvious way to do this that I've missed. And if not, can anyone give me a lead on how to make use of getAtomBounds from a RichText or other component.
    Any help greatly appreciated.

    dave,
    Good catch! Can you please file a bug at http://bugs.adobe.com/flex/ and include a simple test case (actually, I was able to repro with the test case below if you want to use that code)? (and then post the bug number here so I can subscribe and assign to the correct person).
    You can see from the code below that the flowComposer seems to be null by default, but if you edit the code you will get a flowComposer object back.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo">
        <s:layout>
            <s:VerticalLayout paddingLeft="20" paddingTop="20" />
        </s:layout>
        <fx:Script>
            <![CDATA[
                import mx.utils.ObjectUtil;
                private function init():void {
                    debug.text = ObjectUtil.toString(richEdTxt.textFlow.flowComposer);
                    btn.enabled = false;
            ]]>
        </fx:Script>
        <s:RichEditableText id="richEdTxt" change="btn.enabled = true;">
            <s:textFlow>
                <s:TextFlow>
                    <s:p>The quick brown <s:span fontWeight="bold">fox jumps over</s:span> the lazy dog</s:p>
                </s:TextFlow>
            </s:textFlow>
        </s:RichEditableText>
        <s:Button id="btn" label="get flowComposer" click="init();" />
        <s:TextArea id="debug" width="550" height="300" />
    </s:Application>
    Thanks,
    Peter

  • Limit the number of characters in Text Components

    I'm trying to limit the number of characters in text components. So I use the follow KeyListener:
    private class KeyHandler extends KeyAdapter{
    String oldText;
    private KeyHandler(){ }
    public void keyTyped(KeyEvent ev){
    String newText = textField.getText();
    System.out.println("Old text: " + this.oldText); //debug
    System.out.println("New text: " + newText); //debug
    if(newText.length() < limit){
    this.oldText = newText + ev.getKeyChar();
    }else{
    textField.setText(this.oldText);
    if(textField.getCaretPosition() + 1 > limit)
    textField.setCaretPosition(limit - 1);
    But the problem is that after that, the last key is typed in the component and the last key always appear.
    �Does anyone know the way for consume the key presses?
    Thank you

    (Belongs in the Swing forum.)
    The callback method keyTyped comes after keyPressed and keyReleased.
    The event.consume() should consume the event.
    Consider cut/copy/paste.
    Maybe a addPropertyChangeListener would be better?

  • [svn:fx-3.x] 11192: In AIR, you can drag' n drop text between text components like TextInput and TextArea.

    Revision: 11192
    Author:   [email protected]
    Date:     2009-10-27 12:54:37 -0700 (Tue, 27 Oct 2009)
    Log Message:
    In AIR, you can drag'n drop text between text components like TextInput and TextArea.  There's an AIR bug where doing so doesn't result in a TEXT_INPUT or a CHANGE event.  This is a workaround for that bug so that we listen for a nativeDragDrop event.
    QE notes: -
    Doc notes: -
    Bugs: SDK-19816
    Reviewer: Gordon
    Tests run: checkintests, mustella TextInput, TextArea
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-19816
    Modified Paths:
        flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/controls/TextArea.as
        flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/controls/TextInput.as

    First 3 .as are the component
    source. in the last test.mxml file i have written the drag and drop functionality.
    can any help me?? please

  • Load HTML into TextField or Text Components!

    Hi all!
    I'm trying to load 4 HTML documents into 4 different TextArea
    components (infoTxt1, infoTxt2, infoTx....). In the attached code I
    use/load the same HTML document to populate the components just to
    simplify the testing.
    This loop will not work. Can anyone tell me why or if there
    is a better way to load several HTML into components dynamically?
    It works IF it only loop once.
    Thanks

    YEAH!
    TRULY AMAZING, KGLAD :)
    Sorry for shouting out, but I just love to get this kind of
    help. I would never have figured this one out by my self and the
    good thing is I actually understand what's going on in your code
    and can use that in other cases.
    You came through as you you always do, and a million thanks
    for taking the time.
    Have a wonderful day :)
    Answer:
    To load several "html" documents into several textarea
    components on stage you can use kglads code:
    var dataNum:Number;
    loadDataF(1);
    function loadDataF(n:Number) {
    dataNum = n;
    this["tabData"+n] = new LoadVars();
    this["tabData"+n].onData = function(theText:String):Void {
    if (theText != undefined) {
    _root["infoTxt"+dataNum].text = theText;
    trace(_root["infoTxt"+dataNum]);
    if(dataNum<4){
    dataNum++
    loadDataF(dataNum);
    this["tabData"+n].load("artist"+n+".html");

  • Character reordering problem in swing text components  on macintosh

    I have created a swing application that handles devanagari script.(script for Hindi language).The application works perfectly in windows but in apple macintosh
    there is a problem with the reordering of characters in text componets. Reordering means some characters needs to be displayed not in the exact order in which they are stored.I was wondering how this can happen as the application works fine on windows.Also other applications like text editor displays devanagari script correctly on macintosh.
    I tried with several fonts like Arial Unicode MS,Devanagari MT etc/.java

    Very odd. Post your Reordering code.

  • Difference in font rendering of JList and other text components

    Hi,
    I have a swing application using JTextField,JTextArea and JList.When I use a font
    for an Indian Language for these components,the JList shows the data correctly
    but the other components shows it with junk characters.Is there a difference in the font rendering behaviour of JList from others?

    Use getFont() on each to the comonents to make sure they are using the same font.

  • Disable Paste in Text Components

    I have search everywhere I can think of for an answer to
    this. I would like to find a way to disable pasting text into a
    text component (e.g. TextInput). Could someone assist or point me
    to a site that has information on how to disable pasting (i.e. copy
    / paste) either by right-click pasting, control-v, etc.?
    Thanks.

    You could add an event listener for a TextEvent, which will
    ONLY contain a field with the text being "added". If it's being
    typed, it'll have to be length==1. If it's being pasted it'll
    probably be > 1, so perhaps you could negate the change using an
    event handler like this. Of course, this would also disable a paste
    of a single character, but people don't usually paste one character
    anyway.
    If you're able to provide this, knowing why you need to
    disable paste might help us suggest alternative solutions or
    workarounds.

  • Page data and Text components

    Hello,
    I have a couple of question. I have a large text file that I need open and scroll through. In other words is like opening a document with 200,000 lines of text or so. I need to highlight some of this text and do some other things. I was wondering:
    1. What would be the best TextComponent to do that.
    2. Since the file is rather long, how do I open the file in a way that I only have in memory a part of it and, when I scroll up or down, the file is displayed accordingly.
    any examples, code, articles, etc. would be great.
    Thanks!

    So, any ideas on this?

Maybe you are looking for

  • Finder smart folder:  "Search for:Today" has changed

    I noticed today that the smart folder has changed and now only seems to be showing applications and not files also. I'm not sure what changed it initially, but to try to "fix" it, I went to the finder toolbar and selected "Action>Show Search Criteria

  • Aperture 3.0.2  available...

    Apple just released Aperture 3.0.2. See [this article|http://support.apple.com/kb/TS2518] for detailed information. Get it from Software Updates or [direct download here|http://support.apple.com/kb/DL1006]. There is also [iMovie 8.0.6|http://support.

  • Check spelling and find and replace

    This question was posted in response to the following article: http://help.adobe.com/en_US/robohelp/robohtml/WSE06DA00F-6FE0-4822-9636-315A6136E522.html

  • OMBPLUS - Setting properties of objects in Collection.

    Hi All, I am trying to set the Deployable property of objects in a collection in order to automate our deployment process. Basically, we use collections for our releases, and I want to set the property as above before running our deployment script wh

  • Pages on the iPhone

    Hi All. Would someone mind giving me a heads up on my options for editing Pages documents on an iPhone? I am using Things for notes but I have longer documents saved in .pages format on my MobileMe account and would like to be able to edit these whil