bitmapField

Hello

I have a doubt on a Bitmapfield, it can be highlighted?

Highlighted if you mean 'indicate the development', then there is no built-in way to do it.

You can do it manually - this is one of the possibilities (add tint blue alice in the image):

public class HighlighableBitmapField extends BitmapField {
  protected void drawFocus(Graphics g, boolean on) {
    paint(g);
    if (on) {
      int prevAlpha = g.getGlobalAlpha();
      int prevColor = g.getColor();
      g.setGlobalAlpha(128);
      g.setColor(Color.ALICEBLUE);
      g.fillRect(0, 0, getWidth(), getHeight());
      g.setColor(prevColor);
      g.setGlobalAlpha(prevAlpha);
    }
  }

  public void getFocusRect(XYRect rect) {
    rect.set(getExtent());
  }
}

Tags: BlackBerry Developers

Similar Questions

  • The paint on BitmapField text

    Hello again"

    I have a little experience of the development of BB. I need to paint text on BitmapField for my application.

    Do you have a code example? Please help me guys. Good day.

    TNX'

            String logoBitmap = "mobiyana.png";
            String logoString = "mobiyana.com";
    
            logo = Bitmap.getBitmapResource(logoBitmap);
    
            Graphics graphics = new Graphics(logo);      int xOffset = (logo.getWidth() - Font.getDefault().getAdvance(logoString)) / 2;
            int yOffset = (logo.getHeight() - Font.getDefault().getHeight()) / 2;
    
            graphics.setColor(Color.WHITE);
            graphics.drawText(logoString, xOffset, yOffset);
    
            add(new BitmapField(logo));
    
  • BitmapField consumes all clicks on the screen

    Hello

    I hope someone can help me with this problem: I have a screen that has only BitmapField is on. When you click on this 'something' BitmapField should be here which works very well.

    The problem is that even if I click elsewhere on the screen the 'click' fires.

    This is the main code on the screen:

    VerticalFieldManager view = new VerticalFieldManager();
    
    Bitmap bm = Bitmap.getBitmapResource("image.jpg"); // size 60x60
    MyBitmapField bmf = new MyBitmapField(bm, BitmapField.FOCUSABLE);
    bmf.setChangeListener(this);
    view.add(bmf);
    add(view);
    

    And that the implementation of the 'MyBitmapField ':

    public class MyBitmapField extends BitmapField
    {
      public MyBitmapField(Bitmap bitmap)
      {
        super(bitmap);
      }
    
      public MyBitmapField(Bitmap bitmap, long style)
      {
        super(bitmap, style);
      }
    
      protected boolean navigationClick(int status, int time)
      {
        FieldChangeListener listener = getChangeListener();
        if (null != listener)
        {
          Dialog.alert("Clicked");
          listener.fieldChanged(this, 1);
          return true;
        }
    
        return super.navigationClick(status, time);
      }
    
      protected boolean touchEvent(TouchEvent message)
      {
        /*
        if (TouchEvent.CLICK == message.getEvent())
        {
          int index = this.getManager().getFieldAtLocation(message.getX(1), message.getY(1));
          if (index == -1)
              return super.touchEvent(message);
          Field field = this.getManager().getField(index);
          if (field != this)
            return super.touchEvent(message);
    
          FieldChangeListener listener = getChangeListener();
          if (null != listener)
            listener.fieldChanged(this, 1);
        }*/
        return super.touchEvent(message);
    }
    
    }
    

    In the touchEvent method is a point that I also tried - but that didn't work either.

    The fieldChanged Manager is as usual:

      public void fieldChanged(Field field, int arg)
      {
        if (field instanceof MyBitmapField)
        {
          MyBitmapField bmf = (MyBitmapField) field;
          Dialog.alert("Clicked: " + Integer.toString(arg));
        }
      }
    

    I'm actually on the 9550 Simulator.

    Can someone please help me and tell me what I need to do to avoid that the click event is fired even if I click outside the BitmapField (I also put a border, just to make it visible, it is not expanded).

    Thank you very much

    That's exactly how BlackBerry works, even if it is IMHO pretty buggy: the key CLICK event is translated into navigationClick() in the field that currently has the focus. The problem lies in the fact that EVENT moves the focus to the field under him that if there is an active field where you press the screen, otherwise the focus remains where it is.

    To overcome this obstacle, program your touchEvent similar to this:

    protected boolean touchEvent(TouchEvent message) {
      if (TouchEvent.CLICK == message.getEvent()) {
        int x = message.getX(1);
        int y = message.getY(1);
        XYRect myExtent;
        getExtent(myExtent);
        myExtent.translate(0, 0); // getX, getY values are relative to this field's upper-left corner
        if (!myExtent.contains(x, y)) {
          return true;
        }
      }
      return super.touchEvent(message);
    }
    

    You can allow a 'near miss' avoid the frustration of users - extend the myExtent in any quantity you want of each side.

  • NavigationClick for a BitmapField management

    I have a BitmapField that must call a method when the user clicks on it I am trying to stop any other activity to occur once the method is called. It seems that the click happened thanks to the shape.

    filterField = new BitmapField (Bitmap.getBitmapResource ("filter.png"), Field.FOCUSABLE |) BitmapField.FIELD_HCENTER | BitmapField.FIELD_VCENTER | BitmapField.USE_ALL_WIDTH) {}
    protected boolean navigationClick (int status, int time) {}
    fieldChangeNotify (0);
    displayFilterOptions();
    Return super.navigationClick (status, time);    Handle the click event
    }
    };

    Simply return true instead of super.navigationClick (which is what was the trigger for the rest of the fields and managers of multiplication).

  • How to set the transparent color in the BitmapField?

    I display some Bitmap using BitmapField, to create a screen as our Office Windows means icons followed by the name of the application. When I first time poster main screen it seeks it is transparent, but when I move the focus from one Bitmap to another, bitmaps are not rest transparent. I want transparent bitmaps after moving the slider too. How can I do? Does anyone have an idea?

    Thanks in advance...

    No problem, I was not angry at all.  I wanted to just make sure I understood your problem before giving an answer.

  • Can I scale to bitmap or bitmapField?

    Image bitmap bitmap = Bitmap.getBitmapResource (fileName);
    BitmapField bitmapField = new BitmapField (bitmap, BitmapField.FIELD_HCENTER);

    I have Bittmap and I need scale it... can you hel me please?

    You can find a lot of discussion about it by typing 'ladder' in the search box, give it a try.
    first train: http://supportforums.blackberry.com/t5/Java-Development/Rotate-and-scale-bitmaps/ta-p/492524

    Also, check the int http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/EncodedImage.html#scale... )

  • Click on bitmapfield (image)

    Hello

    How can I make the event click on the image.

    HImanshu SALVATION,

    Copy the following code, it's 100% according to your need.

    Feel free to press cudo, if this code will help you.

    package pk;
    
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.container.MainScreen;
    
    public class pk extends UiApplication{
    public pk() {
        // TODO Auto-generated constructor stub
        pushScreen(new pawan());
    }
    public static void main(String args[])
    {
    new pk().enterEventDispatcher();
    }
    }
    
    class pawan extends MainScreen
    {
    public pawan() {
        // TODO Auto-generated constructor stub
        add(new clickImg(Bitmap.getBitmapResource("button2.png"),150,60,true));
    }
    }
    
    class clickImg extends BitmapField
    {
    boolean check=false;
    Bitmap bitmap;
    int width=0;
    int height=0;
        clickImg(Bitmap bmp, int width, int height, boolean bl)
        {
            super(bmp, FOCUSABLE);
            check=bl;
            bitmap=bmp;
            this.width=width;
            this.height=height;
        }
    
        protected boolean navigationClick(int status, int time)
        {
            fieldChangeNotify(1);
            if(check==true)
            {
                this.setBitmap(Bitmap.getBitmapResource("button3.png"));
                check=false;
            }
            else
            {
                this.setBitmap(bitmap);
                check=true;
            }
            return true;
        }
        }
    
  • Strange problem of onFocus BitmapField

    Hello, at least, this is:

    I have a set of BitmapField to change the image once it is 'focused', it works, but I get this popup dialog whenever it "focuses" or "unfocuses":

    Code:

    button1 = new BitmapField(b1, Field.FIELD_HCENTER|BitmapField.FOCUSABLE) {
                protected void onFocus(int direction) {
                    setBitmap(b2sel);
                }
                protected void onUnfocus() {
                    super.onUnfocus();
                    setBitmap(b1);
                }
    
                protected boolean navigationClick(int status, int time) {
                    button2.setFocus();
                    Dialog.inform("Button 1 Clicked!");
                    return true;
                }
    
            };
    

    Anyone know how I can stop the implementation of this dialog box?

    N/m... figured it out. Has had another shot of method.

  • Put LabelField above BitmapField

    I searched around, but have not found a clear answer to this. The answers that are closer seem complicated for what should be a very simple thing to do

    What is the easiest way to place a LabelFeild on top a BitmapField? Specifically, I have the splash screen that takes the entire screen with a BitmapField, and I want to place a small LabelField in the lower right, on top of the Bitmap image. Am I crazy to think that this should be easier?

    I wrote once a code only one field of centers on a bitmap.  Change it to put the box down below is trivial. Here is the link to the code:

    ButtonField with background

    It is in the solution post. Watch the childX and childY calculations and remove the division by 2.

  • Resize Images coded before adding it to a BitmapField

    I will have questions my image re-sizing. I click on an image using the camera and store it in the images folder. When I retrieve the image I see the picture on the screen but I want it to be smaller, since it occupies the entire screen and more and I have to scroll down. I added the code to scaleImage (see linebelow code red) but no luck. I'm doing something wrong? -Thank you.

    EncodedImage image = EncodedImage.createEncodedImage (dataArray, 0, dataArray.length)

    image.scaleImage32 (1, 1);

    BitmapField bitmapField = new BitmapField();

    bitmapField.setImage (image);

    Add (bitmapField);

    fixed32.tOFP's it. Thank you

  • EditField + BitmapField in a horizontalfield Manager

    Hello

    I use code below to show a field of editing and Bitmap in a horizontal field Manager, but I'm getting illegal state exception...

    If I first add BitmapField and then change the field it works fine but I need Editifield first and then BitmapField

    Below is my code...

      Bitmap bg = Bitmap.getBitmapResource("twenty.png");
      locations = new BitmapField(bg,bg,"Locations");
      EditField table=new EditField("Ticket No : ","",5,EditField.FILTER_NUMERIC)
             {
                    private int iRectX = getFont().getAdvance(getLabel());
                    private int iRectWidth = Display.getWidth() - iRectX - 4;
                    public void paint(Graphics g)
                     {
                                g.setColor(0x000000);
                                g.drawRect(iRectX, 0, 170, 18);
                                super.paint(g);
                    }
             };
    
      HorizontalFieldManager hfm=new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH);
      hfm.add(locations);
      hfm.add(table);
      add(hfm);
    

    I already tried taking two horizontal field to add the edit field in the image in another Manager and added these two leaders in vertical field but no luck...

    I also tried traced table...

    EditFields use the full available width.
    You can crush getPreferredWidth or use a custom presentation:
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800508/...

  • playing style of bitmapfield

    Hi guys

    Dynamics set the bitmapfield style?

    for example, I put bitmapfield to disable in some State that I'm not user which can click.

    Although I disable fieldchangenotify touch.unclick and trackwheelclick in some State that I put.

    but when I use "BOLD" move trackball on bitmapfield ex.9650 phone I put turn off, he's always focused.

    so I need dynamic whole unfocus and focus.

    can someone tell me how to do?

    THX

    You can substitute isFocusable() and keep a flag, a place where to return whether or not it should accept focus. If you have several of them it is probably easier to simply create a class that extends BitmapField, and then just do a public method to change the flag when you need toggle.

  • How to overlay text on a BitmapField?

    Everything is in the title

    AM new rim user interface programming and I need to overlay text on my BitmapField, any idea?

    Thank you!

    There are several possibilities.  Here's one (assuming you want to add more than one piece of text to your BitmapField):

    (1) create your own class that extends BitmapField - say, MyBitmapField

    (2) have a static inner class with three members - string text, int hOffset, int vOffset. Call the TextPiece. Have a TextPiece (String, int, int) constructor in this category.

    (3) have a member of vector in MyBitmapField that will contain all your pieces of text. Call allText.

    (4) create an addText (String text, int hOffset, int vOffset) method which calls allText.addElement (new TextPiece (text, hOffset and vOffset)); and invalidate();

    (5) having a painting replace similar to the following:

    protected void paint(Graphics g) {
      super.paint(g);
      g.setColor(desiredFontColor);
      int size = allText.size();
      for (int i = 0; i < size; ++i) {
        TextPiece tp = (TextPiece) allText.elementAt(i);
        g.drawText(tp.text, tp.hOffset, tp.vOffset);
      }
    }
    

    (6) probably also need a method of clearAllText()...

  • BitmapField focus-unfocus prob

    I want to put a text in a specific label on the development of a "BitmapField" and reset the text on unfocus. I use the following code:

    final BitmapField tab1 = new BitmapField(Bitmap.getBitmapResource("img/icon1.png"), FIELD_BOTTOM | BitmapField.FOCUSABLE) {}
    protected void drawFocus (Graphics graphics, boolean on) {}
    the simplies to draw a rectangle and this will be the
    Update
                
    }
        
    protected boolean navigationClick (int status, int time) {}
    write here your code you want to execute the user clicks for
    the bitmap image
    try something like this
    Dialog.Alert ("Code for tab1');
    Returns true;
    }
            
    {} public void setFocus()
    super.setFocus ();
    selectedLabel.setText ("tab1");
    }
            
    public void onUnfocus() {}
    super.onUnfocus ();
    selectedLabel.setText("");
    }
        
    };

    Development works, but label does not at all. Where is the problem in my code?

    What happens if you replace:

     public void setFocus(){
                super.setFocus();
                selectedLabel.setText("tab1");
            }
    
            public void onUnfocus(){
                super.onUnfocus();
                selectedLabel.setText("");
            }
    

    with

     protected void onFocus(int direction)
                super.setFocus();
                selectedLabel.setText("tab1111");
            }
    
            protected void onUnfocus()
                super.onUnfocus();
                selectedLabel.setText("tab2222");
            }
    
  • Position of the bitmap inside the BitmapField

    Hi, this is perhaps a silly question, but is at - there a way for me to specify the position of the bitmap image to add inside the BitmapField?

    I already added the bitmapfield to the screen and I want to add several bitmaps inside the field, but in certain specified places. Is it possible to do this without changing the location of bitmapfield?

    Help, please!

    Hi thanks for the reply! Creation of absolutefieldmanager seems quite complicated and a lot of work!

    I found a way to achieve what I needed treatment multiple paint.drawBitmap!

    Thanks for the help!

  • BitmapField does not display an image bitmap. In fact, it does not display anything at all...

    My problem is simple and fast. I am probably just a stupid mistake, but the BitmapField component does nothing and does not display the bitmap image. I first tried to display a Bitmap using its setBitmap (bitmap Bitmap) method, which did not work. Then I tried to use it's method setBitmap to the Builder, who did nothing at all no more. Then I tried to use setImage using an image encoded if nothing happened again. Yes, both the encoded image and methods of Bitmap.fromBitmap that make new Bitmap objects and EncodedImage POINTENT to real images in my project folder. So what I am doing wrong, I forget to call a method in needed or what? I use Eclipse with the plugin and I use the Blackberry 9550 Simulator.

    First of all, your use setSpace is incorrect. What you are doing here are to define a space around the bitmap image - in this case, the space is bigger than most of the screens, which will ensure that your bitmap image is not actually on the screen. See the description of the API in the javadocs.

    Second, you SHOULD check the return of getBitmapResource(). If it returns NULL, then the resource was not available. What you're doing here can hide a problem.

Maybe you are looking for

  • flicker in thunderbird 31.0

    Here, since the update to thunderbird 31.0 flickering guard, I am under windows 7.Can someone advise what may be the cause as the previous versions were quite well. Timestamp: 23/08/2014-12:13:19WARNING: the Prototype of an object of the mutation cau

  • How can I get data (txt file with data from the 5 sensors) in a graph?

    I have a txt file that reads time, data1, data2, data3, data4, recentes5, yes/no example: 0,450,427,421,480,622,0 4,561,513,478,466,540,0 8,547,531,510,492,515,0 12,528,524,513,495,525,1 36,531,524,515,505,534,1 65,537,528,519,511,539,1 Where the las

  • How can I remove Spyware Terminator Digital signature

    Dear Sir!I tried the above program. I didn't like it. Removed from the control panel (programs and features).Yet, whenever I restart my computer I gat a massage; Allow you to Spyware Terminator Digital signature to change on your computer? I have wou

  • Get rid of windows search for a solution, box of

    Tried to download the game gamevance.  I stopped in the Middle, now I get this on my screen "gamevance32.exe has stopped working.  A problem caused the blocking of the program works correctly.  Windows will close the program and notify you if a solut

  • Professional Vista... several incomplete restoration... unspecified error when Sync IPhone

    Hi, I have a problem with the system restore... I have norton and it said 'protected '... He began by having a problem with syncing my iPhone, a msg says unknow error 13019... I downloaded the latest version of iTune and I AST even msg of error 13019