Font size in a TextField

Hello !
I'm using a javax.microedition.lcdui.TextField to enter a few digits.
These digits were shown very small...
Is there any way to change the font-size in the text field?
Greetings
Micha

The font size is set by the implementation of the text field. So it may be one size on one device and another size on a different device. Each device's implementation should normally have the appropriate text size for the size of its display and it should match the size of all of the other text on the device.
So to answer your question, it is not possible to change the font size within a TextField. If you want more control over things like that, then you need to create your own components by extending CustomItem or Canvas.
You will find that once you try your application on another device it will look better anyway.

Similar Messages

  • Change Font Size TextFormat in TextField

    Project: Simple Click Counter of two separate buttons.
    Problem: Font size of clicks needs to be changed/increased.
    link to .fla
    Not sure where to place this code in the script below.
    (inserting it causes font to initially to be correct size of 20 but changes back to default when a mouse click is issued)
    var myFormat:TextFormat = new TextFormat();
    myFormat.size = 20;
    fl_TF.setTextFormat(myFormat);
    var myFormat:TextFormat = new TextFormat();
    myFormat.size = 20;
    fl_TF2.setTextFormat(myFormat);
    Script without myFormat:TextFormat applied.
    var myVar=0;
    var myVar2=0;
    button_1.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);
    button_2.addEventListener(MouseEvent.CLICK, fl_ClickToPosition2);
    var fl_TF:TextField
    var fl_TF2:TextField
    fl_TF = new TextField();
    fl_TF2 = new TextField();
    fl_TF.autoSize = TextFieldAutoSize.CENTER;
    fl_TF2.autoSize = TextFieldAutoSize.CENTER;
    fl_TF.textColor = 0xffffff;
    fl_TF2.textColor = 0xffffff;
    fl_TF.background = false;
    fl_TF2.background = false;
    fl_TF.border = false;
    fl_TF2.border = false;
    fl_TF.x = 102;
    fl_TF2.x = 102;
    fl_TF.y = 85;
    fl_TF2.y = 255;
    fl_TF.text = String(myVar);
    fl_TF2.text = String(myVar2);
    addChild(fl_TF);
    addChild(fl_TF2);
    function fl_ClickToPosition(event:MouseEvent):void
         myVar++;
         fl_TF.text = String(myVar);
    function fl_ClickToPosition2(event:MouseEvent):void
         myVar2++;
         fl_TF2.text = String(myVar2);
    Any help is greatly appreciated
    Thank you

    The setTextFormat method applies the formatting to the text in the textfield, not the textfield itself.  So when you rewrite the text in it, you basically revert back to the default formatting.  You would need to use the setTextFormat each time you write text to the textfield(s).  If the intention is to always have the text be size 20, then you can modify the default formatting instead, right after you instantiate the two textfields....
    var fl_TF:TextField = new TextField();
    var fl_TF2:TextField = new TextField();
    var myFormat:TextFormat = new TextFormat();
    myFormat.size = 20;
    fl_TF.defaultTextFormat = myFormat;
    fl_TF2.defaultTextFormat = myFormat;
    (note: you didn't need to define two formats by the same name)

  • Trying to figure out how to get font sizes in textfield to show up right

    This is a flash question it just gets a little complicated.
    Running into a cross platform problem.
    I have a microsoft .NET application that I created to draw graphics. I put the properties of the drawn object into a database.
    I then read the properties into flash and dynamically build the objects that were drawn in microsoft.net with actionscript.
    The problem I'm running into is I'm using the Microsoft gdi+ model to draw text in my development environment with a specific font size in points.
    When I translate that over into flash, my runtime environment the font size appears smaller.
    Note:
         I'm using a textfield object and setting the htmltext property to create the text.  Then I'm using the bitmapdata object to convert
    the textfield into a bitmap.  I do this for a couple of reasons.
    I can get the fonts to match closely If I multiply the font size of the textfield by 1.50.
    For example
    var fontsize:number = DatabaseFontsize * 1.50;
    this gets my fontsize close for the textfield.
    However with certain fonts this does not work.   Any help would be appreciated
    Am I posting this in the wrong place??

    I'm having very similar issues to LarryET above. I followed the directions from TominqueBo_VZW, but I could uninstall the updates only. Even uninstalling those and reinstalling them, I have no improvement. My greatest issue is the lack of pictures from the contacts. Some show, others don't with no discernable common thread.

  • Changing font/-size of a text field on master-pages not possible? (field prop)

    Hi,
    I would like to change the font and font-size of a textfield on a master page.
    I wonder if I do anything wrong, because the font-options (size, font etc.) are simple greyed out / not avaliable, when I click on my text field.
    It seems, there is any way to customize the font-properties of a textfield (only) on master-page.
    Well I guess it would work with java script in init-event ...  but really, why the hell it should not be possible simply to use the properties/text properties?!
    Please correct me if I am wrong. Do I do anything wrong or is it really not possible to customize font of a text field on master pages?

    Hi,
    I was just about to post, that I figured it out.
    Actually, I use Livecycle Designer in SAP (transaction SFP). There seems to be a bug (one of hundrets by the way).
    If I click on a field, that does not have text-property e.g. subform, text-option menu greys out.
    Afterwards it stay this way until I click/doubleclick into a simple text (not text field). From that moment on, text/font-option menu is available again, until I click on something without text. => So pay attention and click wisely
    coming soon: "SAP meets Livecycle Designer - a (Bug)Lovestory", hardcover 124 Pages. ; )
    by the way: SAP does not sopport interactive forms higher than Reader 8.1. Its statement "8.1 is fine enough for everything you need in a SAP/Adobe Interactive Form". So beware of using XFA higher than in 8.1. sad, but true ...

  • Dynamically sizing a group of textfields based on font size

    Hi,
    I have made a UI control which contains a bunch of TextFields representing the members of an Array. I draw these un a list like in a combo box's drop down. Currently I hard code the height of the TextFields, iterate through the Array and position the TextFields by adding the hard coded height each time. Simple enough.
    But now I would like to put the control in another place where I must use smaller text. So I would like to make the thing general so I can resuse it whenever I want, simply by applying a new TextFormat. My problem is that I want to still be able to position the TextFields accurately regardless of the font size used in the TextFormat. I have tried just creating the TextField, applying the TextFormat, setting the text, and then trying to read the TextField's height, but alas this does not work.
    Can anyone please tell me what the best way is to find each TextField's height so that I can build my list?
    Thanks!

    You can check to see if the (maxscroll >1)== true (text extends beyond visible area), and if it is, then set size smaller,

  • Change the "Font size" in a TLF Textfield with actionscript?

    I could not realize how should I resize my TLF Textfiels in flash cs6 with actionscript??
    None of these worked:
    if (....)
         myTLFText.textSize++;
         myTLFText.fontSize++;
    Error: Access of possibly undefined property size through a reference with static type fl.text:TLFTextField.
    I appreciate your kind help please??

    Here is the part of code I am using to resize the textfield (and other elements).
    /******SET POSITION**********/
    function setPosition():void
          //Position appBG
          appBG.height = stage.stageHeight;
          appBG.width = appBG.height;
          //Fit the appTXT in middle of screen  (AppTXT is a MovieClip contains sourceText - RTLTextField)
          appTXT.sourceText.width = stage.stageWidth * 0.9;
          appTXT.sourceText.x = stage.stageWidth * 0.05;
          appTXT.sourceText.y = stage.stageHeight * 0.1;
          //Fit the maskText layer on top of text;
          maskText.width = appTXT.sourceText.width;
          maskText.height = stage.stageHeight * 0.8;
          maskText.x = stage.stageWidth * 0.05;
          maskText.y = stage.stageHeight * 0.1;
          //Set buttons in their proper position
          if (stage.stageWidth > stage.stageHeight)
                appBG.width = stage.stageWidth;
                appBG.height = appBG.width;
          appBG.x = stage.stageWidth / 2;
          appBG.y = stage.stageHeight / 2;
    Everything works fine, but when I install the apk on my Google nexus (800x1280), the font size looks VERY SMALL and I can hardly read it!
    If I increase the Font size pt (Red Arrow in above PrntScr) to 40. then it reads perfect on phones with 800x1280 screen size. Ok?  But then any OTHER smaller screen cell phones will see the font TOO BIG!
    So I need to set the Font size pt by CODE based on a percent of stageWidth to could solve this. thx.

  • Font size and Colr

    Here is a simple program just for demonstration.
    I would like to change the font size and color of this program to SMALL and
    RED respectively(when I install it in my handset, it does not fit in the screen
    properly). I have tried read the Font in the midp api but am not getting it; its just talking
    about I don't know Canvas and such kind of stuff.
    Please could someone just help me with this program just as a demonstration
    so I could know exactly how to go about it. Thanks in advance.
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class AddTwoNum extends MIDlet implements CommandListener
         Display display;
         Form mainForm = new Form("Summation of Numbers");
         TextField firstNum = new TextField("First Number", "", 15, TextField.NUMERIC);
         TextField secondNum = new TextField("Second Number", "", 15, TextField.NUMERIC);
         TextBox sumBox;
         Command exitCommand = new Command("Exit", Command.STOP, 1);
         Command calCommand = new Command("Calculate", Command.SCREEN, 2);
         public AddTwoNum()
         public void startApp() throws MIDletStateChangeException
              display = Display.getDisplay(this);
              mainForm.append(firstNum);
              mainForm.append(secondNum);
              mainForm.addCommand(exitCommand);
              mainForm.addCommand(calCommand);
              mainForm.setCommandListener(this);
              display.setCurrent(mainForm);
         public void pauseApp()
         public void destroyApp(boolean unconditional)
              notifyDestroyed();
         public void commandAction(Command c, Displayable d)
              if (c == exitCommand)
                   destroyApp(true);
              else if (c == calCommand)
                   int first, second, sum;
                   first = Integer.parseInt(firstNum.getString());
                   second = Integer.parseInt(secondNum.getString());
                   sum = (first + second);
                   sumBox = new TextBox("Summation", "The summation is\n"+sum, 25, TextField.ANY);
                   sumBox.addCommand(exitCommand);
                   sumBox.setCommandListener(this);
                   display.setCurrent(sumBox);
    }

    only StringItem supports setFont(Font) method. if you want the Font support for TextField
    and TextBos, you should implements it !
    or write your own CustomItem
    good luck

  • Calculating maximum font size

    Okay, I have a JTextField with wrap on. It's setEditable(false). The string in it is going to be changing constantly and the field has a fixed size. I'm trying to come up with a method that will determine the maximum sized font that will be able to fit in the TextField without requiring a ScrollPane.
    I'm not quite sure where to start on this one. I'm sure I can come up with a calculation involving font point size and FontMetrics.stringWidth() but I can't figure it out. Any ideas would be helpful.

    hi
    * Computes a correct font size to use for the text of this component.
    private void computeFontSize()
        int height = getSize().height;
        int width  = getSize().width;
        if (current_font != null) //this will be the font the component is currently showing
                // need to create a brand new Font everytime to see if the
                // stringWidth fits into our current width.
                // We can check height by pixels, but sadly need to create a new font
                // for checking the width.
                Font tempFont = new Font(current_font.getName(), current_font.getStyle(), height);
                FontMetrics fm = getFontMetrics(tempFont);
                if (fm != null)
         int textWidth  = fm.stringWidth(getText());
                         if (textWidth > getSize().width)
                                // Text doesn't fit horizontally; scale it down a bit.
                                // (stop div by zero errors)
                                if (textWidth < 1)     
                                         textWidth = 1;
                                int newFontHeight = (height * width) / textWidth;
                                if (newFontHeight != current_font.getSize())
                                      current_font = new Font(current_font.getName(), current_font.getStyle(), newFontHeight);
                         else if (tempFont.getSize() != current_font.getSize())
                               current_font = tempFont;
               tempFont = null;
               fm = null;
    }this code was taken from a homegrown label component that scales its own font based on its size.
    There is enough here for you to work out what you need.
    If it meets your needs, don't be shy with the dukes
    nes

  • Is it possible to change the font and font-size in Richtooltip?

    Hiya,
    For "RichTooltip" I'd like to change the font and/or font-size is that possible?
    Is it possible to change the size of the tooltip box so that it is wider?
    Currently my tooltip looks quite ugly:
    I tried reading the help but I couldn't find a way to do this using the API for sap.ui.commons.RichTooltip
    Thanks in advance!

    Hi,
    you can use something like this for formatted text.
    <script>
                var oTextField = new sap.ui.commons.TextField({
                      valueState : sap.ui.core.ValueState.Error
                }).placeAt("content");
                var sHtml = "The rating specifies the trustworthiness of the account. You can choose between the following values:<br>";
                sHtml += "<ul>";
                sHtml += '<li><strong>A:</strong> <font color="blue", size ="2px" family="Helvetica">Highly trustworthy</font></li>';
                sHtml += "<li><strong>B:</strong> In generel trustworthy but some weak moments</li>";
                var oRttTextField = new sap.ui.commons.RichTooltip({
                      text : sHtml
                oTextField.setTooltip(oRttTextField);
                </script>
          </head>
          <body class="sapUiBody" role="application">
                <div id="content"></div>
          </body>
    Refer this link.
    RichTooltip - SAPUI5 Demo Kit
    Best Regards
    Dhananjay

  • Chaging fonts and fonts size of controls

    Dear All,
    I have faced one problem for changing the fonts and font size for the controls. I have used
    For changing fonts:-
    Textfield.font.typeface="Fontname";
    For changing Size:-
    Textfield.font.size="100pt";
    But I have used the code for changing the color of the fonts. And it works fine.
    Textfield.fontColor="0,183,0";
    So, Please help for solving the problems of changing fonts size and fonts.
    Thank you

    Why would you want to change the font and font size programmatically?
    Can you describe why you are doing this ..perhaps there is a better approach.

  • On click Increase/Decrease Font size

    Morning Everyone.
    I have a presentation that is filled from an XML file. All
    the text boxes are dynamic, loops go through and populate clips and
    what not.
    I want to add a function, that if they click on the big "A"
    it increases the Font size by 1 pt. so 12pt>13pt The little"a"
    would Decrease the font size. 13pt>12pt.
    To start, I just want to increase/decrease by 1 pt. but if
    later I can make it so each click increases/decreases that would be
    ideal.
    Not sure if this is possible, but I wanted to toss the
    question out there as I do my own research as well.
    Appreciate it!
    Tim

    You can use the getTextFormat() method to retrieve the
    current formatting of any given textField. To get just the current
    font size, you can use this:
    var myTextFormat:TextFormat =
    textInstanceName.getTextFormat();
    var currentSize = myTextFormat["size"];
    Then you could create a new text format object to hold the
    new value:
    var newTextFormat:TextFormat = new TextFormat();
    and then set a new value for the size property of the new
    format:
    if (currentSize == 12) {
    newTextFormat.size = 13;
    } else {
    newTextFormat.size = 12;
    finally apply the new format to your textfield:
    textInstanceName.setNewTextFormat(newTextFormat);
    since the only new information is the size, that's the only
    thing that will change.

  • How can I add more than one same spry menu (eg. collapsible menu)  with in different styles (font size, color, background, etc) on current page?

    How can I add more than one same spry menu (eg. collapsible menu)  with in different styles (font size, color, background, etc) on current page?

    Hi Nancy,
    This screenshot was only for imagination. A part of the code (not all) is below.  In the code there are some background images but they are not seem in live mode.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="css/my_site.css" rel="stylesheet" type="text/css" />
    <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css"/>
    <link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
    <style>
    #CollapsiblePanel1 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-color: #003366;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel1 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        line-height: 52px;
    #CollapsiblePanel1 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        line-height: 52px;
    #CollapsiblePanel2 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-image: url(images/international.jpg);
        background-repeat: no-repeat;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel2 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel2 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        background-image: url(images/TR_Gray2-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel2 .CollapsiblePanelContent {
        background-color: blue;
    #CollapsiblePanel3 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel3 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel3 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        background-image: url(images/TR_Gray2-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel4 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel4 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel4 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        background-image: url(images/TR_Gray2-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel5 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel5 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel5 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        background-image: url(images/TR_Gray2-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    </style>

  • How to change font size in iCal

    How do I change the font size in iCal?  When I go to print the monthly calendar, it is so small I can't read it.  But for the life of me I can't find where to change the size!

    earlnkids,
    The text size selection should be available in the first page of the iCal print options:

  • How does one change the font size for folders and/or file lists in the Bookmarks Library?

    How does one change the font size for folders and/or file lists in the '''Bookmarks''' Library?
    Since the upgrade to version 9.0.1 of Firefox, the Bookmarks feature changes are confusing me. They seem to be confusing themselves as well. The list of bookmarks has changed. The font size is so small that my aging eyes cannot read it without fogging the screen with my breath. Some folders are out of alphabetical order (where I know they were previously good), and some are missing altogether (folders to which I frequently add references).
    As for missing or deranged files or folders, was there something that I should have done or now need to do to recover those after the upgrade (or before)?
    With regard to font size,
    1. there is no “Edit Bookmarks” or like option to edit the list in this version
    2. the “zoom” option in the “view” list of functions is greyed out when in “Show All Bookmarks” window
    3. expanding the browser window has no effect on font size
    4. “Preferences” settings for font size has no effect in that window either, including advanced settings
    5. “Help” offers none that I can find.
    Can any of you Help?!?

    Maybe this extension helps:
    *Theme Font & Size Changer: https://addons.mozilla.org/firefox/addon/theme-font-size-changer/

  • How do I edit font size in acrobat 8?

    I am trying to make edits to the font and font size in acrobat 8. I have clicked on the text toolbar under advanced editing and selected my text. All of the forums I have read say to right click on that text and select "properties." When I right click, my acrobat does NOT give me the option for properties. The closest option is "text style" which does not give me any font or font size options - only bold, underline, etc. Can anyone assist me in where I ca find these options or why it is not giving me the "properties" option?

    Select the text and type ctrl-e

Maybe you are looking for