Text Editor (trying to write my own)

I am trying to write a simple text editor with a 'Find' option.
Is JEditorPane the right class to use?
How would I search for a certain string and then scroll to make it appear at the top of the window?
Thanks,
Elena

Hi Elena,
JEditorPane is 'just' showing contents which are actually coming from a Document. So class Document and its descendants would be the one to be searched.
Keeping performance and optimization out of sight, using class ElementIterator to iterate through all Elements of a Document could be a way to start with. Each Element can represent content, which then would have to be tested on the text to be found.
Once an occurence of the searched text portion is found, the Element having the respective content has properties (getStartOffset and getEndOffset) to find out the position within the Document to scroll to.
Pls see the API docs for the mentioned classes too.
Hope this helps.
Ulrich

Similar Messages

  • JTREE: Writting my own DefaultTreeCellRenderer, please help

    Hi All,
    I'm trying to write my own Class extending DefaultTreeCellRenderer to get different icons on my JTREE.
    But I'm loosing background "Zebra grid" and I'm loosing mouse over highliting nodes.
    What I'm doing wrong?
    my class it is this:
    public class RendererTree extends DefaultTreeCellRenderer
        public RendererTree()
            super();
        public Component getTreeCellRendererComponent(final JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
            super.getTreeCellRendererComponent(tree,value,selected,expanded,leaf,row,hasFocus);
            if(value.toString().compareToIgnoreCase("Gestión") == 0)
                setIcon(new ImageIcon(this.getClass().getResource("/images/24x24/office-building.png")));
            else if(value.toString().compareToIgnoreCase("Gestionar") == 0)
                setIcon(new ImageIcon(this.getClass().getResource("/images/16x16/form_blue.png")));
            return this;
    }I'm setting up my render:
    jTree1.setCellRenderer(new RendererTree());Any ideas would be appreciated
    Thanks in advance!
    Edited by: henrynxd_08 on Sep 20, 2010 10:06 AM

    [http://img812.imageshack.us/img812/4056/jtree.jpg] Here my two features lost. One the highlith animation when mouse is over nodes and the other alternate darkness and ligthness coloured at background (ZEBRA).
    It is this impossible to get with my own treecellrendered ?
    thanks in advance
    Edited by: henrynxd_08 on Sep 21, 2010 10:36 AM

  • Regarding using text editor in 11g for writting query

    how can i use text editor in oracle 11g for writting query as in oracle 9i in which we use 'ed' command.

    user13063489 wrote:
    how can i use text editor in oracle 11g for writting query as in oracle 9i in which we use 'ed' command.This is really for asking in the database forum.
    However I assume you are using sqlplus
    If this is the case define the _EDITOR variable to one of the following as appropriate ....
    DEFINE _EDITOR=notepad
    DEFINE _EDITOR=vi
    For more assistance use the database general forum.

  • I'm Trying To Make A Text Editor

    In Interface Builder, How Do I Get It To Be Able To Save To An External File?
    iMac G5 (Hero)   Mac OS X (10.4.5)  

    Hi,
    you will need more than just Interface Builder to be able to save your documents text. There are numerous examples out there in the web, for example Apples own "Text Editor in 15 Minutes":
    http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Tasks /TextEditor.html
    Volker

  • Line breaks in text editor

    Hi,
    I am facing the problem that when I read the content of the
    texteditor, store it in a javascript variable, and then write it
    again into the editor area, all line breaks (not html line breaks,
    just the line breaks for the code structure) are gone.
    For Example if the content of the Editor is the following:
    Test line 1
    Test line 5
    If I know call my function the value of the texteditor will
    be somethign like: "Test line1 Test line 5"
    I tried finding the linebreaks and replacing them (either \n,
    \r or \n\r) but had no success in doing that.
    My code of the function:
    var theDom=dw.getDocumentDOM();
    var temp = theDom.documentElement.outerHTML;
    theDom.documentElement.outerHTML="";
    theDom.documentElement.outerHTML=temp;
    So I assume Javascript and dw are using different formats,
    but I cant find much information about whats being used.
    Any help appreicated!
    Best,
    David

    Hi Brent,
    Use CHR(10) in text editor for a new line. for example(  'SAP' & CHR(10) & 'Visual' & CHR(10) & 'Composer') will display like,
    SAP
    Visual
    Composer
    Hope it helps....
    Regards
    Basheer

  • Using a different Rich Text Editor ?

    Hi,
    I'd like to know if you're using a different Rich Text Editor other than the one provided by Oracle ?
    Are you satisfied with it ? Especially in the management of images ?
    Thanks
    Max.

    there is a textflow component
    http://blog.flexexamples.com/2009/07/25/exporting-a-textflow-object-in-flex-4/
    still exports to font tags unfortunately, but its closer than the richtexteditor. Its basically at the point where you could even write your own small parser and adapt the output to the format you desire.

  • Newbie help with sample Studio app. "Plain Text Editor"

    I'm trying to make the jump from AppleScript to AppleScript Studio, and because I want to eventually write a document producing application I thought I'd start with the textbook example "Plain Text Editor" included with Xcode. I think I see how menu items are connected to "Target/Actions," and I was able to build and run it without difficulty. It's remarkable how little AppleScript had to be written to produce a rudamentary text editor. But in playing with the built application, I noticed that the Revert menu item does not work exactly as expected.
    If you create a text document, and then make some change to it, and then click the Revert menu item, you get the expected little dialog asking if you want to revert to the most recently saved version, but if you then click the Revert button, the text displayed in the text view object does not revert to the original. However, something is happening, because whatever code is behind the Save, Close, and Quit menu items does seem to be "aware" that the Revert item has been invoked: because if you click one of these after Revert, the "do you want to save changes?" warning doesn't appear, just as one might expect.
    The Revert menu item seems to be connected to a "Target/Action" called "revertDocumentToSaved:" which sounds perfectly reasonable. But does the fact that Revert doesn't cause the displayed editing text to revert mean that (a) there is a bug in the code behind this Target/Action, or (b) that the writer of this textbook example just didn't bother to do everything needed for the Revert item to work in an intuitive manner?
    Whichever the answer, what would I do to make it work properely?
    It seems like there must be some sort of connection between the text view object in the editing window, and the Close, Save, Quit suite of menu items, because the behavior of these is dependant on whether or not there are unsaved changes in the text view object. But looking through the Inspector for this object, I don't see any, neither AppleScripts, nor Outlets, nor Target/Actions. Where and for what should I be looking?
    Dual 1.2 GHz   Mac OS X (10.4.8)  
    Dual 1.2 GHz   Mac OS X (10.4.8)  

    I think -- and I'm sure someone will correct me if I'm wrong -- that this is a place where AppleScript Studio's implementation just isn't done right. Either they intended to add a "revert" handler somewhere and forgot, or else they meant to have it send an existing message and didn't.
    I haven't done any document-based applications -- heck, I've only dabbled slightly in AppleScript Studio -- so there may be a "deeper" answer to this, but you might consider just hooking the menu item up to send its "choose menu item" handler to your document script, and have it react accordingly.

  • Using rich text editor (RTE) for custom applications

    Our users enter texts on two places:
    1) In Oracle Portal in text-items using the Rich Text Editor.
    2) In text-fields in a custom application using html-tags <textarea>blabla</textarea>. For formatting the users currently have to type in html-tags themselves. Now we want to provide them an html-editor.
    We would prefer to use the Rich Text Editor also for the custom application. However, that is integrated in Portal and the java-scripts are not easy to follow.
    Have you tried something similar? So, did you use the Rich Text Editor for your own application? If yes, how?
    If not, a very good alternative would be the qwebeditor (see http://www.qwebeditor.com). Did anybody replace the standard Portal rich text editor with the qwebeditor? In the Portal guides there are instructions about replacing the Portal rich text editor by another editor, but it is not clear if this will also work with the qwebeditor.
    Thanks for your respons !
    Best regards, Jan Willem Vermeer

    Hi Jan,
    I have configured FCKeditor in a few clients, and the process it's pretty straight forward, you can use the steps in the document (http://www.oracle.com/technology/products/ias/portal/pdf/cm_rte_1014_features.pdf) .
    Basically you download FCKeditor and put it in your apache server (you can put it unde rthe htdocs folder) after that, all you need to do is modify $ORACLE_HOME/portal/images/webword/buildUIHTML.html to reference the FCKeditor JS and CSS, and you can do the same type of reference for your custom apps.
    Regards,
    Juan

  • IW22 notification - to save the text from text editor to database

    Hi,
    In Iw21/22/23 notification screens are configured to custom screens.. and these screens are having text editors.... when i write some text in editor and try to save the notification.. the text should get saved so that i can see it nxt when i display the notification....
    Please suggest any ideas...
    I thought of saving in table in PAI... but it doesnt come to the event.....  and if i try to use an enhancement while saving.... that enhancement should consider the data with respect to tabs... and save differently
    please suggest..
    Edited by: Poonam 24 on Oct 9, 2011 7:55 AM

    First you need to retrieve the contents from the text editor (jn PBO) e.g.
    * Retrieve text currently inside the textedit control
      data:
        lt_text             type tdline occurs 10.
          call method go_d9999_textedit->get_text_as_r3table
            importing
              table                  = lt_text
            exceptions
              error_dp               = 1
              error_cntl_call_method = 2
              error_dp_create        = 3
              potential_data_loss    = 4
              others                 = 5.
    and then persist the "lt_text" contents, e.g. you could use functions from the STXD group (e.g. SAVE_TEXT) or your own table that would need to have something like
    MANDT    "key - client
    LINK_KEY "key - whatever you are are linking this text to
    SEQ      "key - one row of text
    TEXTLINE
    (the first three columns would be the primary key per row of text).
    Jonathan

  • A shared Text editor - question about JEditorPane

    Hi there,
    I'm trying to make a shared Text Editor. So far I have the ability to pass messages across from one client to another. I have all the GUI elements in the "main" Class, and the Connection elements in separate Classes; in particular the receivedPacket method which listens for specific packets. Now I'm able to print in my Terminal window the received packets (via a simple System.out.println call). Is it possible to grab the packet information from the "main" Class and then append that information to the JEditorPane (which has been constructed in the main Class)? Or would it be better to create the JEditorPane in the Class with the receivedPacket and then add the information straight away to the editor window?
    Thanks
    :)

    Thanks for the guidance, I think you're right. Nice to hear you've done something similar.
    What I have up and running is:
    1) GUI elements created in the main class (Class Exchange)
    2) A Connection class that handles the connection to the server and adds packet listeners to the incoming packets (Class Connection)
    3) A class that filters and stores the packets (Class Comms)
    Now I'm using a protocol called Jabber (instant messaging protocol) so I'm using the JabberBeans library for all Jabber stuff (i.e. Connection and packet listeners etc..). Now the receivedPackets method within the Comms Class then extracts the <body> of what I want to another method within the Comms Class which then returns that String value. This works as it prints to the Terminal window when run and packets are received.
    What I'm having difficulty in understanding (although I think its straightforward) is why I can't take that returned value and have it update in my JEditorPane window (which is in the main Class (Exchange)), it doesnt like it for some reason and complains about something from the JabberBeans library.
    I'm unsure about how to update the JEditorPane; would it be to write a method in the main class that calls in the returned <body> String value (which is what I thought would be right)? Or is there something else I've missed. In the JabberBeans API the returned value is of type String, I'm guessing that maybe I need to move that into a StringBuffer for the sake of the JEditorPane.. Or is that just guessing?
    Thanks for the help, hope you get a moment..
    AB
    :)

  • Rookie trying to make my own package

    Reading in a real good book - "Thinking in Java" by Bruce Eckel. Really helping me to understand better a lot of the stuff that I had in my Java course at school.
    Got to a section where he's showing how to make your own packages. I'll lift directly:
    Consider, for
    example, creating an alias for System.out.println(�) to reduce
    typing. This can be part of a package called tools:
    //P.java
    // The P.rint & P.rintln shorthand.
    package com.bruceeckel.tools;
    public class P {
    public static void rint(String s) {
    System.out.print(s);
    public static void rintln(String s) {
    System.out.println(s);
    You can use this shorthand to print a
    String either with a newline (P.rintln(�)) or without a
    newline (P.rint(�)).
    So, I cut and pasted right into the text editor I use to practice with, saved and compiled it in a subdirectory off of one of the directories in the CLASSPATH, followed with a little test program:
    //ToolTest.java
    import com.bruceeckel.tools.*;
    public class ToolTest {
    public static void main(String[] args) {
    P.rintln("Available from now on!");
    P.rintln("" + 100); // Force it to be a String
    P.rintln("" + 100L);
    P.rintln("" + 3.14159);
    Here's the result of the compile:
    C:\Thinking in Java\com\bruceeckel\tools>javac ToolTest.java
    ToolTest.java:3: Package com.bruceeckel.tools not found in import.
    import com.bruceeckel.tools.*;
    ^
    1 error
    C:\Thinking in Java\com\bruceeckel\tools>
    At first I tried doing it on my own, making up my own package name, creating my own little source files, but got the same error. So I cut and pasted directly from the book, thinking surely it would work if I used Eckel's own code. Nope.
    Any clue what's going wrong? I've checked the CLASSPATH carefully, it includes
    C:\Thinki~1
    Thanks
    Felecha

    Your classpath should include "C:\Thinking in Java", not C:\Thinki~1.
    Also, your ToolTest.java should be in some other folder than "C:\Thinking in Java\com\bruceeckel\tools" - javac may act weird when it can find the to-be-imported classes in both the current folder and the classpath.
    If ToolTest.java had been in the folder "C:\Thinking in Java" you wouldn't have needed to modify the classpath.

  • Lightweight text editor?

    I need to provide a basic text editor in my swing commercial app.
    Rather than reinventing the wheel are there any freely available fine tuned lightweight editors available in a jar that I can use for this purpose?
    There is http://syntax.jedit.org/ which uses the MIT/X11 licence but though it is extremely lightweight the code has not been updated in 7 years and is not wrapped in a package...also the functionality is supports is still way overkill for my needs (for example it supports syntax highlighting for 10+ code file types). I guess what i was hoping for was a well used java class that encapsulated a simple text editor.....
    Thanks,
    Tom.
    Edited by: tyk on Nov 26, 2007 7:31 AM

    True. I found myself having to add cut/copy/paste which is not such a big deal and just wondered if there was any simple class out there that people reuse...but i guess everyone just writes their own :-(

  • Any description on how to use the Text Editor used for this Forum?

    I am very frustrated when trying to use the text Editing functions (without use of HTML, that I do not undertstand) that can be used to create Posts in this Forum .
    Can somebody point me to a good description of the Text Editor used to enter/edit Posts in this Forum? Thanks a lot in advance.

    Ian,
    Thank You very much for your answer.
    Based on your answer, I guess and fear, that there exist no "user guide" for this Text Editor.
    I will wait a little bit more to see whether I get more information/answers. If not, i will probably write a "Feature Request" to request that Adobe provides us or point us to a reasonable User-Guide for this Text Editor.

  • Displaying text editor

    Hello Experts,
    I have a pushbutton on a screen and clicking on that would display a text editor along with long text of that pushbutton.I dont know how to create container etc, so I am not able to make out how to solve this problem.Can anyone please help?

    hi priya,
    if your reqiurement says that i need to display text editor and save it to the internal table  then use
    the following code.
    TYPES: BEGIN OF ty_text,
             text(74)  ,
            END OF ty_text.
    DATA:
          t_terms  TYPE STANDARD TABLE OF ty_text with header line.
    EDITOR-CALL FOR t_terms.
    loop at t_terms.
    write t_terms-text.
    endloop.
    enter a valid text
    and press save .
    the data will be reflected back in your table.
    check for EDITOR-CALL syntax for other opeartions like display and giving your own title.

  • Formatting text with a text editor within a website?

    My wife wants to use her new iPad 2 to participate in an online community (Ravelry, a knitting and crocheting site).  She does a great deal of posting to forums within this community.  The text editor for posting in these forums allows users to format their text (bolding, italicize, etc.) as well as to link to other external and internal pages within the site (writers in the forum frequently link to patterns and project images within the site as references in their posts).  When she attempts to use the text editor in Ravelry from her iPad, she is unable to select the text she wants to highlight and alter it (by bolding or making it a link).  When we select the text, the only options are to copy or cut and we can't, once we've selected the text, tap on the "create a link" button  in the text editor.  We've tried to use both Safari and Atomic Web browsers, but no luck.   Help?

    ravelry.com is using WMD-Editor which is a WYWIWYM Markdown editor. Unfortunately it appears their chosen WYWIWYM Markdown editor is no longer or is pretty deprecated.
    You as a user are not going to be able to swap out your own editor for use on any website...these editors are hard coded by the website developer...perhaps you could, as already suggested ask them to update to a more robust editor which supports today's standards. Though I doubt you will get far in having them swap out code for this.
    A Solution:
    Download an alternate browser such as iCabMobile for iOS...I tested ravelry against this browser and the editor does work but is pretty unstable. Funtional but not as intended. Safari cannot load this editor properly at all.
    Log into your ravalry account and read their FAQ (http://www.ravelry.com/wiki/pages/UsingTheTextEditor#formatting_bolditalic_lists _and_other_basics)
    Simple BBCODE commands for formatting where you do not need to even use the tool bar work fine...just a hassle to memorize.
    Hope this helps.

Maybe you are looking for

  • Creating the New Update groups in case of the Credit Management

    Hi Can any one help out in the following requirement:   Is it possible to Create a new update group in case of the Credit Management?SAP standard provides only three update groups viz., 000012, 000015 and 000018. We would like to have a customized gr

  • Financial managment error through workspace 11.1.1.2

    Hi All, I have successfully migrated the application from 9.x ver to 11.1.1.2 ver. When I am trying to load objects like documents, links, journals, reports, grids...etc, it was throwing errors as per below. Error Number: 70 Error Description: Permis

  • Delete Account under iCloud

    Under iOS6 > System Preferences > iCloud there is a delete account button. Will this delete my whole iCloud account or just the setup of icloud and it's content on this device?

  • How to login with SAPCPIC userid

    Dear Sir/Madam, I have changed the Password for SAPCPIC in Development Server for 000,001 and 100 client. But when I tried to login in the Respective client with SAPCPIC userid, one message is comming "Login through Communication User " It is correct

  • Rotating videos in Quicktime Prop & uploading to youtube

    I recorded a video on my digital camera, and rotated it from horizontal to vertical with Quicktime Pro. However, on uploading it to youtube the video has rotated back to its original state, which means you have to tilt your head to watch it. Is there