Buttons with images, by setting the size?

Hello

I use the following code to add images to the buttons. However, I got some of the buttons out of the view from the window! What can I add to make them fit on the display window?

MORE: I want them to be on the Center vertically and horizontally. Let's say I have 15 buttons, I want 3 each line. And in the center of the screen?

And finally, is it possible to make the button selected by default as NULL? Then, key 1 is not selected at the beginning as shown in the picture as an attachment!

* Image attached *.

Thanks in advance

Code:

public class BitmapButtonField extends ButtonField {
        private Bitmap bitmap;
        private Bitmap bitmapHighlight;
        private boolean highlighted = false;

        public BitmapButtonField(Bitmap bitmap, Bitmap bitmapHighlight) {
            this(bitmap, bitmapHighlight, ButtonField.CONSUME_CLICK|ButtonField.FIELD_HCENTER|ButtonField.FIELD_VCENTER);
        }

        public BitmapButtonField(Bitmap bitmap, Bitmap bitmapHighlight, long style) {
            super(style);
            this.bitmap = bitmap;
            this.bitmapHighlight = bitmapHighlight;
        }

        protected void layout(int width, int height) {
                setExtent(getPreferredWidth(), getPreferredHeight());
        }

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

        public int getPreferredHeight() {
                return bitmap.getHeight();
        }

        protected void paint(Graphics graphics) {
                super.paint(graphics);
                int width = bitmap.getWidth();
                int height = bitmap.getHeight();
                Bitmap b = bitmap;
                if (highlighted)
                    b = bitmapHighlight;
                graphics.drawBitmap(0, 0, width, height, b, 0, 0);
        }
}

SOLVED

I solved by:

1 - scaling images with display:

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

        public int getPreferredHeight() {
                return Display.getHeight()/6;
        }

2 - using HorizontalFieldManager:

HorizontalFieldManager(FIELD_HCENTER);

Thank you

Tags: BlackBerry Developers

Similar Questions

  • Black boxes shows images when you set the size of the image?

    Hello

    I have problems with black boxes appear in the image when you set the size. Please look at the screenshots. If his clue, all the problems started after I ran the El Captain update last week. What can I do? Everything works perfectly on my retina new Macbook Pro.

    Skärmklipp 2015-10-16 13.36.43.pngSkärmklipp 2015-10-16 13.36.51.pngSkärmklipp 2015-10-16 13.37.03.pngSkärmklipp 2015-10-16 13.37.12.png

    Hi henrike43022551.

    Greetings.

    • This phenomenon occurs with all the files.
    • Also try this
      • Open PS, preferences - performance and uncheck CPU chart use
    • Restart PS and check again.

    ~ Rohit

  • How to set the size of text with the report generator

    Hello.

    I'm trying to set the size of the text with the report generator, but I find that I can't do this. Here is an example of the code that I use. Can someone tell me what I'm doing wrong please?

    Thank you, Alec

    I was generation from a word template.

    I hacked my version of the Toolbox to give me maunal indicator control "model? He had obtained his permenatly self stuck on "T". I exposed this flag outside the API, so I can control under certain weather conditions I may or may not use the model police.

    Does anyone know how to use this toolkit, or I did the right thing?

    Cheers, Alec

  • Programmatically set the size of a table control (not the number of col and lines)

    Hi all

    I am trying to create a little VI, in which the user selects the number of columns and rows in a table, and after clicking on a button 'OK', the table control is displayed in the control panel (to be filled in by the user). To do this, I use the nodes property to the number of columns and lines. I have no problem with that.

    However, I want to "limit" the size of the control table (control of himself, not the dimensions of the table) and make use of vertical and horizontal table, the scroll bars. I want to avoid it is that passes type 100 user and 100 lines and appears a huge table control.

    I could tho this by using an array instead of an array, via the node property "size", but I would use an insead table a table.

    Thank you very much

    Daniel

    With a table control, you cannot set the display size to be anything other than a multiple of a complete cell.

    If you are limited to a number of lines and columns.  If you want to resize with more control you also need to resize the control within the Bay, accessible via the property 'picture Element '.

    Another option (but seems huge exaggerated) is to place your table in a secondary and set the size of the secondary to the size you need and enable scrollbars for her.  It is not an option that I would choose but if it helps...

    Have it, your description of your user interface sounds not very intuitive.  How the user knows at any time exactly what cell they access if they have to scroll backwards?

  • Pre set the size of the final file

    I'll try to find a method that allows me to pre-define the size of the final file to for example 1.8 MB. The idea is that I can set the size of parameter file (e.g.1.8MB) and lets say a resolution of 72 dpi for example. I run the command and Photoshop reasambles image to pixel dimensions necessary until I find myself with a file exactly 1.8 MB with a resolution of 72 dpi.

    The reason why? I need to convert 3500 images that are exactly 1.8 MB. The pixel dimension are not relevant in this case

    N ° not in PS. It doesn't ever work under very specific conditions, in any case. You would need to settle on a format that uses no compression or a compression method that is predictable and compress the same amount regardless of the content of the image and the program must have a way to enforce a file of cropping and scaling automatically size to reduce the number of pixels. Sort of a safe for the Web on steroids, but using uncompressed TIFF or something else. It may even be necessary to run the algorithm of coding in reverse and in a loop of trial and error and even then, the question is, how exactly the size of the file must match. Apart from some obscure programming demos which produce images specifically companies or generate specific buffers for testing purposes, I have seen nowhere implementation practice.

    Mylenium

  • How to set the size of the text by the height of the capital letter?

    As an old signmaker, I have always referred to the size of a letter by the actual height of a capital as 'E '. Is it possible to assign the format letter by the height of a capital letter?

    Assign the effect "hierarchical", the text object. Set preferences for «Limits of use overview» To adjust the height.

    Does not work worth a dang with text.

    1 type tool: Set PointType object default myriad, 12pts Type 'X '.

    2. apply the effect > describe the object

    3. the general Prefs > turn on use Preview Bounds.

    4 Control Panel: turn on the proportional button.

    5. button '2' in height. Height passes to 1.2828.

    6. button '2' in height. Height passes at 1.7275.

    7. button '2' in height. Height passes at 1.8965.

    8. button '2' in height. Height goes to 1,9606.

    9 button '2' in height. Height passes to 1,985.

    10 key '2' in height. Height passes at 1.9943.

    11. key '2' in height. Height goes to 1.9979.

    12. button '2' in height. Height passes to 1.9992.

    13 '2' in the height field button. Height becomes 1.9997.

    14. button '2' in the height field...

    Nor do I want to have recourse to the use Preview Bounds development, affecting everything in the document. (Illustrator has so many things buried in general Prefs that should be more specific document/context.)

    The mentioned script is here. However...

    DMCLV, for this reason, sign stores commonly use Corel Draw rather than (or at least the) Illustrator. Draw has an explicit function which lets call you for the type of ceiling height. When you select an object, the so-called 'Artistic text' (roughly analogous to what is called "PointType" in Illustrator), you can set the size normally. But the object field shows the height of character of the text object outlines. If you can, for example, define an 'X' and see its typographic size and height of contour at the same time. So you can enter the size using both methods, when you want without having to go through hoops.

    Draw also provides scales of design defined by the user, tools of dimension, the connector tools, legend tools and other useful features every day for sign shops and everyone (, too). If I were you (or I was), I would take advantage of competitive sidegrade Corel Draw. The discounted cost is easily justifiable even with all the other useful things included in the package in addition to the features of common sense missing still HAVE afer nearly three decades (font manager Bitstream, a large collection of fonts, PhotoPaint, a collection of clipart) large.

    JET

  • I can adjust the size of the text on the new mail / out, but can't set the size on the mail coming on my screen.

    Problem with the size of the text

    I can adjust the size of the text on the new mail / out, but can't set the size on the mail coming on my screen. Evil in my sight.

    Inhabitant of the desert

    Is this a comment or a question? If a question, care to share with us, what e-mail program you speak?

  • My window size is about 1/4 "wider than my monitor screen. How to set the size of the window?

    My window size is about 1/4 "wider than my monitor screen. How to set the size of the window?

    Hello

    ·        You did it changes on your machine before this problem?

    ·        You have a LCD or TFT monitor?

    Usually in LCDs, there will be an option to set the button of the screen on the monitor resolution.

    You can also follow these links for the resolution of the monitor & check if it helps.

    Change the resolution of your monitor

    To change your screen resolution

    Hope the helps of information. Please post back and we do know.

    Concerning
    Joel S
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to set the size of the print topic

    I have a deskjet 3520 all in one and my computer is a computer laptop dv6 with prof. windows7 64 bit.

    I want to print traces of PCB so that I can make my own, but I do not know how to set the size

    with this printer. They take the entire page when I want to be 2.35x3.35.

    Don't know if it is possible with this printer.

    Any help would be apreciated.

    Last night, I figured out how to resize with IrfanView. It allows me to get the size I want in metric or inches

    and it's free.

  • How to set the size of the Windows Explorer preview pane so that it will retain the size adjusted?

    All know how to set the size of the Preview windows exployer pane.  I can't remember or 'stick' to the adjusted size.  It always develops a great size, concealing of file information (name, date modified, size, etc...) it's very great pain.

    Help, please!

    Thank you

    * original title - preview pane of Windows Explorer is a pain.*

    Hello

    Try this:

    (a) click the "Hide the preview pane" in the upper right corner (on the left of the help) of Windows Explorer

    (b) to resize the Windows Explorer window for how you want

    (c) click the 'Show preview pane' icon in the upper right corner (on the left of the help) of Windows Explorer

    Navigate to the link below: http://social.technet.microsoft.com/Forums/en/w7itproui/thread/569509ae-a37a-441f-8cc3-95d5231b171b

    Diana

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think, if this post can help solve your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • How to get and set the size of the pool AM in life

    Hi, I want to get and programmatically, set the following parameters:


    ------------------------------------------------------------------------------

    Size of the initial Pool (jbo.ampool.initpoolsize)

    Maximum Pool size ( jbo.ampool.maxpoolsize )

    Referenced Pool size ( jbo.recyclethreshold )

    The maximum lifetime of Instance ( jbo.ampool.timetolive )

    --------------------------------------------


    In AMImpl or other place?


    Is it methods?


    Thank you.

    To get information about the pool, you can use code like this in your applicationModuleImpl

    help to dump pool statistics to log

    private void dumpAMPoolStatistics() {}

    Download the pool manager

    PoolMgr poolMgr = PoolMgr.getInstance ();

    get the managed pools

    Key of the poolMgr = enumeration. getResourcePoolKeys();

    If (key! = null) {}

    If (keys.hasMoreElements ()) {}

    can handle several pools, we will get the name of first successful

    String poolname = (String) keys.nextElement ();

    System.out.println ("pool of AM name:" + poolname);

    get the AM pool

    ApplicationPool pool =

    PoolMgr (ApplicationPool). getResourcePool (poolname);

    Journal of diagnostic AM pool

    PrintWriter out = new PrintWriter (System.out, true);

    pool. dumpPoolStatistics (new PrintWriter (out));

    out. Flush();

    }

    }

    }

    Or read Getting Application Module pool statistics to help with setting the size

    I'm not sure you can change the settings at run time. As far as I know, the pool bed settings only when it is first created.

    Timo

  • help with images of full browser size

    Hello

    I would like to have a page with only a picture and constant (or no borders) around him like these pages:

    Banksy

    Banksy

    As you can see, if you resize the browser window, the size of the image follows (get smaller or larger).

    If I use a rectangle of width and then fill them with an image, the images grow when the size of browser window is expand but when browser window is smaller, reduce the picture inside, scrollbar appear which I want to avoid. Do you know how?

    Of course, I could start with a small image (such as 300 pixels wide), but then it would look ugly on a mac with the retina display. In the case of Banksy, the image is 1000 pixels wide, but always get resized to small when the window is reduced.

    Also is there a way to make the entire browser window is filled only with the image (without any boundaries, or sides, even when the browser windows are resized)?

    I tried with the background fill, but somehow, it works no better than with rectangles.

    Thanks a lot for your help

    You can go with these options:

    http://musewidgets.com/collections/all/products/responsive-image

    http://musewidgets.com/collections/all/products/responsive-images

    Thank you

    Sanjit

  • I WANT TO CHANGE MY CODE TO USE THE LEFT BUTTON = PREVIOUS IMAGE / RIGHT OF THE IMAGE NEXT TO ANY KEY KEYBOARD = NEXT IMAGE. HERE IS MY CODE.

    I WANT TO CHANGE MY CODE TO USE THE LEFT BUTTON = PREVIOUS IMAGE / RIGHT OF THE KEYBOARD = NEXT IMAGE TO

    ANY KEY = IMAGE NEXT. HERE IS MY CODE. PLEASE HELP ME OBI WAN KENOBI, YOU'RE MY ONLY HOPE:

    Stop(); stage.addEventListener (KeyboardEvent.KEY_DOWN, changeSection); function changeSection(event:KeyboardEvent):void {switch (event.keyCode) {case Keyboard.RIGHT: nextFrame(); break; case Keyboard.LEFT: prevFrame() ;}}}}

    Your problem seems to be a matter of not understanding what version of the code that you use compared to what your file is configured to use.  Your other display uses AS2, so if you want this to work you must set the parameters of publication for AS2.

    If your file settings are for AS3 code that show you in this announcement will be suitable for this because it is the AS3 code.  The function would change to what is shown below.  Mgiht want to use a listener KEY_UP instead of a listener KEY_DOWN.

    function changeSection(event:KeyboardEvent):void {}

    nextFrame();

    }

  • Setting the size of the document

    Hi, I am trying to set the size of the document in a .jsx file and for miullimeters when I check, from Photoshop, the size of the image dimensions are different

    preferences.rulerUnits = Units.MM
    2. create a new document
    docRef var = documents.add (210,297,72)

    in 5.5 PS I get size 209,9 297.04, is it possible to acive the exact dimension?

    THX.

    P.S. This is my first post on the Adobe forums so I excuse me if I did something wrong

    What you see is a rounding of the size/pixels/resolution

    You will get a closer result...

    preferences.rulerUnits = Units.MM;
    //2. Create a new document
    var docRef = documents.add(210,297,1000 );
    

    You'd put it at 72 pixels per inch, where the rounded to the closest size.

  • ORA-19510: unable to set the size of the blocks of file ' ' (blocksize =)

    I checked archivelog dest everything ok, power logs archived bit time, everything ok, I wondered what could cause this and how to solve this problem permanently.


    Log queue alerts
    Fri Jul 31 06:10:08 2009
    Errors in the /oracle/admin/gdwp/bdump/gdwp_arc0_1220702.trc file:
    ORA-19510: unable to set the size of the blocks of 74905 for the file ' / archive/gdwp/gdwp_1_18207_654896926.arc ' (blocksize = 512)
    ORA-27037: unable to get file status
    IBM AIX RISC System/6000 error: 2: no such file or directory
    Additional information: 9
    Fri Jul 31 06:10:08 2009
    Errors in the /oracle/admin/gdwp/bdump/gdwp_arc0_1220702.trc file:
    ORA-19510: unable to set the size of the blocks of 74905 for the file ' / archive/gdwp/gdwp_1_18207_654896926.arc ' (blocksize = 512)
    ORA-27037: unable to get file status
    IBM AIX RISC System/6000 error: 2: no such file or directory
    Additional information: 9
    Fri Jul 31 06:10:08 2009
    Arc0: Error 19510 closing log file archive ' / archive/gdwp/gdwp_1_18207_654896926.arc'
    ARCH: Stopped archiving, error occurred. Will continue to retry
    Fri Jul 31 06:10:08 2009
    ORACLE Instance gdwp - archive error
    Fri Jul 31 06:10:08 2009
    ORA-16038: log 1 # 18207 sequence can be archived
    ORA-19510: unable to set the size of the blocks of file ' ' (blocksize =)
    ORA-00312: thread 1 1 online journal: ' / db01/oradata/gdwp/redo01.log'
    Fri Jul 31 06:10:08 2009
    Errors in the /oracle/admin/gdwp/bdump/gdwp_arc0_1220702.trc file:
    ORA-16038: log 1 # 18207 sequence can be archived
    ORA-19510: unable to set the size of the blocks of file ' ' (blocksize =)
    ORA-00312: thread 1 1 online journal: ' / db01/oradata/gdwp/redo01.log'
    Fri Jul 31 06:10:11 2009
    ARCH: Stopped archiving, error occurred. Will continue to retry
    Fri Jul 31 06:10:11 2009
    ORACLE Instance gdwp - archive error
    Fri Jul 31 06:10:11 2009
    ORA-16014: log 1 sequence # 18207 not archived, no available destinations

    DBA2008 wrote:
    Notes 560204.1 suggest that to get rid of the generation of the trace file, is - it safe?

    I won't read the note at the moment but would surely say they told you to check the destination where the files are current. Did you do that? Raise a SR with OSS, to get their approval before doing something like what you try. Its you only who would face consequences, good or bad, no one else so better take a safe approach and the first approval of OSS.

    HTH
    Aman...

Maybe you are looking for