How to change the width of editfield in blackberry java

Hi, blackberry has,

I want to change the width of editfield... can someone tell me how I can do

Hi Ludovic,.

use TableLayoutManager and adjust the width of the field (based on no. added columns) for your screen.

I don't get your condition, but if you want to insert fields so that it will adjust the space then use RoundedPanel and you can add a tablelayoutmanager to this Panel.

/*
 * RoundedPanel.java
 *
 * © , 2003-2008
 * Confidential and proprietary.
 */

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.system.Display;

/**
 *
 */
public class RoundedPanel extends VerticalFieldManager {
    private int _heightBtmIncr = 0;
    private int color = Color.WHITE;
    private String str = null;

    public RoundedPanel() {
        super(Manager.VERTICAL_SCROLL);
    }

    public RoundedPanel(int heightBtmIncr) {
        super(Manager.VERTICAL_SCROLL);
        _heightBtmIncr = heightBtmIncr;
    }

    public RoundedPanel(int color , String str) {

        super(Manager.VERTICAL_SCROLL);
        this.str = str;
        this.color = color;
    }

    public void paint(Graphics g) {
        g.setBackgroundColor(Color.LIGHTGREY);
        int initialColor = g.getColor();
        g.setColor(Color.LIGHTGREY);
        g.fillRect(0, 0, this.getPreferredWidth(), this.getHeight());
        g.setColor(color);
        g.fillRoundRect(3, 3, this.getPreferredWidth() - 6, this.getHeight() - 6, 17, 17);
        g.setColor(Color.DARKGRAY);
        g.drawRoundRect(3, 3, this.getPreferredWidth() - 6, this.getHeight() - 6, 17, 17);
        g.setColor(initialColor);
        super.paint(g);
    }

    public void sublayout(int maxWidth, int maxHeight) {
        super.sublayout(maxWidth, Integer.MAX_VALUE);
        int fieldCount = getFieldCount();
        int x = 12;
        int y = 10;
        Field child = null;

        for (int i = 0; i < fieldCount; i++) {
            child = this.getField(i);
            setPositionChild(child, x, y);
            layoutChild(child, getFieldWidth(child), Integer.MAX_VALUE);
            int childHeight = getFieldHeight(child);
            y = y + childHeight;
        }

        this.setExtent(getPreferredWidth(), Math.max(y, getPreferredHeight()));
        setVirtualExtent(getPreferredWidth(), Math.max(y, getPreferredHeight()));
    }                  

    private int getFieldWidth(Field f) {
        return Math.min(Math.max(Math.max(f.getContentWidth(), f.getWidth()), f.getPreferredWidth()), this.getPreferredWidth() - 12);
    }

    private int getFieldHeight(Field f) {
        return Math.max(Math.max(f.getContentHeight(), f.getHeight()), f.getPreferredHeight());
    }

    public int getPreferredWidth() {
        return Display.getWidth();
    }

    public int getPreferredHeight() {
        int height = 6;
        int iNumFields = getFieldCount();
        for (int i = 0; i < iNumFields; i++) {
            height += getFieldHeight(getField(i));
        }

        return height + _heightBtmIncr + 6;
    }

    protected boolean keyDown( int keycode, int status ) {
        invalidate();

        return super.keyDown( keycode, status );
    }

    protected boolean navigationMovement( int dx, int dy, int status, int time ) {
        invalidate();

        return super.navigationMovement( dx, dy, status, time );
    }

    protected int moveFocus(int amount, int status, int time) {
        invalidate();

        return super.moveFocus(amount, status, time);
    }
}

Thank you & best regards

pp

Tags: BlackBerry Developers

Similar Questions

  • How to change the width of the image on the screen?

    How can I change the width of the images on my screen?  Everyone seems wide.  How depressing!

    It may be interesting to try to change the resolution of your screen.

    See the following...

  • How to change the width and height of the title?

    Program: First Pro CC

    Recently I create da title for my video. I noticed that when I had looked at the preview of the title and the video, the title is so blurry. My settings at first:

    SAve.PNG

    How am I able to change the width and height parameters (to make the title more high definition) , without having to create another title in replacement from that Fuzzy? I don't ask if I have to create another title and insert it in the video, and then having to erase those blurry I had to replace. How are you able to change settings of the original title, without having to make a new title? Should I go to the 'Properties' tab when there is nothing at all (as in there is no option to change the w + h title quality) to change the current settings of the title?

  • How to change the width of the div CSS from the Center?

    Very basic question here, but I'm relatively new to DW. Please use the following url for reference: www.pawnpawn.com.

    Basically, I inherited the site of a previous Designer, who is no longer available. All I want to do is expand the container with our Services, how it works, etc so that contact us either on the same line with the rest. I know how to expand the container in CSS, but it grows to the right instead of from the Center. Here is the original code, without the new specification of width:

    #nav {}

    display: block;

    text-align: center;

    border-top: 1px solid #d3d3d3;

    border-bottom: 1px solid #d3d3d3;

    margin: auto 10px 0;

    min-height: 35px;

    Padding: 12px 0 0;

    If I add "width: 1100px;" he broadens it properly, but not Center. I tried "align: center;" but it was just a guess, and it does not work.

    Any help would be greatly appreciated, thanks in advance and sorry for this fundamental question!

    MP

    Line 24 of skeleton.css says

    . Container {position: relative;} Width: 960px; margin: 0 auto; padding: 0; }

    If you change the width, you will get what you want. The problem is that the entire page will be the new width. You then have the choice either redevelop available to suit or wrap the rest of the page in another container with the width of origin.

  • How to change the width of the HTML Audio?

    I had the audio html on my Office website. But for the mobile - it doesn't look good. The width of the mobile site is 380 px width fix audio html is 580 px There is an extra space annoying when I publish the mobile site.

    I searched on the web they said that you can change the width through 'css '. He made a very good example: http://jsfiddle.net/YK72D/

    Now my question, where can insert this code "css" in Adobe Muse?

    Hello

    You can enter the CSS desired in the Style tag in the location below the specified page.

    Here are the steps.

    1. open the page in Design view.

    2. go to Page > Page Properties > metadata > HTML for

    3. Paste the code you want as shown in the example below:

    Note 1: The changes will not reflect in the mode creation, but you can check the changes either by uploading it to the server or by publishing to Business Catalyst.

    Note 2: Changes will apply in two reviews (Mobile and Desktop) (assuming that you have not created a layout of phone)

    Concerning

    Vivek

  • How to change the width of the navigation area

    Is it possible to change the width of the area of Navigation Alternative 1? I use it to post links to other pages, but the descriptions are hit three or four lines, making it bulky.

    Hello

    I went to my theme 2 app and adjusted the model:

    <table border="0" cellspacing="0" cellpadding="0" summary="" class="t2NavigationRegionAlternative1" id="#REGION_STATIC_ID#" #REGION_ATTRIBUTES# style="width:500px;">
    <tr>
    <td class="t2RegionHeader" valign="bottom">#TITLE#</td>
    </tr>
    <tr>
    <td class="t2RegionBody" valign="top">#BODY#</td>
    </tr>
    </table>
    

    and it has certainly made the wider region. Have you tried?

    Andy

  • Smartphones blackBerry how to change the connection mode for a BlackBerry Internet Service account on my 9700

    Got my first BB is the 9700 and I believe that my company doesn't have not BES, I must connect on my BIS via a computer to set up my work email (Microsoft Exchange Server). After having read about it and try, I get an error message on the Web site of my provider which basically means that I need to change the connection mode for a BlackBerry Internet Service account. I checked the site Web of Blackberry and the instructions do not work for my 9700. Can someone help me please?

    Thank you very much

    Buskroth

    the link provided should have addressed your question, if you "can't get there from here" - I would suggest that you contact your carrier because they need to move your account password enabled allowing connect you via a non - BB browser to set up your BIS email setting...

  • How to set the width in EditField

    I have my customEditField, and I put my 40 width and height using (Font.getHeight), to calculate the height. I set the max characters no. 3 when I enter 3 characters in the EditField, I see 3 characters I typed in editfield in simulaors as Pearl curve, but I couldn't see all the 3 characters in 8900, I see 2 characters only, so how do I set the width of my editField

    How can I do this?

    (i) if I have the same width, how can incase I do horizontal scrolling in my edit field

    (II) without using the scroll option, how can I determine my editfield based on my characters length maximum width (i currently use only 3 characters to type here and I need its respective width).

    Concerning

    Rakesh Shankar.p

    Agree with Stephen, here is a code which may help

    int this.getFont ().getAdvance("000") = width;

  • How to change the width of the side Navigation Menu with Apex 5 universal theme

    We strive to implement new APEX 5, menu navigation vertical available in universal theme and major limitation, that we face here is the width of the side Menu bar and it seems fixed and we can not change that by changing all the model. can you please let us how we can do it without making major changes in theme templates.Apex5_sidenavigation_issue.PNG

    Thanks for the information of Kiran, but do not go for the shared components and we can save and make the current style Pebble theme it yourself (very cool feature) and regarding the issue I have with this custom style CSS not getting not properly applied is due to the incorrect configuration of services remains. and you can see in the page of the tab style of the universal theme, there is a CSS OUTPUT file Url parameter which is a JSON string (#THEME_DB_IMAGES #11918460990413349.css) and it will not work properly if we do not properly configure the rest services.

    I think I'm all set now, thanks for your help.

  • How to change the width of the line after the line is drawn?

    In Flash CS4, I'm changing the line of my line width or shape, he chose, but the stroke width slider is grayed out (so unadjustable). Is it possible to change a width of line after something has been created? If so, how is that possible? I tried selecting the line in all sorts of crazy ways, but still can not change it.

    I have CS4, but in CS3, as long as you select the object you draw raw, you can use either the slider or enter a new value in the box.  When you select the shape and line, it is not all cross-hatched/speckled or is it a blue line that surrounds all of this?  If it's the blue line, then you have not down to the crude graphics yet.  You can also check that the layer is unlocked.

  • How to change the width of the component table of contents

    9 RoboHelp, WebHelp Pro, WebHelp Server

    I want the component table of contents to be wider that when managers WebHelp default window opens. How can I control this?

    Hello

    As Peter mentioned there are continuous thread in which I mentioned the name of the file in which you can change the value, this file is available I Robohelp server publishished to the project but is not standing, then you must change the value each time only time publish. Check the wire and let me know if you have any doubts.

    http://forums.Adobe.com/message/4638778#4638778

    In server you will find your published project: it's my location of machines, you will need to check with your COMPUTER administrator who configures the server.

    C:\Program Files\Adobe\Adobe RoboHelp Server 9\robo\server\general\

    Thank you

    Priyank

  • How to change the width of the line?

    When I resize a path object, the width of the line remains the same.

    How to scale with the object?

    I thought it was possible in Flash, but I can't find any setting.

    I think it is in other Adobe applications.

    Actually, you can't evolve a shot of raw, which seems to actually like a bug. You have scaling on 'Normal' and then place it inside a clip. When you resize the clip, the width of the line dimensionnera more or less as desired.

  • How to change the width of columns in an interactive report?

    I have an interactive report. I want to customize the width of the column in the report. How to get there?

    Thank you
    Jen

    Two things... (1)

     items are for the forum display use only, do NOT copy them to your page in APEX..  2) I have modified your page 23 in your app, I have added the code in the proper location and removed the other code you had in place and copied it to the comments section of page.
    
    Please take a look and adjust the size accordingly..
    
    If this answers your question, please mark the question as answered and assign points where due..
    
    Thank you,
    
    Tony Miller
    Webster, TX
    
    Time flies like the wind, but fruit flies like bananas.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    
  • How to change the width of the table of results LOV

    Hello
    I have several lov defined on the attributes of display objects. The LOV renders correctly, but if add more columns to the list of attributes resulting display of table always displays bars scroll if they don't fit within the default width of the table of results. How can I increase the width of the table of results so I can show all display both attributes?

    Kind regards
    André Jochems

    Hello

    guess it needs a new skin picker because there is no option to do this. I played with skinning and finally with

    AF | table {width: 500px}
    #departmentId_afrLovInternalTableId::scroller {width: 500px}

    The ID selector is what I disovered debugging page. I guess that ID always starts with the name of the field to be updated, "departmentId" in my case

    I'll drop and ER, what kind of count is fragile

    Frank

  • How to change the width of the column guide itself?

    I make a brochure trifold and put in this way in the layout.  the space between the column (represented by the fine purple lines) guides is too narrow.  I want to make it wider.  I thought that this space was the 'gutter' but when I change the default of gutter. 25 "nothing changes on the page.  I expect the purple streaks ever further out.  am I adjust the wrong thing or what? Thank you!Picture 1.png

    The guides themselves aren't really doing anything. They are simply Visual that you as a developer can use or ignore. To get the column gutters to change you must go into "options of text block. Use the command-B (Mac) or control-B (PC) or right-click to access contextual menus and choose text block in a list options. Once the dialog box appears, you can change the gutters. If you want real gutters and guides to match, you must also change the guides. You can do this under the menu layout, «margins and guides»

    Hope that helps

Maybe you are looking for

  • "Situation: 0xc0000225" error starting in Windows 7

    Windows Boot Manager Windows could not start. A recent hardware or software change might be the cause. To solve the problem: 1. Insert your Windows installation disc and restart your computer. 2. choose your language settings, and then click "next".

  • Toshiba Satellite Pro 6100 does not start

    HelloI used a Toshiba SP 6100 until a few weeks ago because it started to act weird. It would not start at all, I called an authorized service center but they wanted me to pay 900 euro for a new motherboard, so I bought one off ebay ;-)with the first

  • Satellite A100 - 237 (PSAA9E) - can I improve it with a new 320 GB HARD drive?

    Hello! I want to switch the hard disk of my Satellite A100-237. It is equipped with 80 GB Fujitsu, 5200 rpm, SATA. I want to install a new one - 320 GB, 7200 rpm, SATA. But I don't know is it supported. I tried to find information about the possibili

  • How to change the style of point of the last lot on multiplot XY graph programmatically?

    Hi all I have a multiplot XY Chart.  I want to change the style of the last plot point by program.  Any way to do it?  I tried and it looks like only the first property parcel is changeable by program. Thanks for any help. Anne

  • I am recovering data from 720 KB diskettes.

    About 14 years ago I saved about 150 paint files (all illustrations) on 25 Dysan double face, double pre-formatted density 720 KB 3-1/2 "floppy disks.  I am their opening and copy of Windows XP.  Everything works fine, except for two 2 discs.  The pr