How to replace string with image( Say Smiley).........????

Hello To All Experts !!
I wanna looking for some help in displaying image in my text area when should i type ":)" in text field.....
I got some program through forums....
import java.util.*;
import javax.swing.ImageIcon;
public class TokenizeSmiley {
    private static final HashMap SMILEYS;
    static {
        SMILEYS = new HashMap();
        SMILEYS.put(":)", new ImageIcon("images/1.gif"));
        SMILEYS.put(";)", "<wink>");
    public static void main(String[] args) {
        String text = "Hello!! :) How are you ;)";
        StringTokenizer st = new StringTokenizer(text);
        String token;
        while (st.hasMoreTokens()) {
            token = st.nextToken();
            if (SMILEYS.containsKey(token))
                token = (String)SMILEYS.get(token);
            System.out.print(token + " ");
}but it is showing <smile> and <wink> as it is given...i tried to give path of image ...but it is nt fetching then also.....
Plz help in this....
Message was edited by:
Damz@del

So your data is stored in XML. So what? You haven't asked a question about the XML or how to format it or how to access it. You asked a question that had nothing to do with XML at all. It's as if you said "My data is stored on a Windows computer so I will call Microsoft's support line to ask them this question."
And I can't even suggest a suitable forum because a "text area" could be an AWT component or an HTML component. But I do suggest you ask in the right place.

Similar Messages

  • How to replace string with image( Say Emoticons )??

    Hello Friends !!
    I am working on chat messenger and want some help in "How to access Emoticons when somebody typed :), ;), :)) and many more strings.....?"
    Is there any sample code to do that job or any function to perform such task??
    Thanks in Advance....

    use event listener... found match, load image instead of text on the fly.

  • Use Powershell to replace text with image in Word document

    I have a powershell script that uses a Word document as a template to create signatures that I am pushing out to my organization.
    The document is populated with text formatted the way I want the signature to look, that I then do a FindText and ReplaceText on.  This works fine for replacing text with text, but I can't figure out how to properly replace some of the holder text with
    an image and a link.  I found a few posts about adding images to word documents, but none that seem to work properly in this scenario.
    Any insight would be greatly appreciated, thanks!

    Dear BOFH,
    You are correct that method I outlined is not for inserting an image into a signature block (which would be in Outlook, not Word).  The links you post do certainly deal with outlook signatures, well done... Except that the question was about how to
    use a Powershell script to replace text in a Word document with an image.  Sure it was framed in the context of creating signatures, but the poster expressed that they already had a method of generating and replacing text, and just needed to know, as
    I did, how to do the thing they actually asked.
    Please BOFH... Please forgive my audacity in hoping to find a reference (any reference) to how to replace Word text with images via Powershell in a thread titled "Use Powershell to replace text with image in Word document".
    This is certainly a scripting question, and even something as simple as "You will need to call the .NET methods for the Word find/replace functionality.  Please ask in the Word forums for the correct method to use. 
    If you need help on calling .NET methods look HTTP ://here"support you offered combined with the contempt you offer in response to my actual substantive help to the actual question asked.
    BOFH, you are not better than us, just more arrogant.
    Can you please start your own question as this one has been closed.  Please see scripting guidelines.
    We cannot guarantee you satisfaction as this is a user supported forum.  The is no SLA for community support.  Perhaps if you posted a better worded question as a new topic someone might be able to help you resolve your issue.
    The topic you are posting on is closed and answered.
    ¯\_(ツ)_/¯

  • Replacing footage with image sequence

    Hi,
       I was wondering if anyone knew how to replace footage with an image sequence. It seems like when I choose replace footage and navigate to my image sequence there is nothing I am able to check off for image sequence. So basically if I have an image sequence in my timeline, I can only replace it with a movie which defeats the purpose of using an image sequence. Thanks in advance!

    You need to have a single directory filled with one or more supported still images which are named with a number a the end for the 'Image Sequence' checkbox to be un-grayed out in the 'Import', 'Replace Footage' or 'Locate Files' dialog. From the screenshot above, it looks like you've met all those criteria and that the checkbox is not even there, as opposed to being present but dim. On windows 8 (which it looks like you're on) that checkbox would be in between the 'File Name' label and the bottom of the file list area. The fact that you're not there makes me think your on an older version before we had all the relevant features. I'd have to check to remember just when that would have been, but I know that as of CS6 the 'Image Sequence' dialog was definitely there for the Locate Files and Import dialogs, so it's reasonable that it was an option in the replace footage dialog too. It may be something system specific which is not allowing all the UI to draw in correctly when using OS dialogs. In that case, Kevin's suggestion might still be viable since the Link & Locate workflow uses its own Premiere UI instead of OS dialogs.

  • How to use recursion with images

    Ok, for this program I'm trying to recursively repeat an image 3 times with varying widths and heights, and I don't know how to do that with images. With rectangles and other shape objects it's easy because all I had to do was override the draw method, but with images I'm not sure what to override to allow me to repeat the drawing of it with a different height and width. Any help would be greatly appreciated.

    Would I be able to work that in with recursion? Currently I have a JPanel with the paintComponent method being overridden, and I've tried setting up the paintComponent method to call itself to repaint the image, but I've realized everytime I resize the application's window paintComponent gets called again making the images go out of site. Is there a way to override the drawImage method to allow me to change the width and height of the image without causing the panel to repaint itself?

  • How to replace MobileMe with ICloud on my Imac?

    how to replace MobileMe with ICloud on my Imac? pleae help.  Other devices (Ipad and Iphone) are Iclouded but I can't change MobileMe in my system preferences on IMac (10.6.8)
    Sylwia

    You need to upgrade the computer's OS. Open the Mac App Store and try downloading Mavericks. If you get told it's incompatible, choose About this Mac from the Apple menu, check if the computer has at least a Xeon or Core 2 Duo(not Core Duo) CPU and 2GB of RAM, and if it does, click here and order a download code for Lion 10.7.
    Back up your data before upgrading. Mac OS X 10.7 and newer don't support PowerPC programs such as versions of Microsoft Office prior to 2008.
    (103507)

  • Replace words with images, in a table, using the search/replace tool

    Hello everybody
    I have a question:
    Is it possible to replace words with images, in a table, using the search/replace tool?
    My case:
    I have a table with about 9000 articles on about 400 pages. In this table there are words which I like to replace with Logos.
    Example: The word "DM" should be the Logo "DM" (.eps). This word is about 1200 times in this table.
    Is it possible to replace it automatically?
    Thank you very much for your helb.
    Kind regards Alex

    Hello Mr. Werner
    Thank you for your reply.
    Can I ask you which Version of InDesign do you use?
    I use CS 5.5 and there I can't find the change field "other" you told me.
    Can you see it on the screenshot? (Sorry it is german...)
    Thank you very much for your support.
    Kind regards Alex

  • How to display string with XML content in 4.6?

    Hi,
    I`d like to know how to display string with XML content in it for 4.6.
    4.6 has not method parse_string.
    And example like this is not helpful:
      DATA: lo_mxml    TYPE REF TO cl_xml_document.
      CREATE OBJECT lo_mxml.
      CALL METHOD lo_mxml->parse_string
        EXPORTING
          stream = gv_xml_string.
      CALL METHOD lo_mxml->display.
    Thank you.

    Hi,
    May be you can use fm SAP_CONVERT_TO_XML_FORMAT. But it have some issues with memory usage, the program consumed tons of memory during convert.

  • How to concatenate string with a numeric control ?

    Hi,
    How to concatenate string with a numeric control ?
    Thankyou.
    Solved!
    Go to Solution.

    Its simpler to just use the Format Into String.
    Attachments:
    Format Into String.png ‏11 KB

  • How to write strings with an underline on the TOP-OF-PAGE of ALV

    How to write strings with an underline on the TOP-OF-PAGE of ALV

    if u r using classes and methods it can be done
    but if u r using normal fms and then u have to use HTML_TOP_OF_PAGE but the drawback for this it cannot be printed when the report is printed .

  • Replace text with image using Applescript in InDesign CS5

    Hi to everyone, i'm looking for some suggestions to resolve my problem.
    I've to replace some strings with jpeg images stored on my pc
    Here is the code to replace two strings with the new ones.
    tell application "Adobe InDesign CS5"
              set myDocument to active document
              set myPage to page 1 of myDocument
              set stringsToReplace to {"111", "222"}
      repeat with iterator from 1 to (count stringsToReplace)
           set find text preferences to nothing
           set change text preferences to nothing
           set myFoundItems to nothing
           set element to item iterator of stringsToReplace
          if element is "111" then
               set find what of find text preferences to "111"
               set change to of change text preferences to "ONE"
               set myFoundItems to change text
               display dialog ("Found : " & (count myFoundItems) & " occurences of " & element)
          else if element is "222" then
               set find what of find text preferences to "222"
               set change to of change text preferences to "TWO"
               set myFoundItems to change text
               display dialog ("Found : " & (count myFoundItems) & " occurences of " & element)
          end if
              end repeat
      set find text preferences to nothing
      set change text preferences to nothing
    end tell
    Can you hel me?
    Thanks in advance.

    Hello, I have a couple of questions for you… How come you have strings in text frames… Would you not be better off using labels for this…? ( thats how I would do this ). Off the top of my head I think you will need to remove any text content from the frame to be able to change it's content type… only then will you be able to place a graphic… How are you associating your strings with the required image files… Do you have this in some extenal file Excel or FMP.

  • How to Search strings with and without quotes

    Hello,
    I need to search a string with quote and without quote the same way
    Ex: Wendy's
    If user enters wendys without ' also need to return all the Wendy's..!
    I appreciate any help...!
    Thanks
    RG

    Hi,
    RG wrote:
    Hello,
    I need to search a string with quote and without quote the same way
    Ex: Wendy's
    If user enters wendys without ' also need to return all the Wendy's..!
    I appreciate any help...!So you want to ignore single-quotes, is that it?
    Here's one way:
    INSTR ( REPLACE (big_string,       '''')
          , REPLACE (substring_sought, '''')
          )  > 0 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • How to put String with html tags as it is into xml

    I am using apache dom API to create xml from java.
    I have a string with html tags in it .when I add the string to xml, its replacing all the "<"; with &lt and ">" with > I would like the html tags to look as it is instead of the > and & lt;. How can I acheive that
    this is the code snippet of what I am doing
    In java class
    String titleString = "<font color=red>This Is an Example of a Red Subject</font>"
    Document doc = new DocumentImpl();
    Element root = doc.createElement("bulletin");
    Element item = doc.createElement("title");
    item.appendChild(doc.createTextNode(titleString));
    In Xml it looks like below
    <title><font color=red>This Is an Example of a Red Subject</font></title>
    but I would like to have the xml like below
    <title><font color="red">This Is an Example of a Red Subject</font></title>
    Can you please suggest me whats the best way to acheive this.
    I appreciate all your help
    Thank you
    Suma

    One problem is that you don't understand escaping. If you re-read what you posted you'll see that what you say you get, and what you say you want, are identical. That's because you didn't escape one of the two properly. So your first step should be to find the section about escaping in Chapter 1 of your XML book and read it carefully. Figure out what you should have done here (yes, the same rules apply).
    However, to attempt to answer what I think your question is: if you have a String which contains markup, and you want to convert that String to XML elements, then you have to feed the String into an XML parser.

  • Replace text with images

    Hi,
    I'm using a script found here, to replace @equ001.pdf@ with the corresponding image, same for eq002 etc.
    This script works more or less ok for me.
    Sometimes, it removes some image names without replacing the image, sometimes it was leaving some "@" here and there.
    Sometimes, it's giving me an error on the "place image" code, saying it cannot find the image, giving it's path ending with the grep expression $2 and doesn't work at all.
    Sometimes it does part of the job, stops, gives the same error as above, and continues to work when I click ok.
    Today, it didn't worked on a document. I copied the text to work on into a new InDesign document an there, it worked (but in two times).
    Is there any other way of doing this ?
    if(app.documents.length != 0){
        var myFolder = Folder.selectDialog ('Choose a folder with images');
        if(myFolder != null){
            // reset the Find/Change dialog
            app.findGrepPreferences = app.changeGrepPreferences = null;
            // formulate a grep search string
            app.findGrepPreferences.findWhat = '@.+?@';
            // find all occurrence, last one first
            f = app.activeDocument.findGrep (true);
            for (i = 0; i < f.length; i++){
                // construct file name
                name = f[i].contents.replace (/@/g, '');
                // place the image
                var placedObjects = f[i].insertionPoints[0].place (File (myFolder.fsName + '/' + name));
        // delete all @??@ codes
        app.activeDocument.changeGrep();
    else{
       alert('Please open a document and try again.');

    You should process the found instances back to front:
    for (i = f.length-1; i >= 0; i--)
    Peter

  • Search .docx and replace text with image

    I've got a directory containing a series of images. The images will always be the same name and I need to insert them into placeholders in a Word document which will be a template. I thought of using the image names as placeholders, opening the document
    and searching for the image name, replacing it by inserting the image, and doing so for each image in the directory.
    $file is the name of the image in the directory and it loops through them okay.
    foreach($file in Get-ChildItem $savepath -Filter *.jpg)
            # search word doc and replace selected text with image ($file)    
    Also inserting the image seems simple enough from a TechNet article I found, but I've got no idea how to open the Word document and do a search and replace. I found a few articles related to the subject but I couldn't get them to work when I tried to adapt
    them.
    Any help is appreciated. Thanks in advance.

    This 'might' be possible, but I'm having a hard time finding good references to the com object capabilities for inserting an image into a word document.  Creating new, converting format, that sort of thing is straightforward.
    I'd do a search on "powershell word comobject" and variations of insert image update edit, etc.  Or maybe someone else with more experience/knowledge has a magic bullet for you.  Once you get some info on doing it with powershell, expand
    your search by omitting the powershell keyword, there's gotta be some solid documentation for the comobject somwhere, but it will probably be a bit complex.
    You can also:
    $word = new-object -comobject word.application
    $doc = $word.documents.add("<path to word document>"
    and get-member to your heart's content, but finding references and/or documentation might be easier.  
    Good luck!
    Edit:  This could help, but really doesn't give much insight into placement of the image, only helps getting the image into the doc:  http://gallery.technet.microsoft.com/office/44ffc6c8-131f-42f1-b24b-ff92230b2e0a
    If you do find something useful, post it here, I'm sure others could benefit!
    SubEdit:  Should have thought of this already...
    http://msdn.microsoft.com/en-us/library/ff837519(v=office.14).aspx

Maybe you are looking for

  • Top 10 Obstacles to Sql Developer Becoming a World-class Tool

    I've been working with Sql Developer day and night for the last 6 months. On a positive note, the SqlDeveloper team has been the most responsive Oracle product team I've worked with in the 19 years I've been working with Oracle tools. They pay attent

  • Motion 5 crashes on quit?

    Motion 5 has seemed quite solid and a pleasure to go deeper into. But every single time i am done, happy and i quit - Motion gnerates a crash report. It does not seem to matter the simplicity or the complexity...it will run all but as soon as I am do

  • Formatting external hard drive for MAC and Windows

    I have an external hard drive that I would like to make compatible with BOTH Mac and Windows. I don't want to split it but is there any way that I can make it compatible to where I can use it back and forth between both? I have classes and use Photos

  • Email not connecting

    I have been away travelling for a few days and three days ago, my iPad (iOS 8.2) failed to connect to my two email providers. Now I am home, and although the device indicates 'connected' (and I can get my emails on my home PC using the same ISP), I c

  • How to listen to Pandora or Sirius Apps on pioneer AVH-P3200BT

    Just bought a Pioneer AV unit. Its AVH-P3200BT and it has the usb and aux in the front. I cant seem to listen to my apps unless it through the aux port. The sound quality stinks. I called Pioneer and they recommended that I try their CD-IU50V. Not su