Adding Custom Fonts to a JTextComponent

I am working on a simpler version of Microsoft's Notepad and I am suppose to give the user a choice of fonts to use. Currently I am using a JTextArea and I know how to change the font style and size using the setFont method, but I have no idea how to give the user the choice through my Font menu item. Any help would be greatly appreciated.

[url http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html]How to Use Menus.
For example to change the size, you write an ActionListener that get the text of the menu item (ie. the font size). Then you convert the numeric String to a Float and use the Font.deriveFont(...) method to reset the font of the text area.
For the style you would need to store the style as the action command and then convert the value as above.

Similar Messages

  • Load custom Font with CSS

    Hi, Experts..
    I have developed an bsp application , I want it to assign a custom FONT, that it not present into Client System. I have modified the CSS Style adding this code:
    @font-face {
         Font-family: “NameFont.ttf”;
         Scr: url(“./PATH _fonts”);
    .classHtml {
         Font-family:”NameFont.ttf”;
    In this mode the font isn’t loaded  into web page. Link reference http://www.w3.org/TR/REC-CSS2/fonts.html#font-descriptions
    If you provide me sample I would be thankful to you.

    1st
    Not sure if I'am right, but the extension must be left.
    Try:
    Font-family: “NameFont”
    2nd
    Try to use an URL, like "http://yourserver.com/path/font.ttf"

  • Using custom fonts in the Navigation pane

    Hi
    I'm using custom fonts in my webhelp. To do this, I created a folder for the web versions of the custom fonts and put it in the same folder as my css. I then added the font face elements to the top of my css (in Notepad). Next I used the custom font name for all the style defined in the css (in Notepad). That makes the content of the topics use the custom font. All good.
    Next, I edited the htt file (in Notepad) to use the name of the custom font. Now the breadcrumbs and topic footer use the custom font. All good.
    Finally, I want to use the custom font in the navigation pane (the text next to the books and page icons). I edited the skn file (in Notepad) to use the custom font. I also added a dependency for my css to the bottom of the skn file. Then I generated the webhelp.
    When I launch the help, the browser (IE) doesn’t allow running scripts or ActiveX controls (this is normal). At this point, the TOC in the Navigation pane looks like it uses the correct font. Once I click to allow IE to run scripts, etc. the font in the TOC changes to something that looks like Times or some default serif font.  So, it appears that something in the javascript is changing the font.
    For good measure, I checked the whtdhtml file and the custom font name is used there.
    Any ideas on what's happening and how to get my custom font to appear in the Navigation pane?
    BTW, I use images only in the toolbar pane (that spans the top of the webhelp window), so I don't need to specify the custom font there.
    Deborah

    Hi William
    I found one error. In the skin file, I had added a dependency to my css. It was missing a slash (/) to point to the correct folder level. Now that I've added that, the TOC displays the same font as the Index, Search results, and the topic (content, breadcrumbs, and footer). So, that's good, but on closer inspection, it looks like Verdana, not my custom font.
    I changed the font in whthost.js to the name of my custom font and generated the help, but it made no difference. I also changed the font and just opened the help without generating and got the same results.
    For your second suggestion, you mean whtdhtml.htm not whtdhtml.js? The custom font is in the lines:
    setFont("Normal", "MyFont","10pt","Black","Normal","Normal","none");
    setFont("Hover", "MyFont","10pt","#004080","Normal","Normal","underline");
    I added the <font> tag to this file, but the tag just shows up as plain text within the webhelp TOC (no matter where I insert it in the file).
    I also tried changing the font to my custom font for the Index body and Search results using the steps in Rick's Skinny on Skins (editing the whibody.htm and whfbody.htm files). When I do this, the serif font appears in the Index body and Search results.
    It seems like the files cannot "see" my custom fonts (which are in a folder at the same level as my css).
    Deborah

  • Using custom fonts in app development?

    Could somebody inform me if it is possible to use custom fonts of choice when developing an app. If so are there any restrictions? I have read that sinds OS 3.2 iPhonesupports custom fonts, ttf and otf  fonts. Is this not the case also  for the ipad? Or am I completely off track?
    If one can add custom fonts do they work along the same lines as embedded webfonts, availale for all users even if they are not  on their ipad?
    I am a media design lecturer looking for correct info for my students who are doing the visual design voor an app.
    Thanks in advance.
    Toronot00

    Hi William
    I found one error. In the skin file, I had added a dependency to my css. It was missing a slash (/) to point to the correct folder level. Now that I've added that, the TOC displays the same font as the Index, Search results, and the topic (content, breadcrumbs, and footer). So, that's good, but on closer inspection, it looks like Verdana, not my custom font.
    I changed the font in whthost.js to the name of my custom font and generated the help, but it made no difference. I also changed the font and just opened the help without generating and got the same results.
    For your second suggestion, you mean whtdhtml.htm not whtdhtml.js? The custom font is in the lines:
    setFont("Normal", "MyFont","10pt","Black","Normal","Normal","none");
    setFont("Hover", "MyFont","10pt","#004080","Normal","Normal","underline");
    I added the <font> tag to this file, but the tag just shows up as plain text within the webhelp TOC (no matter where I insert it in the file).
    I also tried changing the font to my custom font for the Index body and Search results using the steps in Rick's Skinny on Skins (editing the whibody.htm and whfbody.htm files). When I do this, the serif font appears in the Index body and Search results.
    It seems like the files cannot "see" my custom fonts (which are in a folder at the same level as my css).
    Deborah

  • Can I load a custom font onto my iPad2?

    Is it possible to load a custom font (my handwriting, for instance) onto my iPad2? If so, how? Thanks!

    AFAIK it is still not possible to add a font to the iPad. I have not read that the feature was added to iOS 5 so I think it's still not possible.
    You can read this short discussion. I could not get the link to work that is referenced in the one post, but you can check it out and see if it works for you.
    https://discussions.apple.com/message/15010574#15010574
    Leaving feedback can't hurt if you care to do so.
    http://www.apple.com/feedback/ipad.html

  • Custom fonts won't load

    Hello!
    One of my users got CS6 installed a while ago, along with some custom fonts our company uses (called Bliss fonts). I installed the fonts myself, going through the windows Fonts folder - Add fonts. But Photoshop won't load in the fonts. They are nowhere to be found in the fonts list, and when the user opens a picture that contains the font and he tries to edit it, it says that the fonts are not available and PS will do a font substitution.
    I've tried reinstalling the fonts, renaming (adding .old) to some maps accociated with PS (it was about corrupted files, something I found around here) but that didn't solve it either. The fonts are readily available in other programs such as Word and PPT. Does anyone have any tips? We're running WinXP if that's any help.

    Your fonts do not contain proper identification info/ redundant identification info that matches anotehr font and Adobe programs therefore ignore them/ hide them for safety. This needs to be rectified in the font files themselves using a font editing software. Happens a lot when some lazy font designer just slapped in the company logos into a standard font and didn't edit all that stuff...
    Mylenium

  • Issue with adding new fonts in Lion

    I'm trying install two new fonts on my Mac Book Air and cannot get it to allow me to add them to the Font Book. (I've just successfully added the same fonts on to my Mac Book Pro which runs Snow Leopard, so this is definitely a Lion issue.)
    I've created a new font library and then tried adding the fonts to it but it refuses to validate the font saying that '1 serious error was found. Do not use.'  Any ideas of how to remedy this as I urgently need to use the font?
    Many thanks.

    Derp Derp Derp?? TestDerp Then Derpy Derp Derp

  • Adding custom fields to Embedded Search

    Hi All,
    I have read the post [here|How to add custom fields to Embedded Search; about adding custom fields to Embedded Search. I am looking to add Employee Subgroup for use in Talent Management (specifically the STVN SuccessionPlanning component) and wanted to know if anyone can expand on the instructions in the link to add this field.
    It appears to be part of the HRTMC_PERSON search object connector already and while I've done some IMG configuration the field is showing in SuccessionPlanning, but not displaying any data.
    Additionally, I'd be interested in any tips to add information that is not from PA0002 should it be required in the future.
    Many thanks,
    Luke

    Hi Luke,
    I am assuming here that your search request fields are based on HRTCM_CENTRALPERSON search template. To enable your search to work on employee subgroup please do the following
    1) Check if the HRTMC_PERSON Template extracts the data from Infotype 0001 via SPRO node 'Define Search Models and Change Pointer' Extraction Class is 'CL_HRTMC_SEARCH_READ_PA_INFTY'.
    2) Via ESH_COCKPIT, goto Template Modeler and select your custom Software Component and press Edit. Goto roadmap step 5 - Define Requests - where all search request fields are defined. Its using these fields Talent search works.
    3) Select the search request e.g. 'SAP_TALENT_NAKISA', it would then show list searchable attributes in below table. Using 'Add' button select path for PERSK so that it can searched.
    It would look like this once selected
    OBJID(REL_CP_P)->HRTMC_REL_CP_P_209.REL_CP_P(REL_CP)->HRTMC_PERSON.OBJID->HRTMC_PERSON.ORG_ASSIGNMENT
    4) In step SPRO 'Define Search Requests and Search Field Names' , define Employee subgroup field with AliasSearchField = PERSK since thats what is defined in roadmap step 5.
    Hope it helps!
    Regards,
    Ricky Shah

  • Adding custom fields  through SE51

    Hi All!
    This is with regards to adding custom fields through Se51 to standard screens.I had added custom field KNVV-ZZKVGR6 to the screen.
    After drawing the text and I/O buttons.When I activate I am getting an syntax error saying Field KNVV-ZZKVGR6 is defined differently in screen (ABAP/4 field,Dictionary field).
    What does this mean.
    Also if i activate with a SAP standard field instead of the custom it is getting activated.
    But for both the ways I could not able to see the output on the actual transaction.Also the new drawings which i am drawing are in brown color(different form the existing one)
    Please advise.
    regards
    Praneeth

    hi Praneeth,
    what is the program name,screen number you are trying to modify..,and after appending the field <b>ZZKVGR6 to KNVV</b> , now go to table and choose menu <b>Utilities->Data base Utility-></b> now click on  <b>Activate and Adjust the Data base</b>, then try to add the field.
    and are you adding the field from Dictionary (i.e you have option Get From Dictionary in that give KNVV table name it will list the fields, choose zzkvgr6 from it, and place it in your screen.)
    the exit which you are adding should be appropriate one
    or else you won't get the desired results. what is the exit..
    Regards
    vijay

  • "500 internal server error" after adding custom fields to Address page

    I need to display custom fields on the "Addresses" and the "Personal Data" pages. For that, we added custom CI_INCLUDE fields in both PA0006 and PA0002 tables as per instructions below
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/profile/essPersonalInformationUIenhancementwithoutmodification&focusedCommentId=28278867
    we also extended the Badi HRPAD00INFTYUI
    custom fields show up OK in page "Personal Data". However when trying to browse to page "Addresses"
    we get the following error:
    "500 internal server error - com.sap.tc.webdynpro.progmodel.context.ContextException: MappedNodeInfo(DetailView.SelectedInfotype): unknown child node Area8 ".
    "Area8" is one of the custom fields we added in PA0006 (Address infotype).
    any idea what is wrong?  maybe Badi HRPAD00INFTYUI cannot handle 2 infotypes in the same time?
    T.

    Hi Sasu,
    Its clearly saying contect binding error. Have you mapped  correctly from FcComponent to VcComponents.
    FcCompoenets for Model logic.
    Check the mappings correctly.
    If it is complete custom or new field then there will be could of steps.
    1) Reimport the model
    2) map new field to FcComponent
    3) Bind new Fields from Fc to Vc
    Rgds
    -SS

  • While adding custom field in urgent change-Create new field button in AET is not coming

    Dear All,
    we have requirement to add some custom fields in urgent change document. while adding custom fields using AET, create new field button is not coming.
    Thanks in advance. points will be awarded.
    Rahul

    Hi Jignesh,
    Thanks for your valueble inputs, it really helped me to understand the process.
    I checked in Web UI configuration for urgent change document as you mentioned but still that button is not coming.
    In transaction BSP_WD_CMPWB, i have created enh. set: Z_ENHANCEMENT_SET.
    Can you tell what to selelect in application and page popup which comes after selecting Enhance component button. Actually i tried but i am not able to add new record in conf.
    Thanks in advance.

  • CRM 7.0 / IS-U: adding custom fields to Business agreement for replication

    Hello Experts!
    We're working on replication of custom fields from IS-U to CRM 7.0.
    Can you help me with clarification of my understanding of these questions..?
    1) CRM/IS-U mapping tables for buag_main:
    Business Agreement(BUAG_MAIN) is a BO in CRM that corresponds to CRM table CRMM_BUAG and to Contract account in IS-U table FKKVKP.
    Table FKKVKP were enhanced with some z-fields,
    so we are going to enhance corresponding CRM table CRMM_BUAG (or CRMM_BUAG_H) with that new fields..
    But we see that these CRM and IS-U tables have far not the same field structures..
    So, the question: Which crm and is-u tables i should look, enhance and replicate for Business agreement?
    2) Access to Business agreement with possibility to add custom field:
    I couldn't find in Web UI where i can directly edit profile of Business Agreement..
    I've found just access to assignment block "Business agreement" on Account's profile overview page..(Role ServicePRO; Account details).
    There I used AET to add custom field..but I faced with problem when the 1st popup appeared: there was no enhanced object "Business Agreement"..
    Also in role "Utilities IC Agent" i've found "business agreement" profile but there I don't see buttons for adding custom fields..
    So, the question is: Where I can access Business agreement profile to enhance it with custom fields for replication with IS-U?
    3) CRM/IS-U data exchange functions:
    I tend to use tcode CRMC_BUT_CALL_FU:
    for CRM inbound event of BUAG object  - FM CRM_BUAG_MWX_PROCESS_EXT_STRUC..(as template).
    Question: Am I right that it fits my requirement to replicate custom fields from IS-U to CRM?
    Please tell me if you need more information..
    Looking forward to your answers.
    Thank you a lot in advance!
    Kind regards,
    Evgenia

    Hi Gobi,
    Thank you for advice. But:
    I've created fields not by using AET - I used documentation that Nicolas suggested me above.
    I've enhanced tables and structures that were mentioned there with my z-fields for both sides (CRM and ERP).
    Also I looked CRMC_BUT_CALL_FU for CRM Inbound BUAG_MAIN - corresponding standard FMs are marked for call.
    Any ideas?
    Thanks in advance.
    BR,
    Evgenia

  • Custom font [OCR A Extended] not working in Crystal Reports 2008

    We created a report that prints numbers using a font that makes the numbers look the numbers on the bottom of a check book (i.e. a check font). The font used was OCR A Extended.
    On the development machine the font worked well. It printed the numbers with the right font. When we tested the report on another developer's machine that apparently didn't have the OCR A Extended font, the numbers printed using an Arial-looking font - which we didn't like :-(. So we added the font to the machine in the %Windir%\Font directory. Having done this, the report displayed the numbers correctly.
    However, when we deployed the report in production on the app server (as Crystal Reports embedded in a VS 2005 application), the fonts would not get applied despite the fact that we installed the font in the %Windir%\Font directory.
    What else do we need to do to get the font to work correctly?
    Any help would be appreciated...
    Thanks.

    I don't have an answer, but I do have an idea. I am quite sure that the worker process is not seeing the font. E.g.; if you'd use the font in a text box, I'd bet that the font would not show up there either. Probably the best way to figure out what is needed will be to run Process Monitor and see if the logs tell you where the process is looking for the font. You may want to compare working and non working systems (a bit onerous as the logs are large - do ensure you filter for your process to keep the logs as small as possible).
    Oh, Process Monitor is here;
    http://technet.microsoft.com/en-ca/sysinternals/bb896645.aspx
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • Added custom screen in PO using BADI ME_GUI_PO_CUST and ME_PROCESS_PO_CUST

    Hi All,
    I have added custom screen with two z fields at item level using BADI ME_GUI_PO_CUST and ME_PROCESS_PO_CUST i can see my screen in tcodes ME21N , ME22N , ME23N but I am not able to save data.
    and also screen is coming in change mode even in ME23N .
    thanks.

    Hi,
    I have added two xfields at item level.
    This is the code i have added in zimplementation ZME_GUI_PO_CUST .
    IN Zimplementation ME_PROCESS_PO_CUST I have added code only in method FIELDSELECTION_ITEM . after doing this I can see only screens in ME21N, ME22N, ME23N but when enter data in zfields and trying to save it is giving me message no data has changed.
    method IF_EX_ME_GUI_PO_CUST~SUBSCRIBE.
    DATA: ls_subscriber LIKE LINE OF re_subscribers.
    we want to add a customer subscreen on the item detail tab
      CHECK im_application = 'PO'.
      CHECK im_element     = 'ITEM'.
    each line in re_subscribers generates a subscreen. We add one subscreen in this example
      CLEAR re_subscribers[].
    the name is a unique identifier for the subscreen and defined in this class definition
      ls_subscriber-name = subscreen1.
    the dynpro number to use
      ls_subscriber-dynpro = '0001'.
    the program where the dynpro can be found
      ls_subscriber-program = 'SAPLYMEPOBADIEX'.
    each subscreen needs his own DDIC-Structure
      ls_subscriber-struct_name = 'MEPO_BADI_STRUCT'.
    a label can be defined
      ls_subscriber-label = text-001.
    the position within the tabstrib can be defined
      ls_subscriber-position = 4.
    the height of the screen can be defined here. Currently we suport two screen sizes:
    value <= 7 a sevel line subscreen
    value > 7  a 16 line subscreen
      ls_subscriber-height = 7.
      APPEND ls_subscriber TO re_subscribers.
      ENDIF.
    method IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_MODEL.
      DATA: l_item       TYPE REF TO if_purchase_order_item_mm,
            ls_mepoitem  TYPE mepoitem,
            ls_customer  TYPE mepo_badi_exampl.
    system asks to transport data from the business logic into the view
      CASE im_name.
        WHEN subscreen1.
    is it an item? im_model can be header or item.
          mmpur_dynamic_cast l_item im_model.
          CHECK NOT l_item IS INITIAL.
    transport standard fields
          ls_mepoitem = l_item->get_data( ).
    transport customer fields
          CALL FUNCTION 'YMEPOBADIEX_GET_DATA'
            EXPORTING
              im_ebeln = ls_mepoitem-ebeln
              im_ebelp = ls_mepoitem-ebelp
            IMPORTING
              ex_data  = ls_customer.
    store info for later use
          MOVE-CORRESPONDING ls_mepoitem TO dynp_data_pbo.
          MOVE ls_customer-badi_bsgru TO dynp_data_pbo-badi_bsgru.
          MOVE ls_customer-badi_afnam TO dynp_data_pbo-badi_afnam.
        WHEN OTHERS.
      ENDCASE.
    endif.
    method IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_DYNP.
      CASE im_name.
        WHEN subscreen1.
          CALL FUNCTION 'YMEPOBADIEX_PUSH'
            EXPORTING
              im_dynp_data = dynp_data_pbo.
        WHEN OTHERS.
      ENDCASE.
    ENDIF.
    endmethod.
    method IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_DYNP.
      CASE im_name.
        WHEN subscreen1.
          CALL FUNCTION 'YMEPOBADIEX_POP'
            IMPORTING
              ex_dynp_data = dynp_data_pai.
          IF dynp_data_pai NE dynp_data_pbo.
    something has changed therefor we have to notify the framework
    to transport data to the model
            re_changed = mmpur_yes.
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
    ENDIF.
    endmethod.
    method IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_MODEL.
    DATA: l_item       TYPE REF TO if_purchase_order_item_mm,
            ls_mepoitem  TYPE mepoitem,
            ls_customer  TYPE mepo_badi_exampl.
    data have to be transported to business logic
      CASE im_name.
        WHEN subscreen1.
    is it an item? im_model can be header or item.
          mmpur_dynamic_cast l_item im_model.
          CHECK NOT l_item IS INITIAL.
          ls_mepoitem = l_item->get_data( ).
    standard fields changed?
         IF dynp_data_pbo-matkl NE dynp_data_pai-matkl OR
            dynp_data_pbo-plifz NE dynp_data_pai-plifz OR
            dynp_data_pbo-webaz NE dynp_data_pai-webaz.
    update standard fields
           ls_mepoitem-matkl = dynp_data_pai-matkl.
           ls_mepoitem-plifz = dynp_data_pai-plifz.
           ls_mepoitem-webaz = dynp_data_pai-webaz.
            CALL METHOD l_item->set_data( ls_mepoitem ).
         ENDIF.
            CALL FUNCTION 'YMEPOBADIEX_GET_DATA'
              EXPORTING
                im_ebeln = ls_mepoitem-ebeln
                im_ebelp = ls_mepoitem-ebelp
              IMPORTING
                ex_data  = ls_customer.
            ls_customer-badi_bsgru = dynp_data_pai-badi_bsgru.
            ls_customer-badi_afnam = dynp_data_pai-badi_afnam.
            CALL FUNCTION 'YMEPOBADIEX_SET_DATA'
              EXPORTING
                im_data = ls_customer.
         ENDIF.
        WHEN OTHERS.
      ENDCASE.
    ENDIF.
    method IF_EX_ME_PROCESS_PO_CUST~FIELDSELECTION_ITEM.
    DATA: l_persistent TYPE mmpur_bool.
    CONSTANTS:
    FIELD-SYMBOLS: <fs> LIKE LINE OF ch_fieldselection.
    l_persistent = im_item->is_persistent( ).
    *IF l_persistent EQ mmpur_yes.
    READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY
                         metafield = MMMFD_YYMAN_NUM."fd_cust_01.
    IF sy-subrc IS INITIAL.
    <fs>-fieldstatus = '*'. " Display <-- this one was as per the sample code given.
    <fs>-fieldstatus = '+'. " Input <-- this i added to make the field mandatory.
    ENDIF.
    READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY
                         metafield = MMMFD_YYMAN_DES."fd_cust_01.
    IF sy-subrc IS INITIAL.
    <fs>-fieldstatus = '*'. " Display <-- this one was as per the sample code given.
    <fs>-fieldstatus = '+'. " Input <-- this i added to make the field mandatory.
    ENDIF.
    *ENDIF.
    ENDIF.
    endmethod.

  • How to set custom font family in qml label in black berry 10 os

    how to set custom font family in label text  qml in black berry 10 OS

    AFAIK, this is not the correct way to set the image location.
    We call the working directory as context, so inside the context root along with WEB-INF, maintain a folder with name img and put all the images in that directory.
    You can use either .\<image_folder> or the optimum way would be (if you are using JSPs) to use getContext() method and traverse accordingly.
    FYI,,, using getContext() will give you context root directory, from there it is as simple as accessing any other folder.
    Hope this answers your question.
    Cheers,
    Jeets.

Maybe you are looking for