JTextArea formatting text and colors

Hi,
I have a jTextArea and I need to wrap line, how can I do?
I want to change color of a selected text, how?
Thanks to all!

Refer to the Java Tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/textarea.html for more info on how to use the JTextArea. JTextArea only allow you to display plain text, so if you want the selected text to change color, you will have to use the JEditorPane (or its subclass JTextPane). Refer to http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html for more info.

Similar Messages

  • Lack of sharpness in text and colors

    Recently I have noticed text and colors appear to have faded, not dramatically but discernible nonetheless. I have adjusted brightness (in displays) with no effect so I wonder if someone can suggest another route ... or is it symptomatic of other problems.

    Sorry. Resolved. Universal Access. I just hadn't found it.

  • Need help with adding formatted text and images to Crystal Report?

    Here's my scenario:
    I have a customer statement that's generated as a crystal report and that has a placeholder for advertisement. The advertisement is mixture of formatted text and images. Until now we only had one advertisement that was always used on the report. The new requirement is that we would have a pool of hundreds of advertisements and would need to display one specific advertisement on the customer statement based on various marketing criteria. They key is that the advertisement content will be determined programmatically and cannot be hardcoded into the report. I'm using Crystal2008 with .net SDK.
    Here are the solutions I thought of, but I'm still rather lost and would appreciate your help/opinion.
    1) Pass HTML or RTF to the report
    Not really sure if this is possible and how to get it done. Also how would I pass in images? Would display formatting be reliable when exporting to PDF?
    2) Create each add as a subreport and append it programatically
    I actually have this working, but I only know how to append a new section to the end of the report and then load the subreport to the section. I have no other controll of the placement. Is there a way to dynamically load a subreport to a predefined section in the main report? How about adding a dummy subreport in the main report as a placeholder and then replacing it with a different subreport? How could I do this?
    3) Pass an Image to the report
    I would create each advertisement as an image and then would somehow add the image to the report. How would I load the image and control the placement? Could I somehow define a placeholder for the image in the main report-maybe a dummy image to be replaced?
    Thank you.

    Hello Pavel,
    I would got the third way.
    You can use dynamic images in your report.
    Just by changing the URL to the image the image can be changed.
    Please see the [Crystal Manual|http://help.sap.com/businessobject/product_guides/cr2008/en/xir3_cr_usergde_en.pdf] and search for images.
    or directly here
    [Setting a Dynamic Graphic Location Path on an Image Object|https://boc.sdn.sap.com/node/506]
    [Dynamic image and HTTP://|https://boc.sdn.sap.com/node/3646]
    [codesample for .NET|https://boc.sdn.sap.com/node/6000]
    Please also use
    [Crystal Reports 2008 SDK Documentation and Sample Code|https://boc.sdn.sap.com/developer/library/CR2008SDK]
    [Crystal Reports 2008 .NET SDK Tutorial Samples|https://boc.sdn.sap.com/node/6203]
    Hope this helps
    Falk

  • How to store the rich formated text and screendumps in Oracle database

    Hi,
    I will create an FAQ management system. Users can log into the system, search and view the FAQ and answers. To be intractive, the users can also create new FAQ and add the comments on FAQ answers.
    The FAQ answers have rich formated text and the screendumps in the mid part of the answer. It should be presented in one page during user read/update the answers. How can I store the FAQ answer to Oracle database?
    Best regards,
    Ning

    I used blob to store pictures.
    The FAQ answer is the combination item of formated text and pictures. Can I use it to store?
    If I decided to use blob, how can I present the FAQ answers to the web. How can I edit the answer on the web?
    Thank you very much!

  • Dynamic Text and color changes......

    In some cheap website creating software I have you can turn
    text into rich text and change the color of individual words inside
    the same text box full of text. Is there anyway to do that in flash
    CS3?

    Thanks clbeech I actually found an easy way to do it. For
    your dynamic text box you can click the "html" box in the
    properties window for that text box. (Its a little square box with
    this <> inside it and its just to the right of the singleline
    and multiline box drop down.) You can then select the text you want
    to edit inside the text box and change its font/size/color as well
    as turn it into a dynamic link and it will do so without affecting
    the rest of the text in your text box.

  • Formatted text and smartforms/Adobe forms

    Hello all,
    can anybody please tell me if there is a way to display formatted text that was edited with FormattedTextEdit (or is there any other ui element that allows me to format text?) in smartforms/adobe forms with all formats? Also, is it possible to display graphics in the smartforms/adobe forms that was prior uploaded to the application server?
    Thanks and regards, Oliver

    Hi Raja,
    I implenented SAVE_TEXT AND READ_TEXT like you advised but the smartforms still doesn't show the text formats edited via BTF editor.  I even tried to convert it to ITF using "CONVERT_STREAM_TO_ITF_TEXT" but it wouldn't help either. For example the text
    <HTML><HEAD></HEAD> <BODY> <P>This is a test text in Times New Roman</P> <P><FONT face=Arial>This is a test text in Arial</FONT></P> <P><FONT face=Arial><STRONG>This is a test text in Arial and bold</STRONG></FONT></P></BODY></HTML>
    would exactly appear in this manner (using text element in smartforms) and not formatted. Do you any other ideas solving this issue?
    Thanks and regards, Oliver

  • Javascript errors when formating text and images in Contribute CS3

    I'm using Contribute CS3 on Vista, I insert an image inside a
    paragraph tag with text then align the image
    ie the source code looks like this:
    <p><img src="..." alt="" align="left"/>some
    text</p>
    I change the text in the paragraph to bold
    Source code example: <p><img src="..." alt=""
    align="left"/><strong>some text</strong></p>
    I will get the following error messages:
    1 This error appears 2 times:
    "While executing DW_Text_CSS_Style canAcceptCommand in
    ccText_Styles.htm, a JavaScript error occurred."
    2 This error appears 2 times:
    "While executing DW_Text_Bold canAcceptCommand in
    Text_Style.htm, a JavaScript error occurred."
    3 This error appears 3 times:
    "While executing DW_Text_Italic canAcceptCommand in
    Text_Style.htm, a JavaScript error occurred."
    4 Next all the styles and formatting options are greyed out
    but I can still publish or discard.
    To be able to apply the styles and formatting in Contribute
    CS3 I now need to close the application and reopen it again and be
    careful not to reproduce the error.
    I've also tried renaming the Configuration folder under
    c:\Users\myusername\appData\Local\Adobe\Contribute CS3\ but it
    hasn't worked.
    We've reproduced this error on 3 similar machines in our
    office all running cs3 but the bug doesn't occur when performing
    the same steps in Contribute 3 or dreamweaver CS3 which is running
    side by side on these machines.

    It might be trying to pull the image from a different
    location than the image is currently stored in. Try to move the
    image file to a different folder and then load.

  • Load text and color into text box

    I am trying to create code that will load text from an external file and change the background of a text box when a button is clicked.
    When I compile the movie and click the button some text appears in the text box but not the text I was extecting and there is no color change.
    The output panel displays the following message
    "Fonts should be embedded for any text that may be edited at runtime, other than text with the "Use Device Fonts" setting. Use the Text > Font Embedding command to embed fonts"
    So far I am just trying to get the blue button to work
    This is the code
    Thanks
    import flash.events.MouseEvent;
    import flash.net.URLLoader;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.events.Event;
    var drawLine:MovieClip = new MovieClip();
    var color:Number = 0x6600cc
    addChildAt(drawLine, 1);
    //addChildAt(blackRectangle, 0);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
    stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
    function startDrawing(event:MouseEvent):void{
    drawLine.graphics.lineStyle(3, color);
    drawLine.graphics.moveTo(mouseX, mouseY);
    stage.addEventListener(MouseEvent.MOUSE_MOVE, makeLine);
    function makeLine(event:MouseEvent):void{
    drawLine.graphics.lineTo(mouseX, mouseY);
    function stopDrawing(event:MouseEvent):void{
    stage.removeEventListener(MouseEvent.MOUSE_MOVE, makeLine);
    blueBtn.addEventListener(MouseEvent.CLICK, colorBlue);
    function colorBlue(event:MouseEvent):void{
              color = 0x0000ff;
              textLoad("../text/colorBlue.txt", color);
    redBtn.addEventListener(MouseEvent.CLICK, colorRed);
    function colorRed(event:MouseEvent):void{
              color = 0xff0000;
    randomBtn.addEventListener(MouseEvent.CLICK, colorRandom);
    function colorRandom(event:MouseEvent):void{
              color = Math.random()*0xff55aa;
    clearBtn.addEventListener(MouseEvent.CLICK, clearScreen);
    function clearScreen(event:MouseEvent):void{
    drawLine.graphics.clear();
    var loader:URLLoader = new URLLoader();
    function textLoad(file:String, color:uint):void{
              loader.load(new URLRequest(file));
              colorText.backgroundColor = color;
    loader.addEventListener(Event.COMPLETE, displayText);
    function displayText(e:Event):void{
              colorText.text = loader.data;

    As far as the text goes, embed the font for the textfield ti get rid of the warning.
    If you are not getting the background color to change, did you give your textfield a background to begin with?  The code you have to change its color will work if it has a background.

  • TextArea with formatted Text, Hyperlinks, and clickable Text with SWING?

    Hi again,
    Ok if I decide to use Swing, is there any TextArea which supports Formatted Text Hyperlinks AND clickable Text wich calls a callback routine??? I think formatted Text and Hyperlinks are possible with JTextArea and the RTF editorKit, but clickable text, in order to controll the program in some way???
    Could anyone help me?
    Greets

    Try the JEditorPane class.See the intro exapmle at the top of
    [url=http://java.sun.com/j2se/1.4.2/docs/api/javax/swin
    /JEditorPane.html] this page.That seems to be the solution! Can I use the JTextPane, too? Does a DefaultStyledEditorKit support Hyperlinks and Hyperlinklisteners, too?
    In order to realize callback functions I have to insert a HTML-Anchor with the Attribute as the Parameter for my method. Then my HyperlinkListener catches the HyperlinkEvent and the hyperlinkUpdate method reminds the parameter!
    Is that right?
    Thank you very much!
    Greets

  • How can i copy line with text and image to ms word

    When I insert an image in textflow using InlineGraphicElement it works, but when I copy the line with the image to MS Word it copies only the text (not the image).
    How can i copy the image to MS Word?

    If you want copy formatted text and image to MS Word, you need to give MS Word rtf markup, because Word can recognize rtf markup but not TLF markup.
    So you need to create a custom clipboard to paste a rtf markup. It's a large feature for you, because you need a tlf-rtf converter in your custom clipboard.
    TLF Custom Clipboard Example:
    package
        import flash.display.Sprite;
        import flash.desktop.ClipboardFormats;
        import flashx.textLayout.container.ContainerController;
        import flashx.textLayout.conversion.ITextImporter;
        import flashx.textLayout.conversion.TextConverter;
        import flashx.textLayout.edit.EditManager;
        import flashx.textLayout.elements.*;
        import flashx.undo.UndoManager;
        // Example code to install a custom clipboard format. This one installs at the front of the list (overriding all later formats)
        // and adds a handler for plain text that strips out all consonants (everything except aeiou).
        public class CustomClipboardFormat extends Sprite
            public function CustomClipboardFormat()
                var textFlow:TextFlow = setup();
                TextConverter.addFormatAt(0, "vowelsOnly_extraList", VowelsOnlyImporter, AdditionalListExporter, "air:text" /* it's a converter for cliboard */);
            private const markup:String = '<TextFlow whiteSpaceCollapse="preserve" version="2.0.0" xmlns="http://ns.adobe.com/textLayout/2008"><p><span color=\"0x00ff00\">Anything you paste will have all consonants removed.</span></p></TextFlow>';
            private function setup():TextFlow
                var importer:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_LAYOUT_FORMAT);
                var textFlow:TextFlow = importer.importToFlow(markup);
                textFlow.flowComposer.addController(new ContainerController(this,500,200));
                textFlow.interactionManager = new EditManager(new UndoManager());
                textFlow.flowComposer.updateAllControllers();
                return textFlow;
    import flashx.textLayout.conversion.ITextExporter;
    import flashx.textLayout.conversion.ConverterBase;
    import flashx.textLayout.conversion.ITextImporter;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.elements.IConfiguration;
    import flashx.textLayout.elements.TextFlow;
    class VowelsOnlyImporter extends ConverterBase implements ITextImporter
        protected var _config:IConfiguration = null;
        /** Constructor */
        public function VowelsOnlyImporter()
            super();
        public function importToFlow(source:Object):TextFlow
            if (source is String)
                var firstChar:String = (source as String).charAt(0);
                firstChar = firstChar.toLowerCase();
                // This filter only applies if the first character is a vowel
                if (firstChar == 'a' || firstChar == 'i' || firstChar == 'e' || firstChar == 'o' || firstChar == 'u')
                    var pattern:RegExp = /([b-df-hj-np-tv-z])*/g;
                    source = source.replace(pattern, "");
                    var importer:ITextImporter = TextConverter.getImporter(TextConverter.PLAIN_TEXT_FORMAT);
                    importer.useClipboardAnnotations = this.useClipboardAnnotations;
                    importer.configuration = _config;
                    return importer.importToFlow(source);
            return null;
        public function get configuration():IConfiguration
            return _config;
        public function set configuration(value:IConfiguration):void
            _config = value;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.ListElement;
    import flashx.textLayout.elements.ListItemElement;
    class AdditionalListExporter extends ConverterBase implements ITextExporter
        /** Constructor */
        public function AdditionalListExporter()   
            super();
        public function export(source:TextFlow, conversionType:String):Object
            if (source is TextFlow)
                source.getChildAt(source.numChildren - 1).setStyle(MERGE_TO_NEXT_ON_PASTE, false);
                var list:ListElement = new ListElement();
                var item1:ListItemElement = new ListItemElement();
                var item2:ListItemElement = new ListItemElement();
                var para1:ParagraphElement = new ParagraphElement();
                var para2:ParagraphElement = new ParagraphElement();
                var span1:SpanElement = new SpanElement();
                span1.text = "ab";
                var span2:SpanElement = new SpanElement();
                span2.text = "cd";
                list.addChild(item1);
                list.addChild(item2);
                item1.addChild(para1);
                para1.addChild(span1);
                item2.addChild(para2);
                para2.addChild(span2);
                source.addChild(list);
                var exporter:ITextExporter = TextConverter.getExporter(TextConverter.TEXT_LAYOUT_FORMAT);
                exporter.useClipboardAnnotations = this.useClipboardAnnotations;
                return exporter.export(source, conversionType);   
            return null;

  • A way to undo Formatted Text & Graphics OCR from Acrobat 7?

    Over the course of a few months, my company received a large number of PDF files for a project for which the internal policy was that every file should be text searchable.  Unfortunately, we did not save the native files in any sort of convenient way, having at that time not realized that failing to do so was a very bad idea.  We ran OCR on every one of the files that we received, which total approximately 4,000.  At the time that we received the majority of these files, my company was still using Acrobat 7; we've since upgraded to version 8.
    Recently we discovered that there were discrepancies between our electronic copies and the hard copy printouts from which our electronic copies had been generated:  in the electronic copies, uppercase F had changed to P, S had changed to 8, etc.  We eventually worked out that it must have been that at some point a computer was mistakenly set to run OCR using the Formatted Text & Graphics setting, as opposed to either Searchable Image or Searchable Image (Exact).  This was absolutely not want we wanted, as for our purposes using a type of OCR that causes the original images to change essentially renders the files useless.  My questions, then, are the following:
    1)  As I asked in the title, is there any way of undoing Formatted Text & Graphics OCR that was performed in Acrobat 7?
    2)  Is there a way of identifying files that have had Formatted Tex & Graphics OCR performed on them (something stored in the metadata)?
    Rebuilding these files from scratch is going to require a gargantuan effort, so any help would be much appreciated.

    Hi,
    Bernd's been across the mountain and seen the bear; so, you can bank on what he posted.
    But, just because, I'll second his "no".
    Formatted Text and Graphics (Acrobat 7, 8) and ClearScan (Acrobat 9, X) effectively replace the image of textual characters.
    If a character is not recognized as 'something' a bit map is of the thing is left behind.
    Now, while Acrobat or other OCR engines (Abbey FineReader, AdLib, Adobe Capture, etc.) are really rather impressive no OCR engine has 100% accuracy 100% of the time. Other variables  come into play (scan lamp age/brightness, platen cleanliness, scanner mechanicals cleanliness, calibration of scanner, hard copy 'quality' (characters' darkness density, contrast between characters and background, presence of lack thereof of boxed in text, text in or adjacent to line arcs/circles, etc.).
    All of that is for semantic content that is "textual". Semantic content that is not textual (but, coincidently may contain text) provides little to no useful OCR output (e.g., graphs, drawings, etc.). Validate this by performing OCR on such a PDF then Export to a plain text file. Print this file out and compare that to the source paper or the scanned image.
    There is no metadata info that identifies the OCR mode used.
    Perhaps something buried in the bowls of PDF page description content; if so, not intrinsically easy to obtain.
    My suggestion (fwiw) - move forward with re-scan.
    A server product would help to move it along but a high speed scanner hooked to a local machine (with ample resources) and Acrobat Pro 8 or 9 get it done. With Acrobat 8 or 9 use Search Image (Exact).  In Preferences check the category Create PDF or TIFF to assure it is what you desire. Check Acrobat's scan presets to assure you have what you want vis-a-vis Compression and Filtering. Do avoid "Automatic".
    Be well...

  • Raw HTML data in reply box instead of formatted text when using forums or webmail interface

    At work, we use an internal webmail service with SmarterMail Enterprise 5.5 to communicate. Since upgrading to FF6, the reply text area no longer shows formatted text, and instead just shows the raw HTML code of the message you're typing. The size of the message box area is also reduced to about half what it used to be.
    Text formatting also does not function on several message board forums around the internet. Seen many others complain about the same.
    This did not happen in Firefox 5, and does not happen now in Chrome or IE8. Something about FF6's handling of webmail interfaces and forums or the handling of an extension that affects a webmail interface or forum is off.
    Any help?

    AFAIK, no. Acrobat/Reader will only generate plain-text emails.

  • URL in Formatted Text element

    I am using URL hyperlinks in a Formatted Text element. But, in runtime configurator, they open in the parent window although I have included the target=_blank directive in the a href element. I want to open them in a separate window. How can I achieve this? Text link element can achive this, but I will have to create many Formatted Text and Text Link elements for a single text display and this will affect the alignment as well. Any advice appreciated. Thanks.

    Thanks Guys.
    I am trying to create a declaration text like the below.
    "I understand that this application does not in itself constitute any form of approval for any service and does not place us under any obligation to grant such an approval.
    <br>
    <br>
    I understand and agree that the information submitted through this application form, shall, upon payment of all fees, and issuance of a receipted invoice by us, constitute part of our standard terms and conditions for the relevant service type as follows: <a href=http://www.website.com/terms target="_blank">Terms</a>
    <br>
    <br>
    I certify that all of the information submitted in the application form above is correct, that I am over 18 years old and able to enter into a legal contract in the service.
    <br>
    <br>
    I also confirm that I have read and agree to <a href=http://www.website.com/Terms-and-Conditions/ target="_blank">Privacy Policy</a>"
    I created the above as a formatted link with a style associated since this section needs to be of specific style.
    I tried to create a Raw text element, but it is not available inside a cell format (which is where the above formatted text element is currently placed).
    If I have to include the links as Text link element, it will be a cumbersome process to create many FT and TL elements and format them properly.
    Any ideas appreciated. Thanks.

  • Javafx 1.3 with swinglabel displaying html formated texts

    Dear FX experts,
    I am using swinglabel to display html formated text, and it worked fine with the fx 1.2. However, as I moved to 1.3, the showing of the text is not so proper, because I want the content of the swinglabel be shown in the middle of the box(the label itself) I set. However, in 1.2 it's ok, but 1.3 gives me headache: it's not shown on the place it should be, like it's ignoring all the centering attribute I tried to declare...
    any ideas? or suggestions? or solution?
    (ps, it keeps saying a warning if I used the class under ext package, since swingLabel is under ext... maybe it means I can use another class to do this? but I can't find any...)
    my codes would be like the followings:
    public def contentLabel: SwingLabel = SwingLabel {
    text: "<html\><font size=6>test test</font></html>"
    width: 400
    height: 500
    horizontalAlignment: SwingHorizontalAlignment.CENTER
    public function run(){
    Stage {
        title:"test"
        scene: Scene {
             width: 800
             height: 600
             content: [contentLabel]
    }Edited by: 880613 on 20.08.2011 16:41
    Edited by: 880613 on 21.08.2011 05:13

    No one knows about this?
    the SwingLabel or all Class files under ext packages are simply going to be replaced but without substitutors???

  • Fonts and Colors

    Ok in iChat I have a certain font and blue font color for my text. Unfortunattly a lot of my friends do not have Macs, so they don't use iChat. When I type a message in the typing box it starts out black. But when I send it I see blue, but my friends see the default text and black color. So then I tried going to the Text and Color editor thing. And each time I was going to send a message I changed the color to blue. When I did that, while I was typing I could see blue text instead of black. But when I sent it my friends could still only see black, but I still saw blue.
    So is it because they have windows that iChat can't convert the text and colors or something? If there is no way now, are they any high hopes that there will in the future?

    Hi,
    AS far as I can make out AIM displays the Text is Black and ascribes a Colour to the name of the person who sent the message. I don't think this colour even has anything to do with the iChat Bubble or Font Colour even if you change the colour of the text as you type (which you can also do).
    Proteus a Mac app can display messages like iChat can (in Coloured bubbles and coloured text).
    Unfortunately it seems that it is no longer available even if you do have a Mac.
    8:40 PM Monday; February 26, 2007

Maybe you are looking for

  • Error after upgrade to 7.4.3

    First I wanted to say that when I upgraded (I have the automatic upgrade option checked) to 7.4.2, it lost my library and all my playlists. When I made a new library it didn't find my playlists. But I'm not too worried about that. Anyway, then it upd

  • How to get full path in file browse item

    Hi I have a file item. When I submit the form and store and value in db, then the file path is stored as numbers and appended to the file name. I undestand that this is because of some wwv flow files index or something . How to get the file path? Any

  • Stop export to PDF after alert message;

    Hi forum, my task is: If i get alert message while pressing. CMD+E in indesign..... the alert message will display and say "your document has some problem".. and there after conforming alert message, the export to print should exit; (if the document

  • Sending emails in iPhoto 9.1.1 Duplicate Emails & (null) issue

    Hello, When using the Share | Email feature of iPhoto 9.1.1, I want to send emails to multiple people. SOME email addresses have issues when typing in the name of the person in the To section. There are two problems: 1. Some names show up twice in th

  • Change infoset in sap query

    Hi , I want to change infoset name in sap query sq01. I dont want to create new query to change infoset name. Any other option? Regards, Satyen Trivedi