JTextPane - getting the color of the highlighted text

Ok, I have a JTextPane that accepts typing input from the user. I need to know how to highlight a string and recover its font color.
For example, if my JTextPane contained the sentence {color:#ff0000}This{color} {color:#0000ff}is{color} {color:#008000}an{color} {color:#ff6600}example{color} with those colors I want to be able to highlight the word "This", press a button, and have the program tell me that this string is red in RBG style. Likewise, I want to also be able to highlight the word "is" and return that color of blue in RBG format. I tried google searching this problem but I have had no luck. If anyone here has had experience with this or knows a way to do this I would very much appriciate it.
Error trapping for selecting more then 2 strings with different colors will not be a problem so don't worry about it. I just need to know how to do the above request.
Edited by: Naked-Crook on Jul 26, 2008 12:37 AM
nevermind, I figured it out. Topic closed.

Here is a simple conversion for you:
BufferedImage bi = new BufferedImage(myImage, myImage.getWidth(null), myImage.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics g = bi.getGraphics():
g.drawImage(myImage, 0, 0, null);If you are using ImageObserver objects, then replace null with the corresponding ImageObserver object in the BufferedImage and drawImage.

Similar Messages

  • How to get the highlighted text range through Framemaker's API calls?

    Hi all,
    I'm new to the Framemaker API (7.x) and developing a plugin for Framemaker 7.x. I wanted to get the highlighted objects from the active mif document. Tried this code:
    F_TextRangeT tr;
    /* Get the current text selection. */
    tr = F_ApiGetTextRange(FV_SessionId, docId, FP_TextSelection);
    Here is how I tested it:
    1. some text in the mif doc was highlighted.
    2. I clicked the menu item "my_plugin", a framemaker dialog popped up, some test configuration was sent through the dialog.
    3. The test configuration was read by my program correctly.
    However, the debugger showed that the tr is null! When I changed the first step of the test into:
    1. placed the mouse cursor at somewhere in the mif doc.
    The plugin worked somehow, the line where the mouse cursor was placed got selected, although I did not highlight anything.
    My question is: how to get a highlighted range though the Framemaker API call? I've been flipping through the FDK 7.0 Programmer's Reference but haven't found a solution yet. Any hint will be highly appreciated.
    Best Regards,
    Ellen N. Zhao

    Here is some information from the FDK Programmer's guide page 115:
    IMPORTANT: A valid text range can span multiple paragraphs, subcolumns, or text frames.
    It cant span multiple flows, footnotes, table cells, or text lines.
    It is possible for a document to have no text selection or insertion point at all. This can occur in
    the following circumstances:
    ● One or more graphic objects in the document are selected
    ● One or more entire table cells in the document are selected
    ● There is no selection of any type in the document
    So, I did select one or more entire table cells in the document in my first test. It's logical that the result was not like expected.
    But selecting one or more entire table cells is a crucial requirement for my plugin, is there anyway to get things straight?
    Simply put, I want to enable users to select one or more table cells in the document, and I want to get the object handles of the first cell and the last cell through Framemaker API calls. How?
    Many thanks in advance!
    Best Regards,
    Ellen N. Zhao

  • How to get the bold texts in JTextPane?

    How to get the bold texts in JTextPane?

    I believe you need to look at the Elements of the Document. Use the Document.getDefaultRootElement() method to get the first root Element. From there you can iterate through all the Elements. You should then be able to check the attributes of the element to see if it contains the Bold attribute using something like:
    AttributeSet attributes = element.getAttributes();
    if ( attributes.containsAttribute(StyleConstants.Bold, Boolean.TRUE)
    // do processing here

  • How to get the Underlined text in JTextPane

    I have a JtextPane with text say "i _like java_ it is a _good language_".
    in the above text i have made "like java" and "good language" underlined. And i have added a mouse listener to this JTextpane. the whole idea is to create a hyperlink so that when the user clicks anywhere on "like java" then i want to get the complete text("like java") where i clicked and using this text i want to do some operation. How can i get the underlined text?
    thanks.

    it was the same i question what i had posted. i didn't get reply there so i posted the same question in a new topic.

  • I have powerpoint for Mac on my imac.  I can't seem to get the active text box function to work like it did on my PC.  How can I insert an active textbox into a presentation that will allow me to type while presenting?

    I have powerpoint for Mac on my imac.  I can't seem to get the active text box function to work like it did on my PC.  How can I insert an active textbox into a presentation that will allow me to type while presenting?

    I've gotten a little further on this. The dynamic select is
    working fine. It's the "a href" code that isn't. I'm wondering if
    someone can look at this line and tell me if it's okay to build the
    query string this way. The storeid comes through fine but I'm still
    not getting the employeeid value to pass. Here's line that's not
    working:
    td><a href="registerStoreCust.php?storeid=<?php echo
    $row_storeRS['storeid']; echo "&employeeid="; echo
    $_GET['employeeLM']; ?>">Register
    Customer</a></td>

  • Can I get the same text messages on both my iPhone and my iMac

    can I get the same text messages on both my iPhone and my iMac
    It seems that my Mac is getting them and they dont show up on my iphone.

    Hi julian KAYE!
    You will want to make sure that both your computer and phone have all options checked in the “Start new conversations from” section in your Messages settings:
    iOS: Using Messages
    http://support.apple.com/kb/ht3529
    You can change the address that new iMessage conversations are started with in Settings > Messages > Send & Receive > Start new conversations from. Note that this setting applies only to new conversations. If you would like to change the address from which messages are sent, first change this setting, and then delete the existing conversation and start a new one.
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Thanks for using the Apple Support Communities!
    Cheers,
    Braden

  • How to get the short text in tcode "msc3n" -- Basic data 2 -- short text.

    I have to display the short text in my report output.
    How to get the short text in tcode "msc3n" ( msc3n --> Basic data 2 --> short text.)?
    Is there any function module availble to get this short text or is this stored in any data base table ?
    Please help me. Your help will be highly appreaciated.
    THANKS.

    Hi,
    Use FM 'READ_TEXT' to get this values.
    Say for exampele my material is  1900001 and batch is 0000000517.
    Then my parameters to the FM will be as follows:-
    Text Name       000000000001900001    0000000517
    Language        EN
    Text ID          VERM
    Text Object     CHARGE
    This information you can get as follows.
    Open the short text window in the text editor.
    Here you can enter the long text.
    In the editor Go to Header and you will find the details.
    Please note that the text name will comprise of
    Material
    Batch
    Plant
    Stor. Location
    if all the details are given.
    I hope this helps you.
    Regards,
    Ankur Parab

  • I have Adobe Photoshop Elements 10. It came installed on my HP Desktop. I am can not get the warp text tool to work. It has worked in the past. Once I click warp text, the little window does not pop up, and if I try to do anything else after I click warp

    I have Adobe Photoshop Elements 10. It came installed on my HP Desktop. I am can not get the warp text tool to work. It has worked in the past. Once I click warp text, the little window does not pop up, and if I try to do anything else after I click warp text, it wont let me. Just sounds the ding, alert, can still slightly navigate the program but can not use any other tools after clicking warp text. I just have to open task manager and close the program. not sure if I'm doing something wrong or maybe I just need to uninstall and re install. Having trouble finding out how to uninstall and reinstall because the program came pre installed on my desktop.

    It actually sounds like the warp text window is opening off screen.
    Resetting the photoshop elements 10 preferences should fix it.
    *Press and hold the Shift+Ctrl+Alt keys just after you start the launch of the photoshop elements 10 editor
    *Keep holding the keys down until you get a dialog asking if you want to delete the adobe photoshop elements setting file
    *Press Yes

  • Get the long text into BADI from text editor

    hi all,
    I implemented BADI ME_PROCESS_PO_CUST, before saving the purchase order i am calling the text editor where i am writng
    the long text . but when save the text from the text editor the long text in the editor is not updating to the BADI.
    Can anybody help how can i get the long text to the BADI.
    Regards,
    Madhavi

    Hi
    Have you tried with interface 'IF_PURCHASE_ORDER_MM' with these methods in the BADI?
    IF_LONGTEXTS_MM~GET_TEXTOBJECT
    IF_LONGTEXTS_MM~GET_TYPES
    IF_LONGTEXTS_MM~GET_TEXT
    IF_LONGTEXTS_MM~SET_TEXT
    IF_LONGTEXTS_MM~ADOPT_TEXT
    IF_LONGTEXTS_MM~DELETE_TEXT
    IF_LONGTEXTS_MM~EDIT_TEXT
    Regards
    Eduardo

  • Table in which if I put the delivery number ..I should get the HEADER TEXT

    Dear Members,
    I am checking for a table in which if I put the delivery number ..I should get the HEADER TEXT. Does such table exists or a Z report shoudl be created for this kind of setup.
    Regards,

    Hi,
    There are two Tables in which the texts will be stored
    One is STXH -
    TEXT HEADER
    other   STXL------- TEXT ITEM
    If you want to get the Header text then input the values in the table
    In STXH
    TEXT OBJECT     is    VBBK
    TEXT NAME      is      DELIVERY NUMBER
    TEXT ID             is       ZS01  ( this is the standard ID for the  Header note 1 )
    Now goto SE37 and give the Function Module READ_TEXT and maintain all the above details and get the TDLINE Which contains the TEXT of the Delivery
    regards,
    santosh

  • I get the long text description 0f transaction fb03

    Hi Gurus,
    How can I get the long text description in the information view (field <b>ZEILE</b>,
    data element EENO_ZEILE) on the G/L account documet overview(transaction Fb03)?
      My prob is, This field stored in a structure called
    Thanks in ad.
    Regds,
    Bala

    Hi,
    a) Find out for which <b>table</b> this long text is linked.
    b) Go to <b>TTXOB</b> table and in the field <b>TDOBJECT</b>, check whether this entry is present.
    c) If present, then use FM READ_TEXT, to get the long text value.
    Important parameters to be passed in READ_TEXT
    a) ID         
    b) Language (EN??)
    c) Name   ( I believe in this case it would be ZEILE)
    d) Object (TTXOB-TDOBJECT value)
    Regards,
    Subramanian V.

  • Get the long text from Text Editor

    Hi,
    I am using text editor to enter the long text, after entering the text in the text editor
    when press the save button i am getting the long text into the internal table . this is working fine till here.
    But when press SAVE button , i want the text into the internal table  and  the text editor to be closed.
    but here i am not able to get the data into internal  table as it is again creating text editor .
    Can anyboby help me .

    Hi,
    Refresh the table.

  • Can I design something in Muse and somehow get the HTML text fro it to plug into Business Catalyst to make a newsletter?

    I guess since I don't know html, I was wondering if I could create a "page" in muse and somehow get the "HTML" text from it so I can plug that text into a Business Catalyst E-Mail Marketing Campaign template. since I am struggling so much with modifying one of Business Catalysts established templates.
    I made my website with muse and I host it through Business Catalyst with a webMarketing Plan.
    Thanks in advance,

    There is no direct way to achieve this but you may try a workaround which may work but would require testing on your end.
    Create the site in Muse and publish to BC , master page will be included in template section. So in your published site , Page template will show you design from Muse.
    Now from Partner portal , you can select the site to create email campaign template but please note that creating a template from PP will remove the default email campaign templates on BC end.
    After creating the campaign template from PP , login to your site and create email campaign and in template section you will get the option to select the template which you created from PP.
    Not an ideal way but can be used as a workaround.
    Thanks,
    Sanjit

  • How to get the field texts from abap dictionary into screen Text fields

    Hi SapAll.
    here i have got to modify one zscreen by adding 1 more field,when i added one field in teh screen by just writng the code in program as SELECT-OPTIONS ilart FOR CAUFVD-ILART.
    but iam unable to get the field text for the text field from teh table CAUFVD.
    CAN ANY BODY HELP ME IN THIS.
    regards.
    varma

    Hi Varma,
    Even if you want to personalise the Text also you can do without checking the DICTREF checkbox. Dirctly you can give the text in the Text elements by using the Menu GOTO -> Text Elemetns -> Selection Texts.
    Regards
    Thiru

  • How to get the Sales Text?

    Hi,
    I need a Function which will help me to read the Sales Text found in the MM03. I am using the following function but it seems I am not getting the NAME right. In the table STXL when I checked the NAME contains the MATERIAL(X7000114BLCK), SALES Org(1000) and Distribution Channel(20) like this "X7000114BLCK      100020". How could I make up this? or is there another easy Function where I could give the Sales Order No, Material or Line Item to get the Sales Text which comes in MM03.
    The Funtion that I used;
    call function 'READ_TEXT_INLINE'
             exporting
                  id              = '0001'
                  inline_count    = 1
                  language        = 'E'
                  NAME            = PO_OBJ
                  object          = 'MVKE'
             tables
                  inlines         = inlines
                  lines           = lines
             exceptions
                  id              = 1
                  language        = 2
                  name            = 3
                  not_found       = 4
                  object          = 5
                  reference_check = 6
                  others          = 7.
    Thanks,
    Kishan

    Hi Hymavathi,
    I did like this;
    DATA v_tmp(18) TYPE c.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
         EXPORTING
             input  = wa_sales-matnr
         IMPORTING
             output = v_tmp.
    CONCATENATE v_tmp 'XXX' INTO PO_OBJ.
    The answer that I get is this - "X7000114BLCKXXX" the spaces beteeen the MATNR and XXX is not there. How could I get this?
    Thanks,
    Kishan

  • How to get the relevant text in the Cone Chart(WAD)

    Hi Expert's,
      Here is a requirement where we are using the CONE chart.
    But we are not getting the relevant texts based on the query attached.
      Plz help me to get the texts.
    Thanks in Advance.
    Vasu.

    Expert's plz look into it..this is very urgent.

Maybe you are looking for

  • Adding a preset to an already edited photo without changing the edit

    Can someone please help me with adding a preset to already edited photos without changing the edit.  Basically I will edit an entire wedding and then I go back and pick out favorites for my bride and like to add the same artistic edit over them.  Sin

  • No iPhoto Found in Applications

    I just loaded on the Leopard software, and I needed to do a complete rewrite of my destination disk. Now as I am checking all my applications, I have no iphoto app and it is not on the computer. I went to download iphoto from Apple and it indicated t

  • Automatic update of Tax on change of tax driver  in SRM SC and PO

    Hello Experts, I ma facing one issue in Extended Classic secenario. At the time of creating the SC or PO the tax is calculated from the Vertex . So i already did a setting of calculted Tax in the Backend. Now when we create SC or PO the tax is calcul

  • Transport classes and programs to another server

    Except for transport routing and charm copy function, do we have other ways to do so? for example copy or so forth. best regards, Blake Le

  • Query to print the max value of time of the latest record from table

    hi i wrote this query which should return max fx_time of the latest or current value of fx_date plz help this wuery is giving current date fx_date but with all values not the max value of fx_time. select FX_DATE, FX_TIME,FROM_CURRENCY, TO_CURRENCY, A