How to align RichTextField Center?

Hey all,.

Been picking at it for some time, using solutions found on many forums. Unable to do things. I have this simple on screen in my application, and I want just all the lines of the text to be centered on the screen horizontally and vertically too if it works. What I'm doing wrong here?

package com.rim.samples.device.helloworlddemo;

import net.rim.device.api.system.Display;
import net.rim.device.api.ui.DrawStyle;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.component.RichTextField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

public class AboutScreen extends MainScreen {

    /**
     *
     */
    public AboutScreen() {
        super(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR);

        VerticalFieldManager vfm = new VerticalFieldManager(USE_ALL_WIDTH | FIELD_HCENTER){
            protected void sublayout(int maxWidth, int maxHeight) { 

                super.sublayout(Display.getWidth(),Display.getHeight());
                setExtent(Display.getWidth(),Display.getHeight());

            } 

        };
        vfm.add(new RichTextField("Lead Developer - Xxxx Xxxxxxx", Field.NON_FOCUSABLE |            Field.FIELD_HCENTER));
        vfm.add(new RichTextField("For Support - [email protected]", Field.NON_FOCUSABLE |     Field.FIELD_HCENTER));
        vfm.add(new RichTextField("Follow us on Twitter - @xxxxxxxxxx", Field.NON_FOCUSABLE |   Field.FIELD_HCENTER));
        vfm.add(new RichTextField("Version - 1.0.0", Field.NON_FOCUSABLE | Field.FIELD_HCENTER));
        add(vfm);

    }

}

Thank you

Theodore M.

K so I finally solved easily using the following property in each object - RichTextField

RichTextField.TEXT_ALIGN_HCENTER

And that solved everything.

Tags: BlackBerry Developers

Similar Questions

  • Something so simple does not work for me... How to align text Center

    www.bristolequestrianservices.co.UK/salespage/HTML.

    This focuses in Design view, but not on the web.  Launch and reduced to clear offer should be centered.

    {.saleCentre}

    font-size: 20px;

    Color: #FF0000;

    text-align: center;

    }

    To center text in a defined tag span tag to display: block;

    So add - display: block; -at the "saleCentre" css class

    Or better yet use a tag header and style that:

    LAUNCH OFFER

    H2 {}

    text-align: center;

    font size: 20px;

    color: Red;

    margin: 0;

    Padding: 15px 0;

    }

  • How to align the dialog box in the center of a popup programmatically

    Hey,.

    I use jdeveloper 11g release 2.

    Can someone help on how to align the dialog box programmatically a popup?

    Kind regards

    Steve

    Hello

    As far as I know, if we do not have indications of the dialog then displays on the center of the screen by default.

    This will solve your problem?

    Gud luck!

    HA

  • How to align the text to the right in the text filed using Adobe Acrobat Pro?

    How to align the text to the right in the text filed using Adobe Acrobat Pro? I am able to align the text box, but not the alignment of the text with the deposited text.

    In the Options tab of the field properties dialog box, you can choose left, Center, or right alignment.

  • How to align the position of a node in a pane of the grid using CSS?

    Hello

    I have an interface defined in FXML:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <?import java.lang.*?>
    <?import javafx.scene.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    
    <BorderPane xmlns:fx="http://javafx.com/fxml" >
        <center>
            <GridPane alignment="top_center" hgap="8" prefWidth="450" vgap="8" style="-fx-padding: 10;" >
                <styleClass>
                    <String fx:value="form"/>
                </styleClass> 
                        
                <children>
    
                    <Label text="From" GridPane.columnIndex="0" GridPane.rowIndex="0" />
                    <TextField fx:id="from" GridPane.columnIndex="1" GridPane.rowIndex="0"/>
    
                    <Label text="Recipient(s)" GridPane.columnIndex="0" GridPane.rowIndex="1" />
                    <TextField fx:id="recipients" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
                    
                    <Label text="Subject (defaults to title)" GridPane.columnIndex="0" GridPane.rowIndex="2" />
                    <TextField fx:id="subject" GridPane.columnIndex="1" GridPane.rowIndex="2"/>                   
                    
                    <Label text="Send mail as ..." GridPane.columnIndex="0" GridPane.rowIndex="3" />
                    <ListView fx:id="mail_format" prefHeight="100" GridPane.columnIndex="1" GridPane.rowIndex="3" />  
                    
                    <Label text="Plain Text Mail" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="center" GridPane.rowIndex="4" />                  
                    
                    <Label text="Template" GridPane.columnIndex="0" GridPane.rowIndex="5" />
                    <TextField fx:id="plain_template" GridPane.columnIndex="1" GridPane.rowIndex="5"/>                
                                      
                    <Label text="Send as is (do not dump into plain text)" GridPane.columnIndex="0" GridPane.rowIndex="6" />
                    <CheckBox fx:id="plain_noconvert" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
                    
                    <Label text="HTML Mail" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="center" GridPane.rowIndex="7" />
                                    
                    <Label text="Template" GridPane.columnIndex="0" GridPane.rowIndex="8" />
                    <TextField fx:id="html_template" GridPane.columnIndex="1" GridPane.rowIndex="8"/>               
    
                    <Label text="Other configuration" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="center" GridPane.rowIndex="9" />
                    
                    <Label text="Reply-To" GridPane.columnIndex="0" GridPane.rowIndex="10" />
                    <TextField fx:id="reply_tos" GridPane.columnIndex="1" GridPane.rowIndex="10"/>
                    
                    <Label text="Cc" GridPane.columnIndex="0" GridPane.rowIndex="11" />
                    <TextField fx:id="ccs" GridPane.columnIndex="1" GridPane.rowIndex="11"/>
                    
                    <Label text="Bcc" GridPane.columnIndex="0" GridPane.rowIndex="12" />
                    <TextField fx:id="bccs" GridPane.columnIndex="1" GridPane.rowIndex="12"/>
                    
                    <Label text="HTML base (defaults to current server)" GridPane.columnIndex="0" GridPane.rowIndex="13" />
                    <TextField fx:id="html_base" GridPane.columnIndex="1" GridPane.rowIndex="13"/>
                                                                                                                   
                    
                </children>
            </GridPane>
        </center>
    </BorderPane>
    I want to align the labels to right using CSS:
    .form *.label {
      -fx-alignment: right;
      -fx-font-weight: bold;
      -fx-hpos: right;
      -fx-text-alignment: right;
      -fx-text-wrap: true;
    }
    However I have not found any way to align the labels in the GridPane using CSS, or - fx-alignment: right, - fx-node-hpos: right. -fx-hpos: right. -fx-text-alignment: seem to work well...


    The only way to make it work is to define the attribute of each label Grid.halignment:
                    <Label text="HTML Mail" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="right" GridPane.rowIndex="7" />
    But what happens if I want to change that at a later stage-> I need to change this attribute for each node.


    How can align the labels to right using CSS only?

    Currently CSS in JFX cannot really be used for layout page (or calibration). This is one of those grey areas between what is style (which should be in the CSS) and what is layout (which should be in the FXML). I think I remember Richard mentioning once in a forum or an article that he did not want to add alignment stuff to the CSS at a certain point, but don't quote me on that. You might have a search through Kenai to see if there is a feature request for it and if not add one.

    Perhaps you could it with fake labels stretch to fill the available space in the GridPane. For this, you need to disable the restriction of maximum size (setMaxWidth and setMaxHeight to Integer.MAX_VALUE) and ensure your forced GridPane are such that the label will fill the cell. Once you have a stretched label alignment will come into play as the text is aligned relative to the area of the label (as opposed to a manager that aligns the entire label compared to its parent). I think that put a border on the label when debugging to work on what's going on.

    Another less confined but more flexible alternative might be to use variables in your FXML files. You can do this in a number of ways. We must create a bean that has all the variables of your on it with accessors get and then you can move it to your charger FXML namespace and then reference it by using things like ${myConstants.gridAlignment}. Another is to create static methods on a class that a node, these can then be called from the FXML using a notation similar to GridPane.alignment. This second approach only works for things where you want to work directly on the node, but for your scenario which should be ok I think. And then there is always the option to activate a script language in your FXML, allowing you to perform more nothing.

    Hope that helps,
    zonski

  • How to configure security center than antivirus program is installed when installed in 32-bit vista sp 1.

    could someone tell me how to configure Security Center that I install the basics of security of microsoft and anti virus program installed sercurity interface of Green Center but in section proformance and monitor system health report in the warnings section, it says not installed or antivirus detected please someone help like it _ me off thx.soz.

    It comes with Vista, upgrade install and activate Forum.

    Microsoft Security Essentials questions should be directed to the MSE Forums:

    http://social.answers.Microsoft.com/forums/en-us/msestart/threads

    Installing and upgrading Microsoft Security Essentials program.

    http://social.answers.Microsoft.com/forums/en-us/msescan/threads

    Analysis, detection and removal of threats

    http://social.answers.Microsoft.com/forums/en-us/mseupdate/threads

    Update the definitions of spyware and viruses

    See you soon.

    Mick Murphy - Microsoft partner

  • How to align the c4100 series ink cartridge

    I have problems hologram out, so far I did 8 pages of alignment, and they look the same all OK for me, now I'm trying to align the cartridges.  My laptop uses windows 8.1.  How to align the cartridges.

    Thanks in advance.

    Hi @lyjonne

    You can install the full software features and use the Printer Wizard to align the cartridges, or you can use the printing and scanning doctor.

    Use this link to download and run the HP printer install wizard for Windows

    The HP printer for window installation wizard was created to help Windows 7, Windows 8, and users Windows 8.1 download and install the latest and most appropriate HP software solution for their HP printer.

    Or click here to download and run the printing and scanning doctor > www.hp.com/go/tools

    As you can see the Print and Scan Doctor allows you to print a page, to perform the alignment, to clean the print heads, get print diagnostic information and more.

    I hope this helps.

    -In support of Movember

  • How to align the Hcenter fields in VFM?

    How to align the Hcenter fields in VFM? its giving problem

    solution on mine! years of posting for reference...

    what I did earlier.

    I wanted to have a manager of fixed size (maximum size) and put fields here, during an aliging then using stylebit it did not work. I used sublayout and fixed to what extent a perticular dimension

    resovled doing problem.

    It is not sufficient (or necessary) to if you want to use sublayout to have a fixed size, if you use the alignment, bcz setting hardcodedly properties, the other model overridden, so u must override the methods 'getPrefferedWidth & height', not the two held all the time, but according to the needs, if you want to:-alignment, you can try only method "width" and comparable to V-alignment. I included these methods and found that half of my UI related issues would have resolved more easily, if I tried this previously.

    Thank you best regards &.

  • How to align form fields in 4.2.6

    Hello

    I use apex 4.2.6.  Wanted to know how to align the fields according to my condition.  For example, 3 fields through and again a few 4 fields in the row.  I use 'Checkerboard'-> 'New Start line' attributes.  But this seems a little dirty.  Is there another way?

    I created an example on oracle for the EMP table.  If someone can clarify.

    (workspace: test_ws_anand user: anandgp password: cable123)

    img 2.png

    Thank you

    -Anand

    anand_gp wrote:

    I use apex 4.2.6.  Wanted to know how to align the fields according to my condition.  For example, 3 fields through and again a few 4 fields in the row.  I use 'Checkerboard'-> 'New Start line' attributes.  But this seems a little dirty.  Is there another way?

    I created an example on oracle for the EMP table.  If someone can clarify.

    (workspace: test_ws_anand user: anandgp password: cable123)

    Your layout grid settings were:

    Sequence Name of the element New line New field
    10 P4_EMPNO Yes Yes
    20 P4_ENAME NO. NO.
    30 P4_JOB NO. NO.
    40 P4_MGR NO. NO.
    50 P4_HIREDATE Yes Yes
    60 P4_SAL NO. NO.
    70 P4_COMM NO. NO.
    80 P4_DEPTNO NO. NO.

    This means that all elements on each line were placed in the same cell in the grid as the first:

    I created a copy of the application and changed the settings of the grid so that each element is in a cell of the grid:

    Sequence Name of the element New line New field
    10 P4_EMPNO Yes Yes
    20 P4_ENAME NO. Yes
    30 P4_JOB NO. Yes
    40 P4_MGR NO. Yes
    50 P4_HIREDATE Yes Yes
    60 P4_SAL NO. Yes
    70 P4_COMM NO. Yes
    80 P4_DEPTNO NO. Yes

    What gives the layout desired by 3 points in the first row and 4 in the second:

    You should consult the documentation on how question attributes affect layout. Note that the best way to control the layout is to change the properties of the layout of all the elements at the same time using the change all button on the page view component. The option Show Grid in the developer toolbar is also useful in showing the layout of the items in the grid.

  • How to align the edges of the images

    I have an image that resembles a parallelogram because when the inage has been taken there does not match the grid. How to align the edges?

    Appreciate the help.

    Different ways to do it... but without seeing an image of what you are doing then I would suggest that.

    First SNAP TO GRID.

    View > Snap To > grid

    Then

    Edit > Transform > distort

    This will allow you to move the corners and stretch the image.

    But if you share a screenshot or image we can help you in more detail.

  • How to align two forms?

    Untitled-1-01.jpgHow to align 2 shape not the stroke in Illustrator CC?

    roxis,

    You can check use limits Preview in Edit > Preferences > General and uncheck it afterwards.

  • How to get a cents sign into InDesign CS6

    How to get a cents sign into InDesign CS6

    The simplest is to open the glyphs Panel, then choose "Currency" in the menu drop-down menu, which will show you all the monetary symbols, if you do not have to browse through hundreds of glyphs to find the one you want. Document of Geek: how to locate the Greek letters and math without going crazy symbols

  • How to align a SWF in the middle in Dreamweaver.

    How to align a SWF in Dreamweaver, so my swf file is located in the heart of the web browser. As for now my swf file is too far to the left in the web browser, even when I put in "Middle" in properties etc. is not to make changes and rest to the left of the web browser.

    Change the width of

    100% to 1214px and add margin: auto to the css...

    #flashContent {width: 100%; height: 100% ;}}

    TO

    #flashContent { width: 1214px; height: 100%;} { margin: auto;}

  • How to align photos in a slide show?

    Hello

    I tried to figure out how to align photos in a slide show so that they don't 'jump around' on the page, when they have different formats. Unfortunately I just read this discussion and learned that it is not possible.

    http://forums.Adobe.com/message/6071838
    But Iguiva then writes: «now, I only can do manually, one by one...» »


    If I can't control exactly where the picture is displayed, I don't see that I can use the Muse.
    So here's my question: How can I do it manually?


    Thank you
    Tine

    Hi Tine,.

    You can go up to the level of the hero Image in the slide show, and then double-click the Image of heroes.

    Which would give access to the actual Image (you will see the left corner of the strip control bed 'Image' rather than 'Hero Image').

    Once at this level, you can handle and place your image in the container Image of hero as you wish and it will keep the position you set.

    Hope that helps.

    See you soon,.

    Vikas

  • Text aligns the Center instead of the left, but only on Windows 7 computers.

    I designed a website on a Mac in CS5. It works fine on the Mac and the PC running XP/Vista, but there are problems on Windows 7.

    For some reason text boxes that I have aligned left work very well as indicated above, but each text box aligns the Center on PC under Windows 7.

    Can anyone offer advice please? I'm pretty new to this by the way!

    Thank you very much!

    Hello

    You have no text align the rule in your css I can see if the browser is probably using its default value, or who inherit from the rule, place a -.

    text-align: center;

    Edit: should read-

    text-align: left;

    in your css as required, (try in the content text rule) also if you can try to avoid using "-", (dashes) or other items on your behalf.

    PZ

    Post edited by: pziecina

Maybe you are looking for

  • How can I delete songs on an ipod shuffle to return to the store without removing iTunes

    I work for a school district and ended up with the wrong device. I need to delete music off of the iPod shuffle, which was bought for me (without removing the music from iTunes) to return the camera in Exchange for a different apple device. How can I

  • hp scanjet 3970

    My hp scanjet 3970 turns on, but how do I get a scan? I him have not used for some time, and at the age of 76 years old, I became a little distracted. I use Windows 8.1, Firefox and an ACER laptop. When I turn on the sheet for the scanner, the scanne

  • FTP Get VI gives error on the target of RT 15550

    Hello I set up an ftp server on my computer using Filezilla, the purpose is to allow a RT (CRIO-9022) target to download files from my PC. This is the VI requesting the file on the ftp server: This VI works when I run it on my computer in the Project

  • W7 desktop background slideshow stopped, including subfolders

    I have W7 Home premium 64 bit on 2 computers laptops home. For about 2 years I had (on both of them) wallpaper slide show set to show pictures of my images, change from time to time. This big folder contains many subfolders. Recently, it seems that t

  • Message from Visual Voicemail for blackBerry Smartphones is frozen.

    I have the Bold 9700.  I announce myself to a visual voicemail when I got a call.  After calling, visual voicemail message is locked.  I can remove it, but when I get a new Visual Voicemail the old one that I deleted re appears with a new, and both a