Placing fonts in a JEditorPane after user enters text in a text field

Hello all,
I am writing a chat application that enables me to place fonts in a JEditorPane.
The user will write the text in a text field and when the user press the enter key and whatever is written on the text field will be shown on the JEditorPane along with the choosen font.
The only thing I can acomplish now is getting the font's to change inside the text field.
But I want the text to be send to the JEditorPane look like the choosen font that is set by the user after the user presses the enter key.
Does anybody here know how to do that? And can you give me some samples so I may be able to work on it?

When you insert the new text in the JEditorPane, you can do it using the insertString method of the editor pane's Document instance. This method allows you to pass an AttributeSet which can be used to pass the correct font. This is all well explained in the following tutorial :
http://java.sun.com/docs/books/tutorial/uiswing/components/text.html

Similar Messages

  • How to clear the data in my page after user enter submit button

    hi......
    how to clear the data's in my page after user enter submit button. Actually while pressing first time itself the data is uploaded in database.

    Hi Nazeer,
    Instead of doing it on the same button better create a separate button for this functionality, As per my understanding you want to clear these fields to create new record so that you can enter a new record so for this you just need to insert a new row in VO.
    Still if you want to do it on the same button then you need to put the check that particular record is not dirty if it is not then create new record else create new record.
    One more thing if you will clear on the second click of a button how will you update your record??
    Regards,
    Reetesh Sharma

  • Need help to get the user entered value from a input field in Table in OA

    I have a table in my OA page.
    Here one column is there which should take in put from user.
    i.e an item quantity field text input is there which should take the updated value when the add to cart link which is next column in the table. On clicking of the link I am trying to get the updated value entered by user. for the respected row for which addto cart link get clicked.
    For that link I have defined some parameter through SPEL,( like this parameter name: item_quantity value : ${oa.MisibeItemSearchVO.ItemQuantity} ) which has fireaction. But when i am clicking the addto cart link I am not getting the current value entered by the user.
    Can any body guide me how to get that related value for which the add to cart link got clicked.
    for this when i am doing pageContext.getParameter("item_quantity"));
    I am not getting the value entered by user.
    please suggest me
    Thanks!
    Smarajeet

    The below is my Vo query for item quanity i am using a dummy query "(select null from dual) as ITEM_QUANTITY"
    in the below query and item type is number. and this is a messageTextINput in OA page and is maped to ItemQuantity vo attribute.
    SELECT idsi.section_item_id
    ,idsi.inventory_item_id
    ,(select concatenated_segments from mtl_system_items_kfv mstk
    where mstk.inventory_item_id = idsi.inventory_item_id
    and mstk.organization_id =idsi.organization_id) ITEM_NAME
    ,(select description from mtl_system_items_tl mtll
    where mtll.inventory_item_id = idsi.inventory_item_id
    and mtll.organization_id =idsi.organization_id
    and language = USERENV('LANG') ) ITEM_Description
    ,(SELECT CASE
    WHEN instr(msib.segment6,'NAMED USER') > 0 THEN 'NAMED_USER'
    WHEN instr(msib.segment6,'PROCESSOR')>0 THEN 'PROCESSOR'
    ELSE msib.segment6
    END
    FROM MTL_SYSTEM_ITEMS_B msib
    WHERE msib.INVENTORY_ITEM_ID = idsi.inventory_item_id
    AND msib.ORGANIZATION_ID = idsi.organization_id) LICENSE_TYPE
    ,(SELECT CASE
    WHEN instr(msib.segment6,'1 YR') > 0 THEN '1YR'
    WHEN instr(msib.segment6,'2 YR') > 0 THEN '2YR'
    WHEN instr(msib.segment6,'3 YR') > 0 THEN '3YR'
    WHEN instr(msib.segment6,'4 YR') > 0 THEN '4YR'
    WHEN instr(msib.segment6,'5 YR') > 0 THEN '5YR'
    WHEN instr(msib.DESCRIPTION,'Perpetual') > 0 THEN 'PERPETUAL'
    END TERM FROM MTL_SYSTEM_ITEMS_B msib
    WHERE msib.INVENTORY_ITEM_ID = idsi.inventory_item_id
    AND msib.ORGANIZATION_ID = idsi.organization_id) TERM
    ,(select qll.operand
    FROM qp_list_lines qll
    ,qp_pricing_attributes qpa
    WHERE qll.list_line_id = qpa.list_line_id
    AND qpa.product_attr_value = to_char(idsi.inventory_item_id)
    AND qll.list_header_id = 439381
    AND sysdate between NVL(qll.start_date_active, sysdate) and NVL(qll.end_date_active, sysdate+1)
    AND qpa.list_header_id = qll.list_header_id
    AND qpa.product_attribute = 'PRICING_ATTRIBUTE1'
    AND qpa.product_attribute_context = 'ITEM'
    AND NVL(qpa.pricing_attribute_context,'MIXED') = 'MIXED') ITEM_PRICE
    ,(select null from dual) as ITEM_QUANTITY
    ,(select currency_code from qp_list_headers_b where list_header_id =439381) currency_code
    ,(select segment1 from mtl_system_items_b msib
    where msib.inventory_item_id = idsi.inventory_item_id
    and msib.organization_id =idsi.organization_id) PART_NUMBER
    FROM ibe_dsp_section_items idsi
    ,ibe_dsp_msite_sct_items idmsi
    ,( select distinct child_section_id
    from IBE_DSP_MSITE_SCT_SECTS b
    connect by PRIOR child_section_id = parent_section_id
    start with parent_section_id =:1
    and mini_site_id =1
    UNION
    select distinct child_section_id
    from IBE_DSP_MSITE_SCT_SECTS b
    where child_section_id =:1
    and mini_site_id =1
    ) csi
    WHERE idsi.organization_id = 101
    AND idmsi.section_item_id = idsi.section_item_id
    AND idsi.section_id = csi.child_section_id
    AND idmsi.mini_site_id = 14409

  • How to Get User entered value in a text variable

    Hi,
    I have made a text variable to show the user entered value in the column header.
    The user enteres value in a formula variable ABC whose default value is say '30'.
    I am using customer exit to capture this value in the text variable. The code is as follows
    IF i_vnam EQ 'txtvar'.
    if i_step = 2.
    LOOP AT i_t_var_range INTO loc_var_range
    WHERE vnam = 'ABC'.
    CLEAR l_s_range.
    l_s_range-low = loc_var_range-low.
    l_s_range-opt = 'EQ'.
    l_s_range-sign = 'I'.
    APPEND l_s_range TO e_t_range.
    EXIT.
    ENDLOOP.
    endif.
    endif.
    Now when I am executing the query I am getting the default value in the column header i,e, 30. But when the user changes this default value to something else while executing the query, I simply get blank in the column. The changed value is not getting captured in the text variable.
    Thanks

    Hi,
    Insted of  going for exit,
    just create a Text variable proceesing typr Default/ Manual Entry and set the default value as u wish,
    use it in the KF header; dont use the same Text Variable for Query Title.
    Now i tried this for you and it is working fine.
    Regards
    ReddY A

  • Populate pdf form after user enters specific customer id

    I am brand new to this and need to know the best way to populate certain fields on a pdf form. I have made the database connection and it works correctly. I want the user to enter a specific customer id. ( I already have the sql code for the select). When the user hits enter, I want other fields to be populated with address, etc. I am not using any kind of drop down box. Please help me with this.

    Try the Developers/SDK forum...
    This forum is for questions about the PDF Language itself.
    Leonard

  • How can a user enter a value in the field which is in read mode.

    Hi all,
          I am creating a badi for the valuation class.when ever i execute the mm02 transaction.if an invalid valuation class is entered,my error message is poping up.but it is coming in the display mode.i should get the valuation class field in the read mode.
    Regards,
    charita.

    Hi Charita,
    Use information message instead of Error message.Then it will not give u that field in non-editable mode.
    <b>Reward points if it solves ur query or answer is helpful</b>
    Thanks
    Chinmay

  • How to keep user enter value in textbox even if JSP page get refreshed.

    Hi Experts,
    In My JSP Page i have one text(customer Name) and number of checkboxes and radio buttons.
    My Problem is:
    if user enter some value in Text Box and after that user clicks on some radio button becouse of some action on radio button page get refresh and also the value enter by user in text box get vanish.
    I want keep text box value as it is even if page get refreshed becouse of some action.
    Is it any setting in Strust framework for this.
    I am using Struts Framework.
    Please let me know if need more information

    Sorry, I don't clearly understand the question and the horrible code (Java code doesn't belong in JSPs) doesn't make it more easy to understand.
    Best what I can guess is that you need to learn about passing request parameters/attributes in JSP and the possibilty of storing attributes in the session. And based on the code, also learn how to separate the data, business and presentation layers properly.

  • User entered data disappears from view in fields after entry in Reader 9

    This is a repost. The form was recreated and same problem (see below) has occurred. The person who has created these forms is a basic user, and so is not changing any settings or doing any programming, just adding fill-in fields (text boxes) and check boxes, then distributing by email through Acrobat. The problem also occurs with other forms. I cannot find any information on this problem anywhere. Any new ideas? File is attached.
    A simple form with basic text boxes is created in LiveCycle ES and distributed with Acrobat Pro 9. All users have been upgraded to Acrobat Reader 9. But when the user fills in the form in Reader, the text disappears when they tab or enter into the next field. Check boxes are fine. The user also does not see the data when printing. But, after submission, the data can be seen and printed from Acrobat Pro 9 by the original sender.

    This form image was created using a Toshiba MFP and had form fields added with Acrobat. There appears to be a font problem. I saved the form in Acrobat Pro Extended 9. When I opened the form in Reader 9 I was asked to install Japanese fonts since the form uses the KozMinPrN6-Regular font.
    After dismissing the install request, the form fields behaved predictibly in Reader 9 (with the exception of requesting 10MB of Japanese fonts).
    Steve

  • How can I make the Stock Market Panel load AFTER the User Enters correct password?

    Can someone PLEASE help me. I need the Second part of this code(the Stock Market Panel) to be display after the user enters the correct username and password I have predefine. I really need to complete this project for school, Last Semester and i want to finally graduate!
    <?xml version="1.0"?>
    <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:mx="library://ns.adobe.com/flex/mx"
                                     xmlns:s="library://ns.adobe.com/flex/spark">
              <fx:Script>
                        <![CDATA[
                                  import mx.controls.Alert;
                                  public var u:String;
                                  public var p:String;
                                  public function log():void
                                            u=user.text.toLowerCase();
                                            p=pass.text.toLowerCase();
                                            if((u==''||u!='webmultimedia')||(p==''||p!='abc'))
                                                      Alert.show('Wrong userid or Password','Sorry',Alert.OK | Alert.CANCEL);
                                            else
                                                      Alert.show('Hi','Welcome',mx.controls.Alert.OK);
                                  public function clear():void
                                            user.text='';
                                            pass.text='';
                        ]]>
              </fx:Script>
              <mx:Panel id="NewForm" title="Please Log In" height="214" width="285" horizontalAlign="center" verticalAlign="middle" horizontalCenter="23" verticalCenter="2">
                        <mx:Label id="User Name" text="User Name"/> 
                        <mx:TextInput id="user" />
                        <mx:Label id="password" text="Password"/>
                        <mx:TextInput id="pass" displayAsPassword="true"/>   
                        <mx:Button id="submit" label="Submit" click="log()"/>
              </mx:Panel>
              <mx:Panel width="349" height="383" chromeColor="#1B8905" color="#FFFFFF" focusColor="#0F3CFF"
                                    fontFamily="Georgia" fontSize="21" fontWeight="bold" paddingBottom="10"
                                    paddingLeft="10" paddingRight="10" paddingTop="10" title="Stock Market">
                        <!--First Pane Of TabNavigator-->
                        <mx:TabNavigator borderStyle="solid">
                                  <mx:VBox y="71" width="371" height="334" label="Dow Jones"
                                                       chromeColor="#0A741C">
                                            <mx:Image id="loader1" source="http://dl.dropbox.com/u/8861424/stock1.png"/>
                                            <mx:RichTextEditor id="myRTE" width="355" height="286" borderVisible="true"
                                                                                       color="#000000" text="Enter Stock Comment"/>
                                  </mx:VBox>
                                  <!-- Second pane of TabNavigator -->
                                  <mx:VBox label="SandP" width="500" height="350">
                                            <mx:Image id="loader2" source="http://dl.dropbox.com/u/8861424/Untitled.png"/>
                                            <mx:RichTextEditor id="myRTE2" width="355" height="286" borderVisible="true"
                                                                                       color="#000000" text="Enter Stock Comment"/>
                                  </mx:VBox>
                                  <!-- Second pane of TabNavigator -->
                                  <mx:VBox label="Nasdaq" width="500" height="350">
                                            <mx:Image id="loader3" source="http://dl.dropbox.com/u/8861424/stock2.png"/>
                                            <mx:RichTextEditor id="myRTE3" width="355" height="286" borderVisible="true"
                                                                                       color="#000000" text="Enter Stock Comment"/>
                                  </mx:VBox>
                        </mx:TabNavigator>
              </mx:Panel> 
    </mx:Application>

    it's probably not the correct way to do it but I am more familiar with Flex4 (which use states) but this works
    however i had to remove your Alert they were throwing an error
    <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                            xmlns:mx="library://ns.adobe.com/flex/mx"
                                            xmlns:s="library://ns.adobe.com/flex/spark">
              <fx:Script>
                        <![CDATA[
                                  import mx.controls.Alert;
                                  public var u:String;
                                  public var p:String;
                                  public function log():void
                                            u = user.text.toLowerCase();
                                            p = pass.text.toLowerCase();
                                            if ((u == '' || u != 'webmultimedia') || (p == '' || p != 'abc'))
                                                      //Alert.show('Wrong userid or Password', 'Sorry', Alert.OK | Alert.CANCEL);
                                            else
                                                      //Alert.show('Hi', 'Welcome', mx.controls.Alert.OK);
                                                      stockMarket.visible = true;
                                                      NewForm.visible = false;
                                  public function clear():void
                                            user.text = '';
                                            pass.text = '';
                        ]]>
              </fx:Script>
              <mx:Panel id="NewForm"
                                    title="Please Log In"
                                    height="214"
                                    width="285"
                                    horizontalAlign="center"
                                    verticalAlign="middle"
                                    horizontalCenter="23"
                                    verticalCenter="2">
                        <mx:Label id="UserName"
                                              text="User Name" />
                        <mx:TextInput id="user" />
                        <mx:Label id="password"
                                              text="Password" />
                        <mx:TextInput id="pass"
                                                        displayAsPassword="true" />
                        <mx:Button id="submit"
                                               label="Submit"
                                               click="log()" />
              </mx:Panel>
              <mx:Panel id="stockMarket"
                                    visible="false"
                                    width="349"
                                    height="383"
                                    chromeColor="#1B8905"
                                    color="#FFFFFF"
                                    focusColor="#0F3CFF"
                                    fontFamily="Georgia"
                                    fontSize="21"
                                    fontWeight="bold"
                                    paddingBottom="10"
                                    paddingLeft="10"
                                    paddingRight="10"
                                    paddingTop="10"
                                    title="Stock Market">
                        <!--First Pane Of TabNavigator-->
                        <mx:TabNavigator borderStyle="solid">
                                  <mx:VBox y="71"
                                                       width="371"
                                                       height="334"
                                                       label="Dow Jones"
                                                       chromeColor="#0A741C">
                                            <mx:Image id="loader1"
                                                                  source="http://dl.dropbox.com/u/8861424/stock1.png" />
                                            <mx:RichTextEditor id="myRTE"
                                                                                       width="355"
                                                                                       height="286"
                                                                                       borderVisible="true"
                                                                                       color="#000000"
                                                                                       text="Enter Stock Comment" />
                                  </mx:VBox>
                                  <!-- Second pane of TabNavigator -->
                                  <mx:VBox label="SandP"
                                                       width="500"
                                                       height="350">
                                            <mx:Image id="loader2"
                                                                  source="http://dl.dropbox.com/u/8861424/Untitled.png" />
                                            <mx:RichTextEditor id="myRTE2"
                                                                                       width="355"
                                                                                       height="286"
                                                                                       borderVisible="true"
                                                                                       color="#000000"
                                                                                       text="Enter Stock Comment" />
                                  </mx:VBox>
                                  <!-- Second pane of TabNavigator -->
                                  <mx:VBox label="Nasdaq"
                                                       width="500"
                                                       height="350">
                                            <mx:Image id="loader3"
                                                                  source="http://dl.dropbox.com/u/8861424/stock2.png" />
                                            <mx:RichTextEditor id="myRTE3"
                                                                                       width="355"
                                                                                       height="286"
                                                                                       borderVisible="true"
                                                                                       color="#000000"
                                                                                       text="Enter Stock Comment" />
                                  </mx:VBox>
                        </mx:TabNavigator>
              </mx:Panel>
    </mx:Application>

  • Pro not opening after i enter my user and password

    pro not opening after i enter user and pass

    This is NOT Adobe support, this is a user to user forum with the space supplied by Adobe... and you do not provide enough information for anyone here to help
    Provide ALL of the information asked for in the PPro Information FAQ http://forums.adobe.com/message/4200840

  • Fonts do not display after update

    I just updated with the most recent release of Lion and now certain fonts do not show up on web sites and in some applications, including Apple's own iCal! 
    Can someone help!!

    Restart your Mac and immediately hold down the Shift key when you hear the startup chime to boot into Safe Mode. Keep holding the Shift key until you see a progress bar towards the bottom of the screen. You can let go of the Shift key at that point.
    OS X asks you to log in (you will get this screen on a Safe Mode boot even if your Mac is set to automatically log in). Let the Mac finish booting to the desktop and then restart normally. This will clear Font Book's database and the cache files of the user account you logged into in Safe Mode.
    When back at the desktop from a normal startup, close all running applications. From an administrator account, open the Terminal app and enter the following command. You can also copy/paste it from here into the Terminal window:
    sudo atsutil databases -remove
    Terminal will then ask for your admin password. As you type, it will not show anything, so be sure to enter it correctly.
    This removes all font cache files. Both for the system and the current user font cache files. After running the command, close Terminal and immediately restart your Mac.

  • Fonts aren't working after update

    I recently updated my software and now my fonts don't work. Im not even sure what i updated, i know itunes and some system related upgrade. Adobe programs, quark and word all only show system fonts now but font book still shows all the other fonts and they look ok... I tried replacing them, and still they don't work. Any ideas?

    You didn't say what it was you tried, so pardon if I repeat something you already did:
    Restart your Mac and immediately hold down the Shift key when you hear the startup chime to boot into Safe Mode. Keep holding the Shift key until you see a progress bar towards the bottom of the screen. You can let go of the Shift key at that point.
    OS X asks you to log in (you will get this screen on a Safe Mode boot even if your Mac is set to automatically log in). Let the Mac finish booting to the desktop and then restart normally. This will clear Font Book's database and the cache files of the user account you logged into in Safe Mode.
    Not done yet. Now do this:
    Close all running applications. From an administrator account, open the Terminal app and enter the following command. You can also copy/paste it from here into the Terminal window:
    sudo atsutil databases -remove
    Terminal will then ask for your admin password. As you type, it will not show anything, so be sure to enter it correctly.
    This removes all font cache files. Both for the system and the current user font cache files. After running the command, close Terminal and immediately restart your Mac.

  • How can I read the last cell of a JTable that a user Enters data

    I have a one column JTable with several rows that a user enters data to. Upon entering the last data, the user clicks a button to read all the data from the rows in the JTable and puts them in an arraylist. If the user does not click enter or navigates away from the last cell, then after clicking the button it does not read the last cell entered. Since the user is clicking on a button to indicate he is done entering data on the table, does he also have to hit the enter key to indicate he is done entering the data?
    The code below is my tablemodelListener:
    public class InteractiveTableModelListener implements TableModelListener {
    public void tableChanged(TableModelEvent evt) {
    if (evt.getType() == TableModelEvent.UPDATE) {
    int row = evt.getFirstRow();
    System.out.println("Update row:"+" "+row);
    jTable1.setRowSelectionInterval(row, row);
    }

    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
    In the future, Swing related questions should be posted in the Swing fourm. (This question has been asked and answered dozens of times).
    But there is not need to repost because [Table Stop Editing|http://www.camick.com/java/blog.html?name=table-stop-editing] explains whats happening and give a couple of solutions.

  • Can you create a user entered text field that flows content in a subform?

    I am working on a conversion project taking a document library of over 600 forms from Word into PDF, for the most part it's simple and binding fields to the database schema and using subforms is working quite well - however, there are some instances where there is a combination of user entered fields mixed with database fields and in some cases the end user fields are all there are but the amount of content can vary from 250 characters to thousands.  The project manager wants a PDF that enables users to enter whatever amount of text they need to and have the form layout function the way it does as if all fields were populated by the database - I don't know of a way to make that work unless content is entered in the schema first (or implement CM and have all users working in LiveCycle, but the database uses PDF, sothat's not an option right now).
    If anyone has any ideas how to make these things work I would greatly appreciate hearing about it.
    Thank you so much,
    R

    Hi,
        If you can post your form in the post, I can have a look at it and provide my feedback.
        I created a sample file for your reference..
        1) The Content property for the Page1 was set to Flowed.
        2) Each text box is placed inside a Subform which is also has the content property set to Flowed.
        3) In the Form Properties, under the Default tab, set the PDF render format as Dynamic XML form.
        4) In the Form Properties, under the Preview tab, set the Preview Type as "Interactive Form" and Preview Adobe XML Form as "Dynamic XML form". (this step is for the previewing the PDF in the designer).
        5) Finally save the form as Dynamic XML form. (File Menu -> Save As).
    Hope this helps.
    If you still have issues, please post your form..
    Thanks
    Srini
    Please find the sample file at the below location
    https://acrobat.com/#d=qQohvZGsJrky-sTdPTJbzA

  • User-entered field treated as read-only

    I created a large form in version 7. I brought it into version 8 to work on it some more. I believe this may be related to going from 7 to 8...
    I have lots of numeric fields in rows and columns. All the fields are User Entered - Optional. When I view it in Preview, one field in the middle will not allow entry. It's as if the field were Read Only. I go back to Design mode and the field is still listed as User Entered. This occurs on a few pages.
    Anyone else had this problem? Any suggestions?

    My office uses Times New Roman as a standard font for all our forms, I dragged several of the most used standard objects into a blank form, altered them to fit our standards and then dragged them back into the standard tab. Much easier than going through the process each and every time you need to pull a field in, fyi. You can also put a script into a field and put it into either the custom tab or create your own tab for personal objects, I find this saves me huge time by not having to re-type scripts over and over.

Maybe you are looking for

  • Accounting entries for excise invoice for purchase returns in J1IS

    Dear Friends 1) I  recorded an excise invoice for  goods receips in J1IEX . The  accounting entry is Input BED a/c   DR Input ECS a/c   DR Input H.css A/c   DR CENVAT clearing   CR 2)  There were  some damaged  items and  same returned to vendor.  I 

  • HT5664 how do you copy the iPhoto library to the hard drive

    I copied some photos onto a DVD and my new iMac won't let me download them into iPhoto.  I don't understand the instructions to download the iPhoto library into the hard drive.  How do I do that?  What do I do once that part is downloaded?

  • Export PDF Workflow with Applescript and CS3

    Hello, I am setting up some PDF workflow with Applescript. On a given moment, as my script runs and after getting some user-input answers to questions in some dialogs, my script tells InDesign CS3 to open the Export Adobe PDF window for the current d

  • Replicat is abending

    This is what i have on source and target: Source db: oracle 10.2.0.4 block size 8K target :db: oracle 10.2.0.4 block size 32K Souce configuration: MGR.prm PORT 7820 USERID ggs_user, PASSWORD ggs_user PURGEOLDEXTRACTS /u01/oracle/ggs/dirdat/ex, USECHE

  • Selecting prod.version before MRP run

    hi all; can any body know about-how  the production version selecting before MRP run? for example: I have a material.it has 2 production version. when I run the MRP, MRP reads first production version(prd vers-1). but I want to select other productio