Formatting text with getSelectedText()

I hope I am in the correct forum for this question.
I want to format the text contained in a JTextField by double-clicking on the word(s),and then clicking a JButton labelled "Bold".
I am able to capture the text , using getSelected() but where do I go from here?
Thanks in advance for any replies.

You can't change the text attributes for selected text on a JTextField. You can change the Font, but this is used for the entire text field not just the selected text. You need to use a JTextPane for this. Read this section from the Swing tutorial on "General Text Features" for a working example:
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html

Similar Messages

  • Formatting text with Safari

    I am posting ads on a website that doesn't use Safari (or any non PC system, from what I gather) for formatting. As a result, when I paste text in it only allows ktml formatting, which doesn't make paragraphs or do anything else. Is there a way to create text with formatting that will paste in as I format it, or is there a MAC-friendly browser that will allow me to format?

    If this site is really using KTML (as opposed to HTML), then you really don't have many choices for editing anything. Formatting is limited to the site design and capabilities of the system as they designed it.
    You might try this site for a script that works in Safari: http://www.hotscripts.com/Detailed/57712.html
    Mulder

  • Formatting text with JSTL (Without bundles!!)

    Hi,
    I am trying to format text aquired from a javabean in my jsp page. The bean has, for example a getName() method.
    The data in the bean was populated from a database and and the name property was set to 'MARTIN'. I want to be able to format this to 'Martin'.
    Now I could probably do this in the ValueObject, or in the DataAccessObject that created the ValueObject, but I don't want to have to change these, as other programs use these as they are.
    I can't seem to find anything in the JSTL that lets me format text, other than from a bundle.
    How can I achieve this?
    Martin

    Thanks for that.
    Just one slight wrinkle. If the property text is upper case, you have to use <str:lowerCase> first, then wrap that in <str:capitalizeAllWords>
    Martin

  • How to auto format text with new Pages?

    I lost my 'auto format' of fractions with the new version of Pages.  Before I would type "1/2" and it would appear as "½".  Where is that feature located in the new version of Pages?

    You can load these manually through System Preferences>Keyboard>Text in conjunction with the relevant characters that can be found using Character Viewer (use the search window in Character Viewer to find "half" etc.)  Cumbersome I know but it is a one time set up.

  • Formatting text with GREP or find/change

    Hi,
    Is there a quick find/changesearch or a GREP that I can use to format all the text that is inside a pair of pipes? For example "|Gone with the Wind|" would then be italicized.
    I have over a hundred pages of text that has been placed inside these pipes, and had Microsoft Word find/replace to format them, but can't seem to figure out how to do it in InDesign.
    thanks in advance,
    Lina

    If the pipes are not to be deleted - in this case GREP is not the best way. Try nested style instead:
    Have fun

  • 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.

  • Formatting texts with lines

    I'm having a heck of a time getting a text frame to line up well. I have numerous rows that start with a number. I then have a line after it.
    i.e.
    1.________________________
    2.________________________
    2.a. _____________________
    If I do right align the left is all messed up. If I do left align, the lines don't go to the end and then they don't look good. what can I do? there has to be a way to make it look clean, I see it all the time.

    Combination of:
    Indents
    Tab stops or Right Aligned Tabs
    Underline character style
    Example:
    Paragraph Indent 12 pt
    1st line indent -12 pt
    Right indent 0 pt
    Last line indent 0 pt
    1. (tab) (right align tab with underline) (return or soft return)
    (tab) (right align tab with underline) (return)
    2. (tab) (right align tab with underline) (return)
    etc.
    HTH
    -mt
    Edit: for the sub numbers (2.a. etc), change the indent values to make room for the alpha characters as needed.
    Set them up as nested paragraph styles to make application easy.
    If the rule is not intended to span the width of the text frame, then use Phil's method. Add a tab stop where you want the rule to end, and set a leader (or use the underline character style)

  • Formatting incoming text with style sheets

    Is there a way to "find/change" formatted text with existing style sheets?<br /><br />In other words I have formatted text placed into my indesign document that looks like the following: <bf>Four Patch</bf> Then another set of text that looks like this:<it> Baltimore Press</it> <br /><br />I set up stles sheets formatted for Bold font and Ital font to accomodate these formats. Problem is I have a 500 page book that I need to go through and stylize. I tried to do a find/change global (<bf> </bf> to bold font etc but it didn't work. I was hoping by just putting a space between the <> would  help the find/change option to find all the text but kept saying could find.<br /><br />I hope someone understands what I'm trying to do and can tell me that there is a remedy to the tedious formatting issue I have.<br /><br />Thanks<br /><br />MAria<br />Stuart, Florida

    If you have InDesign CS3, I can think of two ways to deal with this.
    Grep search: set search to
    <bf>([^<]+)</bf>
    and replacement string to
    $1
    and then set the change format to your boldface style. Change all. (I often think it's a good idea to take a copy before doing Change All on a 500-page document, but that's up to you.) Repeat with hopefully obvious changes for the italics. You can save the searches if you need to do this often.
    Adventurous alternative.
    Put the single line
    <stuff>
    at the top of your file, and
    </stuff>
    at the bottom.
    Now it's XML. So open the structure panel, import XML from the fly-out menu. Map Tags to Styles from the same menu, and set up the correspondence you need. Then drag the stuff node from the structure panel to the document.
    If you have to do this more than once, you can import the mapping from an old file each time after the first.
    IMPORTANT: The XML route will fail if you have loose & or less than characters in your file. You would have to replace these with the appropriate character entity references.
    (If you aren't reading this on the forum site, you may be seeing character entity references in the message. Hopefully you can decode them.)

  • How to save the structure of a formatted text in adf faces output component

    Hi all
    please help me.
    I need to display my formatted text (with line breaks) in the jsf page. How can i do this. If i use OutputText all my line break ("\n") are ignored, the same effect with OutputFormatted component. I have tried to substitute linebreaks with the respective html tags but it also didn't take an effect.
    Thanks in advance

    Hi Timin,
    Set the Escape property on the outputText or the outputFormatted to <b>false</b>
    I believe only HTML tags will work though
    -chris

  • Texts with emoji's sending as mms only

    I recently updated to 4.3 and whenever I send a text with emojis it sends as an mms message and that just drains my batter and drives up my data plan, is there any fix to this?

    Paul13 wrote:
    well is there any way I could send them in an sms message because the internet signal where i live isnt good so sometimes the mms messages take forever to send
    Emojis, emoticons, formatting text with color or special fonts, attaching photos or videos - all are MORE than SMS - Simple Message Service.  SIMPLE, text only messages.
    Anything more converts or is sent as MMS, requiring a data connection, although it only counts as a text message and does not dip into your data allowance.

  • How can I keep my text format after pasting a text with a different format?

    No matter when and where I start to write some text (whether it is a SImpleText, E-Mails, or anyother application's doc), if I have to cut and paste a text from a different source that is formatted differently than my original text (ie. the one I am already using ), once I have pasted the differently formatted text in my doc, the typeset changes while it continues to type with the same formatt used in the text I just pasted.
    How can I continue typing with the same text formatt used before pasting the new text, after pasting the new text, without having to change size, font style etc. Is there a short cut?
    What I have been doing to avoid this problem is: I usually type my entire text content (whether it is an E-Mail, or other doc) then, once I am done typing, I paste the text that was cut from a differently formatted document, so that my text remains with the same formatt in its integrity, while the pasted text stands out differently, but it is a bit complex doing that , because I not only have to remember to paste the other text when I am done typing (I run the risk of forgetting to paste the text I need to insert--which has happened already) or I keep struggling with my formatt change after the pasting of the new text, so my document text starts looking like the same text as the one which was just pasted.
    Thanks for your time reading this!

    KerrBr wrote:
    How can I continue typing with the same text formatt used before pasting the new text, after pasting the new text, without having to change size, font style etc. Is there a short cut?
    (1) First, let's make sure we're talking about the same thing. By "SImpleText, E-Mails" you mean TextEdit and Mail, right?
    (2) Some apps (TextEdit, Mail) use the text engine provided by Mac OS X. By and large, these apps will behave in a similar manner. Others (eg, MS Word) use their own text engine, and their behaviour can be quite different. For such an app you need to consult its manual.
    (3) In TextEdit, if you want the pasted text to adopt the current style, then use kurt188's tip.
    (4) However, if you may want the pasted text to retain its own attributes, while you continue to type in the previous style. I don't know of any shortcut or command that will achieve this. However, you can try to work around it.
    (4.1) TextEdit has the Copy Style (⌘⌥C) and Paste Style (⌘⌥V) commands. If you haven't yet used it, ⌘⌥V will insert the default style. So type, paste, ⌘⌥V, then continue typing. If you have used, it will insert whatever style was copied. You can, type, ⌘V, click somewhere before the pasted text, ⌘⌥C, click after the pasted text, ⌘⌥V, and continue typing.
    (4.2) Alternatively, type your text. Then type one more character, eg, "x". Then ←, ⌘V, ⇧→, and start typing. The new text should adopt "x"'s format. (This should work in Mail, too. I don't know, because IMHO e-mail should always be plain text.)

  • Copy text with formatting in acrobat api

    Is it possible to copy the text with formatting via plugin api to a file?please provide methods or samples to achieve this functionality.

    Hi Irosenth,Test Screen name, I'm getting issues while formatting ,this pdf
    http://dprs.datamatics.com/ismart/doublecolumn.pdf
    displays results as like
    87  away aside; Q2’s ‘awry’ is generally (‘No, no, not I’, etc). preferred (e.g. by Oxf), presumably as 97 I know F’s reading is less accusatory a rarer and stronger reading, though than Q2’s ‘you know’, which is pre-Hibbard prints ‘away’. Either could be ferred by Oxf. a misreading of the other. 99 *the . . . Then . . . lost Jenkins, Oxf
    89  Nymph . . . orisons Jenkins sees in and Hibbard all conflate to read ‘the Q2/F’s shared spellings evidence of F . . . their . . . lost’. The only word that following Q2. strictly requires emendation is F’s
    96  No, no Hibbard conflates with Q2’s ‘left’ for lost, which seems a likely ‘No, not I’ to produce a metrical line error.
    But it suppose to show as
    Please clear me why the formatting has been lost?what's the alternative in this situation???
    Reply ASAP....THANKS

  • How to display HTML formatted text in the field with Item Style: Raw Text

    How can I display HTML formatted text in the field with Item Style: Raw Text.
    Currently the Item Style is Raw Text, but the text is being displayed along with HTML tags without formatting.
    Regards

    Hi,
    Use Item Style formattedText.
    Regards,
    Gyan

  • Display issue with HTML formatted text in report builder

    I am using the FCKeditor in my application to allow endusers
    the ability to create formated text on reports. We curently are
    experiencing 2 issues: 1. If you copy and paste from MS Word
    2003/2007 it will not display the text correclty in the report; 2.
    If you use the FCKeditor toolbar to insert bullets or a numeric
    list it will not align the text correctly on the report. We are
    using Coldfusion 8 with Hotfix 1 and Coldfusion Report Builder's
    lastest build release.
    Has one experiences this same issue with HTML fields not
    printing correctly using the Report Builder? What other HTML
    editors besides FCKeditor might we use?
    Thanks,
    Dan VanWieren

    Can you tell me how to use </td> for each values
    Give me your example report - using before or after report
    Thanks
    MT
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by fdenis:
    Hi Gavin,
    If I understand well, your HTML tags are coded directly in your fields in the database, right? Because if it was not the case, you could have use a format trigger checking for which destination you're generating your report...
    if UPPER(:DESFORMAT) = 'HTML' or
    UPPER(:DESFORMAT) = 'HTMLCSS'
    then
    -- insert your HTML code in the value
    -- of your field. something like...
    newValue := '<B>' | | :YOUR_FIELD | | '</B>
    srw.set_field_char( 0, newValue );
    else
    -- when generating to other format,
    -- you'd have to add the formatting as
    -- you want.
    end if
    return( true );
    Of course, if it's not acceptable to remove the HTML tag from your database fields, you could develop a procedure that would translate your HTML tags to the good formatting (eurk... ;-)
    Good luck... :-)
    Frederic
    <HR></BLOCKQUOTE>
    null

  • Is it possible to add new columns with format "Text" once a table is linked to a form

    Is it possible to add new columns with format "Text" once a table is linked to a form in Numbers for iPhone or is it impossible and thus a serious bug?(Rating stars and numeric vales seem to work.)
    Those bugs happen both for new speadsheets as well as existing onces, like the demo. When you are in the form only the numeric keyboard shows up.
    Pat from the Apple Store Rosenstrasse/Germany approved that it looks like a Bug during the Numbers Workshop I was in: It is not possible to add new columns with format "Text". I reported the error for Version 1.4 but there is no update nor do I get statement of understanding the issue.

    Hi Knochenhort,
    I see what you are talking about now. Without knowing how the program actually works, I think this is what's going on:
    When you add a new column to an already existing table (with already existing formats), the new cells come already formatted like the previous column. So when you add a column to the end of the demo table, the cells are already formatted like stars, and when you add a column to the beginning, they're already formatted like number.
    I think this is why it's different when if you add columns to a table with blank (unformatted) columns. In that case, the new cells aren't already "tainted" with a set format, so you can change to text format without issue.
    It seems like the problem is that you can't format cells that are already formatted as "number" as "text" format (even if it doesn't look like they are, because they are blank). IMO, this is a bug! This is why you don't see this issue when adding columns to a new table, because the new cells don't already come with a format.
    To workaround, you can highlight the body cells after adding the new column, and delete the cells. This will "clear" the formatting, so you can then go in the inspector, format them as text, and the correct keyboard will pop up.
    Hope that helps!

Maybe you are looking for