Center a HorizontalFieldManager vertically on the screen

Hello world

I have a HorizontalFieldManager in a VerticalFieldManager. The HorizontalFieldManager contains a BitmapField in a 'cell' and a GridFieldManager customized in another cell.

I'm trying to make sure the HorizontalFieldManager is centered vertically on the screen, but have been unable to do. Most of the forum posts say "create your own Manager. I can do it, but I'm not sure that the Manager must specify to vertically Center the HorizontalFieldManager.

Someone can push me in the right direction? Here's what I have so far:

imageOutputField = new BitmapField();
href = new HrefField("Synopsis", 0xffffff, 0x043184, 0x00EF3825);
href.setChangeListener(this);

grid.add(href);

VerticalFieldManager vfm = new VerticalFieldManager(
    Field.USE_ALL_WIDTH | Field.USE_ALL_HEIGHT
    | VerticalFieldManager.VERTICAL_SCROLL
    | VerticalFieldManager.VERTICAL_SCROLLBAR);

horiz = new HorizontalFieldManager(DrawStyle.VCENTER);

horiz.add(imageOutputField);
horiz.add(grid);

vfm.add(horiz);

synchronized (UiApplication.getEventLock()) {
    add(horiz);
}

Thank you!

Here's another way:

http://supportforums.BlackBerry.com/T5/Java-development/vertical-center-a-field/m-p/254038

Stef wrote:

HorizontalFieldManager hfm = new HorizontalFieldManager();    

        LabelField testLabel1 = new LabelField( "Test Label1");
        LabelField testLabel2 = new LabelField( "Test Label2");
        hfm.add(testLabel1);
        hfm.add(testLabel2);

        int leftEmptySpace = (Display.getWidth() - hfm.getPreferredWidth()) / 2;
        int topEmptySpace = (Display.getHeight() - hfm.getPreferredHeight()) / 2;
        hfm.setMargin(topEmptySpace, 0, 0, leftEmptySpace);

        this.add(hfm);

Worked perfectly. In my opinion it is better this way. You create what you want inside of a Manager, and then add the Manager and after that, do the math (with getPreferredWidth/height) and set the margins.

Tags: BlackBerry Developers

Similar Questions

  • Satellite P100-286 - vertical on the screen restart and constant lines

    I got this P100-286 with Nvidia Geforce Go 7900 GS and recently the laptop started to freeze options even with vertical lines on the screen tried recovery cd tried to re - install and after installation, that he started to do the same. I have read similar problems in the forum and this is a common problem with Toshiba? I have spend £1500 on this and it is only 3 years old. My friends have older laptops of this almost 6 years old and in good working condition.
    Y at - it a suggestion for this problem or a solution? The heat on the basis of the laptop is really hot and it's like that for centuries.

    Any help is really appreciated after spending so much like to last longer or it is a problem of reliability with the Toshiba brand.

    Hi vns.

    Hmm strange. I have ever read on these issues here in the forum with Satellite P100. Friend of me has the same model and it s still does work correctly, no problems at all.

    Do you have the same vertical lines on a screen? If so, it is certainly associated with the internal graphics card and not watch.
    By the way: you have the same problem in the BIOS or just Windows?

    With regard to the heat on the underside: I think that it s time to clean it and remove dust. You can do this using the jet of compressed air to blow the dust from the cooling fans. That's why it of not necessary to disassemble your laptop.

  • Satellite P105-S6114 - gray line vertically on the screen

    Hello

    I'm new to the forum so please excuse me if I look like a novice (because I am).
    I have a Toshiba P105-S6114 that suddenly developed a gray vertical line about 1 inch wide and about 3 inches from the right side of the screen. It seems that if it is washed out. You can not see on white screens but is very sensitive to all other colors. It appears when you start the laptop to search on the net, I think while it is on the screen. What is the screen? or something escapes me?

    Please correct me for false assumptions in my post.

    I started pricing new screens. Locally for installing I got a quote of less than $500.00. I saw on ebay (new) about $280.00 aus replacement screens. Installation I expect about $100.00. If someone knows a cheaper solution, I would be very happy to hear it.

    I saw a screen for a P105-s6062 that appears from the PDF file to be identical to the S6114. It is second hand, but sounds like a viable option. Does anyone know if the screens are identical, including the connections?

    Someone at - it any other suggestions? I'd be happy to hear from someone as the laptop itself is large and I don't really want to get rid of it.

    > It appears when starting the laptop to search on the net, I think while it is on the screen. What is the screen? or something escapes me?
    It might be the screen of laptops, but it could also be a malfunction of the graphics card.
    If you first need to know what's exactly wrong.

    In your case, I recommend you to connect a second external monitor to the laptop.
    Then check if the same vertical lines appears also on external monitor.

    If the same could not be visible on the other display, the chances are high that a graphics card is malfunctioning.

    In this case a replacement of the motherboard would be necessary and this would be a costly affair!

    Anyway, in both cases, I would recommend contacting the ASP in your country.

    Good bye

  • my screen has fallen to 90 degrees. It is now horizontal instead of vertical on the screen,

    I need to know how to flip the screen my back to a normal vertical view... portrait? landscape? Help me!

    I need to know how to flip the screen my back to a normal vertical view... portrait? landscape? Help me!

    Try to press Ctrl + Alt + up ARROW, or try Ctrl + Alt + and a different key to the arrow.

    If this does not work: right click on the empty desk > graphics > Rotation.

    See you soon.

    Mick Murphy - Microsoft partner

  • my monitor displays properly, the blue and yellow lines horizontally and vertically on the screen

    monitor the display that is not right, when you move the slider it filled with blue, there are blue lines across screen

    Hello

    1 did you changes to the computer before the show?

    2. the make and model of the computer/monitor?

    Note: Make sure that the cables are connected properly to the screen and try replacing the monitor cable and/or monitor itself.

    Method 1:
    Resources for troubleshooting problems in Windows XP
    http://support.Microsoft.com/kb/307960

    Method 2: Uninstall and reinstall the display drivers and see if that helps.
    (a) click Start, right click on computer.
    (b) click on properties, click on Device Manager
    (c) expand the graphics card, right click on the map
    (d) click on uninstall
    (e) now go to your computer/device manufacturer site, download the updated drivers and install them.

  • Satellite M30: colored lines running vertically on the screen

    Hello

    Ive had a problem with the display on my satellite M30. I can start in fine etc windows but colorful lines going up and down my screen, as well as the general artifacts. I cant even install drivers nvidia without a blue screen.

    The strange thing is that if I apply pressure to the left side of my touchpad, I install the drivers and all is well! Release the pressure and the computer crashes. Ive opened the laptop and can't find anything that could be the cause.

    Any idea here?

    Maki43

    Hello

    You can check if the problem is related to the LCD or the graphics card.
    Try to connect the external monitor and check if the lines appear on the second screen.
    If the lines appear not the graphics card should be ok.

    Have you tried to install the graphics driver on the Nvidia site? These drivers are not designed for use on the Toshiba laptop. You must use own graphics drivers of Toshiba, because drivers support a protection against overheating.
    If the temperature rises to highest, the Toshiba drivers critical level will be decrease the performance of the graphics card.
    Other graphics drivers don t support that such function and, therefore, the graphics chip can overheat!

    In any case, I think that also the technician must check the laptop

  • Why do I go through Documents 3 times vertically on the screen before I can open a file?

    This folder tree is therefore redundant.  Is it possible for a user to have a

    simpler navigation pain?

    Hello

    There is no way to simplify the navigation pane. However, if you navigate to a folder in the documents folder or any other place more frequently, then you can always create a shortcut to the folder on the desktop so that you must not have to go through the navigation pane to open the file/folder.

    Right click on the folder that you access frequently and click send to and desktop (create shortcut)

    For info: http://windows.microsoft.com/en-in/windows7/create-or-delete-a-shortcut

    Note: the procedure described in the link applies to files and folders.

    Hope this information helps.

  • I hear the Media Center to boot, but it does not appear on the screen

    Original title: windows media center

    How to connect the buttons if windows media center does not charge and when clicking on the button of the mouse disappears and not windows media center charges, just to play the song. a difficulty of time I hope.

    Who would say that he (Media Center) is starting, just off the screen.  Media Center will appear in your taskbar?  If you move your mouse around enough, you can get that back to the screen?
    If so, right-click MC on the taskbar > move.  Use the arrow keys (on your keyboard) to try to move the MC window on screen.

    HTH,
    Chris

    MS - MVP (Media Center) [If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.]

  • laptop has vertical along the center of the screen. How can I fix it?

    On the laptop screen, a white vertiical line came in the middle of the screen.  Don't know how to get rid of this line.

    Authorized Center reapir know well. It is more likely to be a hardware problem than anything to do with Windows...   Mike Hall MVP - Windows Experience http://msmvps.com/blogs/mikehall/

  • iMac late 2009, squares spread on the screen, vertical lines of color

    Hi, while working on the imac 2009 end got suddenly squares scattered all over the screen and froze, rely on the button in the back to restart. After reboot when starting, I got colored vertical lines at the same time with the logo of apple and after the screen whent white, and that's it nothing else, remains just white. Appreciate any input.

    Sounds like your graphics card has failed. Find a CENTER in your area and make it check and get an estimate to determine if it is cost effective to repair.

    https://locate.Apple.com/

  • Qosmio G15: Green vertical lines on the screen

    All started an ordinary day, when I was playing music on my iTunes.
    All of a sudden my screen went black and the music stopped, but my power button is always blue. Since then, whenever I try to start it, it goes on the Qosmio screen and Windows XP screen and plays the startup sound, but there all those green vertical lines on the screen. And then it goes black and tsays in this way.

    I was able to use Windows VGA (whatever that means) with lines all over the screen, but I am not able to start normally. Does anyone have any suggestions or have had the same problem? Please help me!
    I have a Toshiba G15 Windows XP Media Center, but am not able to use it normally.

    -Alexis

    Hello

    You can enter operating system in SafeMode using F8 t the beginning upward?

  • Vertical lines flickering and the screen is not responding on my IPhone 6 more.

    My iPhone 6 Plus continues to have strange flickering gray/white vertical lines which slide down from the top of the screen on a regular basis, it does stop when I hit him in the back really hard and sometimes my iPhone screen does not, I would not be able to click on all of the apps I want and sometimes the phone would open up another application.

    Another thing is that when I pressed on the top of the screen of my iPhone, I see these white lines that are similar to there is water in which I think he does. My AppleCare expired recently and I'm afraid to go to a phone shop for repair because I don't have any knowledge about how much it will cost.

    Please help me.

    Visit an Apple Retail Store or Apple authorized service provider to check the phone. If you're lucky, the screen must be replaced if there is more internal damage, the device might have to replace:

    Pricing of the service repair screen

    Repair and replacement costs depend on your iPhone and your AppleCare products cover model. Apple runs a diagnostic test to determine if your iPhone has suffered additional damage. If she has, or if she needs more repairs, you may have to pay out-of-warranty service. Accidental damage is not covered by the Apple one-year limited warranty.

    Model Screen repair cost
    iPhone 6 $109
    iPhone iPhone 6s 6 Plus, iPhone 5 s, iPhone 5, iPhone 5 $129
    iPhone 6 sec more $149

    In addition, a $6.95 shipping charges if necessary. Fees are in US Dollars and exclude tax. The price is for the service through Apple. The final service charge we charge will be determined during testing. Pricing and terms vary for the service by an Apple authorized service provider.

    Out of warranty repair service

    If your repair is not covered by Apple limited one-year AppleCare warranty + or AppleCare Protection Plan, your iPhone may be eligible for out-of-warranty service. For example, the liquid damage is not covered by the warranty, but may be eligible for out-of-warranty service. Some damage is not eligible, for example, if your device has been broken into several pieces. See the terms of repair of Apple and Conditions for more details.
    Read the terms of Apple repair

    Model Out-of-warranty service fee Battery service *
    iPhone 6 s more, iPhone 6 Plus $329

    $79
    * available only if battery
    Apple diagnostic test failure

    iPhone iPhone 6s 6 $299
    iPhone 5, iPhone 5, iPhone 5 $269
    iPhone 4S $199
    iPhone 4, iPhone 3GS, iPhone 3G $149

    In addition, a $6.95 shipping charges if necessary. Fees are in US Dollars and exclude tax. The price is for the service through Apple. The final service charge we charge will be determined during the tests and may be less than the costs of service above. Pricing and terms vary for the service by an Apple authorized service provider.

    Off-warranty price varies for Apple accessories such as adapters and cases for Apple iPhone. For more information, contact your operator, Apple or an Apple authorized service provider.

    copied from answer Service Center - iPhone

  • 4 vertical stripes on the screen of my Qosmio G-series!

    Hey.

    I got 4 vertical lines on my laptop screen. 2 pink and green 2. They appeared either when I turned on my computer or restarted. Got my first line last month. Can I do anything with this issue? The machine is 3 years old.
    Stian cordially.

    Picture of my screen.
    [http://i288.photobucket.com/albums/ll162/bruteforce82/1.jpg]

    Published by: Admin on April 12, 2008 09:17

    Hi friend

    It's definitely a hardware failure. The question is:

    What is the screen, the display cable or the motherboard.

    You know that you will have to pay for it, but it s on you if you do not want to spend the money for it or just sell it on Ebay and get another machine.

    If I were you I contact some store or a repair service center and ask them a health check of equipment, so you can locate the defective part.

    Welcome them

    P.S.: If you need a link to the closest match. Authorized service center then click on [HERE: http://eu.computers.toshiba-europe.com/cgi-bin/ToshibaCSG/download_whitepaper.jsp?service=EU&WHITEPAPER_ID=0 000000871].

    Welcome and good luck

  • Spectrum XT: Spectrum XT Lines vertical pulse on the screen: the possible inverter failure?

    In recent days my screen started showing gray vertical lines for about 2 seconds then return to normal and repeat indefinitely. If I gently bend the Center at the bottom of the screen towards me that it stops for a few moments then again.

    I think about a hardware problem: perhaps of the inverter?

    Any opinions? Out of warranty BTW.

    Update:

    Well, I finally found some time to disassemble the thing. I had the broken hinge on Christmas thing and HP replaced the back cover and this problem started a few weeks later, so I thought it was an unrelated hardware problem or a loose connection problem related.

    I took apart today, removed the batteries and then removed from the screen. There was obviously nothing. I reinstalled the display connector and re-installed the batteries and turned back on it. The lines are still there. I made a few adjustments more gently pushing everything back in place and the pulsating lines disappeared. I put everything together back and his works always fine half an hour later.

    I guess it was just a loose connector to the previous repair.

  • problems of centering (vertically) a button on the screen

    Hello.

    I have a blackberry 10 cascades app with the code below.

    How could I get the button to fill the entire screen? I would have thought the following would do the trick, but it doesn't. The button expands horizontally to fill the width of the parent, but vertically the buttn just at the top of the screen the same as if I had not called setVerticalAlignment() at all.

    Any ideas? Maybe it's a bug?

    Thank you very much in advance.

    //-----------------------------------------

    Page * Pg = new Page();

    Button * butt = new Button();
    Welding end to end-> setText ("well");
    Welding end-to-end-> setHorizontalAlignment (HorizontalAlignment::Fill);
    Welding end-to-end-> setVerticalAlignment (VerticalAlignment::Fill);

    PG-> setContent (Butt);

    Application::instance()-> setScene (Pg);

    I really expect that this works only inside a container with a DockLayout. I don't know what pages in terms of layout, but I'm going to guess that they do nothing, which would mean that their single 'content' component would not adjusted at all position and sat at 0,0 or the upper left corner.

    It looks like you to experiment a little... in practice, I don't think that someone never put a single item non-conteneur on a Page, but generally always a container of other stuff in it. The default value for a container is StackLayout, so you will need to change to DockLayout and default alignment for stuff is Left and Top, so it should work with your Center for vertical alignment.

Maybe you are looking for