Unpaired (paint) graphics.pop

Hello

I just develop a soft and I already tested on a BB 8120 Simulator, but when I try to launch it on a real BB 8120 I get this error

Eception exception: unpaired Graphics.pop (paint) in class
com.v2p0.MyApp.myappMainScreen $1 5 real! = wait
6 clip (0.23) + (240 260) @(0,-23)

My application has been installed correctly and this error pops up when I tried to open my application to its icon.

How can I solve it? And why this is happening?

I use JDE 4.3

I suspect that your problem is that you do a setFont in your method of painting.  It becomes recursive, because to treat the setFont, the field knows she has to extricate himself, which naturally causes an another setFont...

Is there something wrong with this code?

    HorizontalFieldManager labelManager = new HorizontalFieldManager(Field.FIELD_HCENTER){               

        protected void paint(Graphics graphics) {
            graphics.setColor(0x00345a);
            graphics.clear();
            super.paint(graphics);
            }
     };

     try {
         FontFamily alphaSansFamily = FontFamily.forName("BBAlpha Serif");
         Font appFont = alphaSansFamily.getFont(Font.PLAIN, 8, Ui.UNITS_pt);
         labelManager.setFont(appFont);
     } catch (ClassNotFoundException e) {
     }

    labelManager.add(head);
    add(labelManager);

Tags: BlackBerry Developers

Similar Questions

  • IllegalStackSizeexception: no Graphics.pop in class

    "Unpaired Graphics.pop (paint) in the BB * d 5 real class! = (expected) clip 8.

    Why I get this kind of exception. I use JDE 4.7.0 and tactile 9500 simulator, I'm the exception when I try to scroll the content of this page upwards or downwards (by dragging the mouse)

    Here is the code which I assume is causing the exception:

    I use as much code in the class Paint Custom EditField overrided method, when I tried this code I get not all exceptions of masking. Can someone tell what is wrong with this code?

    It is necessary for my EditField since it controls the case of the EditField texts...

    String entireText = this.getText ();
    String textToDraw = "";
    Are police = this.getFont ();
    longText Boolean = false;
    int availableWidth = nTFWidth-2;
           
    check the space, comma characters
    int i = 0;
    Boolean bExistsSpecialChar = true;
    Boolean bLowerChar;
    && ! bExistsSpecialChar
    While (i
    {
    Char [] tempCharAry = entireText.toCharArray ();
    tempCharAry [0] = Character.toUpperCase (entireText.charAt (0));
    entireText = new String (tempCharAry);
              
    int j = 0;
    If (entireText.indexOf (' ', i)! = - 1 & entireText.indexOf (' ', i))<>
    {
    j = entireText.indexOf ("", i);
    char ch = entireText.charAt(j+1);
    bLowerChar = Character.isLowerCase (entireText.charAt(j+1));
    tempNum = j;
    If (bLowerChar)
    {
    bExistsSpecialChar = true;
    tempCharAry = entireText.toCharArray ();
    tempCharAry [j + 1] = Character.toUpperCase (entireText.charAt(j+1));
    entireText = new String (tempCharAry);
    }
    }
    Another yew (entireText.indexOf (', ', i)! = - 1 & entireText.indexOf (', ', i))<>
    {
    j = entireText.indexOf (', ', i);
    char ch = entireText.charAt(j+1);
    bLowerChar = Character.isLowerCase (entireText.charAt(j+1));
                   
    If (bLowerChar)
    {
    bExistsSpecialChar = true;
    tempCharAry = entireText.toCharArray ();
    tempCharAry [j + 1] = Character.toUpperCase (entireText.charAt(j+1));
    entireText = new String (tempCharAry);
    }
    }
    another if (entireText.indexOf('.',i)! = - 1 & entireText.indexOf('.',i))<>
    {
    j = entireText.indexOf('.',i);
    char ch = entireText.charAt(j+1);
    bLowerChar = Character.isLowerCase (entireText.charAt(j+1));
                   
    If (bLowerChar)
    {
    bExistsSpecialChar = true;
    tempCharAry = entireText.toCharArray ();
    tempCharAry [j + 1] = Character.toUpperCase (entireText.charAt(j+1));
    entireText = new String (tempCharAry);
    }
    }
    i ++ ;
    }
    nPrevCharLength = entireText.length ();
    this.setText (entireText);

    Any help will be appreciated...

    "I need to validate the user text input.

    Have you had a glance at a filter text?

    Alternatively, you could probably do this in a FieldChangeListener, making sure that ignore you changes programmatically.

  • Display data in the graphics pop-up window

    I'm trying to display continuous data in a graphic pop up. When I press a graphic button should pop up and show all the previous values as well as those generated at all times. If possible, I want to do this without the use of global or local variables. This question was asked before too http://forums.ni.com/ni/board/message?board.id=170&message.id=315949&query.id=9049787#M315949 , but I was unable to understand the proposed solution. I am a civil engineer, means that it will be difficult for me to understand advanced concepts and sometimes even simple concepts related to computer programming.  I have attached two screws just to illustrate what I'm doing.

    Thank you

    A few tips:

    • The Subvi should be placed in the case of timeout since it is the only place where it is to be used.
    • You have no need to convert a DBL to subtract the timestamps. Works of operation subtraction with timestamps (it is polymorphic) and give you a DBL. This allows you to eliminate a certain number of operations.
    • In the Subvi, rather than using a property node to hide the control (which is executed whenever you call the VI), simply hide the control by double-clicking on the terminal on the block diagram and selecting "Hide control". You can also set the 'Visible' property by right-clicking on the control, and then select Properties. Or, you can simply resize the Subvi front panel so that the control is disabled on the side.
    • The tunnels off events are initially set to 'Use default if Unwired'. A Boolean value, that would be wrong. So, just to have the Stop_Program case were in fact a real constant wired to the tunnel. All others can be disconnected to the left. The "use default if Unwired" is something to both good and bad. On the one hand, it can identify missing wiring if you leave this off, so you can catch situations where you do not generate data in a briefcase when you should. In this case, however, it is perfectly safe.
  • After showing the keyboard does not work protected void paint (Graphics graphics)

    Hello

    I am facing a big problem. Need your help.

    I've implemented TouchEvent and VerticalFieldManager-> screen paint().

    TouchEvent works well. But the paint method is confusing after the virtual keyboard is displayed.

    My code is as follows:

    public MyScreen extends MainScreen {
    
        private VerticalFieldManager vfm = null;
    
        public MyScreen() {         super(MainScreen.NO_VERTICAL_SCROLL);         vfm = new VerticalFieldManager(Manager.USE_ALL_HEIGHT | Manager.USE_ALL_WIDTH){              protected void paint(Graphics graphics) {                   //paint methods              }         };    }
    
         protected boolean touchEvent(TouchEvent event) {         if(!event.isValid()) {        return false;   }         if(//Check touch conditon) {               //Do something               return true;         } else {               return super.touchEvent(event);         }     }}
    

    You can correct code above?

    This method of paint does not work after showing the keyboard.

    Thanks in advance.

    Thanks for your reply. Guy.

    I found my bug. This problem is related new instance in my code.

    If the keyboard does not at the present time, it seems that the screen height is decreased by the height of the virtual keyboard. It must be calculated in your code.

  • Paint graphics fonts problems

    I test on a storm Simulator.

    I want to change the font for my text in my custom buttonfield. the following is an excerpt from the paint - my custombuttonfield class method:

    protected void paint(Graphics graphics) {   Font originalFont = Font.getDefault();   try {        FontFamily fontFamily = FontFamily.forName("BBSansSerif");        Font.setDefaultFont(fontFamily.getFont(Font.PLAIN, 9, Ui.UNITS_px));    }   catch (Exception e) {         System.out.println(e.toString());   }   Font newFont = Font.getDefault();
    
       //painting
    
       //set the original font back   Font.setDefaultFont(originalFont);
    
    }
    

    When you run this code, I get a "Eception exception: Application does not; process is completed. Most of the time the screen is drawn, and then the error occurs. It sometimes occurs without painting the screen at all.

    To put this code inside an anonymous thread class, the screen is continuously repainting, which gives a "VM:THDRr = too_many_threads" on the console log. Finally the application crashes with an 'uncaught exception '.

    The code without the lines of code-fonts-all works fine.

    What I am doing wrong?

    Thank you.

    Two things:

    First of all, don't instantiate not a font within this routine of painting. There is a performance problem. Instantiate the police elsewhere and simply refer to the current font to object.

    Second, affecting policies precipitated an invalidate(), where another call to object. This is a recursive call, and there is no way out of this loop of 'painting '. Each call to object then change the font, causing another call to pain(). In the business, we call this the dreaded 'endless loop '.

    So, take care of #1 and #2 will disappear.

  • painting by pushscreen vs appeal explicit with graphics

    I try to get the 'screenshot' of the screen without using the Display.getScreenshot () method well.

    I have BitmapTestScreen that overrides the paint method and simply draws a bitmap on the screen

    public class BitmapTestScreen extends MainScreen
    {
    
        Bitmap img;
        /**
         * @param img               Img to draw to the screen
         */
        public BitmapTestScreen(Bitmap img)
        {
            this.img = img;
        }
    
        protected void paint(Graphics g)
        {
            g.drawBitmap(0, 0, img.getWidth(), img.getHeight(), img, 0, 0);
    
        }
    }
    

    When I try to do the following:

         Bitmap scrImg = new Bitmap(Display.getWidth(), Display.getHeight());
            MotionableScreen scr = new ScreenTwo();
    
            Graphics g = new Graphics(scrImg);
            scr.paintPUB(g);
    
            pushScreen(new BitmapTestScreen(scrImg));
    

    I get a blank screen... The MotionableScreen is simple and essentially provides the paint as painPUB method

    public abstract class MotionableScreen extends FullScreen
    {
    
        public void paintPUB(Graphics g){
            super.paint(g);
        }
    
    }
    

    But if I do:

    this.pushScreen(new ScreenTwo());
    

    I get the drawing good screen.

    The question is what I'm doing wrong then that if I come to a graphics object, I get a blank bitmap that is the screen is not fired?

    Thank you

    Max.

    Solved... You will need to call the doLayout() before calling in the paint (...).

  • Button in the pop-up screen problem

    Hi all

    I did a pop-up screen in which there are two buttons and an EditField. Now, I am faced with very weird problem. First button that I added in my code doesnot seem to work. It doesnot clicking and the second button is working well, why is it so can any body help out me of this.

    I provided the code here: -.

    public class PinPopup extends PopupScreen{
    public static  EditField texts;
    static String _userName=null;
    
    PinPopup()
        {
        super(new HorizontalFieldManager());
        Font f = Font.getDefault().derive(Font.BOLD, 16);
        setFont(f);
        texts=new EditField("","",200,Field.EDITABLE);
    
        ButtonField sendButton = new ButtonField(" Send  "){
            protected boolean navigationClick(int status, int time) {
                   Dialog.inform("Send");
                return true;
                }
        };
    
        ButtonField cancelButton = new ButtonField("Cancel"){
             protected boolean navigationClick(int status, int time) {
                   Dialog.inform("Cancel");
                return true;
                }
        };
    
        VerticalFieldManager _fieldManagerContext = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.USE_ALL_HEIGHT)
            {
    
                public void sublayout(int width,int height) {
                    //super.sublayout(width, height);
                    int xpos = 0;
                    int ypos = 0;
                    Field field = getField(0);
                    layoutChild(field, 280, 50);
                    setPositionChild(field, xpos, ypos);
                    Field field1 = getField(1);
                    layoutChild(field1, 280, 50);
                    setPositionChild(field1, xpos+20, ypos+80);
                    Field field2 = getField(2);
                    layoutChild(field2, 280, 50);
                    setPositionChild(field2, xpos+145, ypos+80);
                    setPosition(150, 220);
                    setExtent(300, 220); 
    
                   }
                    public void paint(Graphics graphics)
                    {
                        //graphics.setColor(Color.WHITE);
                        Font f = Font.getDefault().derive(Font.BOLD, 16);
                        graphics.setFont(f);
                        graphics.drawText("SEND PIN",90, 20,0,200);
                        graphics.drawText( _userName,110,40,0,200);
                        graphics.setColor(Color.WHITE);
                        super.paint(graphics);
                    }
    
            }; 
    
                  _fieldManagerContext.add(texts);
                  _fieldManagerContext.add(cancelButton);
                  _fieldManagerContext.add(sendButton);
                  add(_fieldManagerContext);
    
        }
    
    }
    

    Hi Please help me in this

    Thanks in advance

    Why do you not use Horizontalfieldmanager for horizontal alignment.

    This is the code and it works fine.

    package com.winit.mobiads.ui.screens;

    Import net.rim.device.api.ui.Color;
    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.Font;
    Import net.rim.device.api.ui.Graphics;
    Import net.rim.device.api.ui.component.ButtonField;
    Import net.rim.device.api.ui.component.Dialog;
    Import net.rim.device.api.ui.component.EditField;
    Import net.rim.device.api.ui.container.HorizontalFieldManager;
    Import net.rim.device.api.ui.container.PopupScreen;

    SerializableAttribute public class PinPopup extends PopupScreen {}
    public static EditField texts;
    public static String _userName = null;

    PinPopup()
    {
    Super (new HorizontalFieldManager());
    Police f = Font.getDefault () .derive (Font.BOLD, 16);
    setFont (f);
    texts = new EditField("","",200,Field.EDITABLE);
           
    ButtonField sendButton = new ButtonField ("send") {}
    protected boolean navigationClick (int status, int time) {}
    Dialog.Inform ("Send");
    Returns true;
    }
    };
         
    ButtonField cancelButton = new ButtonField ("Cancel") {}
    protected boolean navigationClick (int status, int time) {}
    Dialog.Inform ("Cancel");
    Returns true;
    }
    };

    HorizontalFieldManager _fieldManagerContext = new HorizontalFieldManager (USE_ALL_WIDTH)
    {
               
    ' public void sublayout (int width, int height) {}
    Super.sublayout (width, height);
    int xPos = 0;
    int yPos = 0;
    Field = getField (0);
                       
    setPositionChild (field, xpos, ypos);
    layoutChild (field, 280, 50);
                       
    Field Field1 = getField (1);
                       
    setPositionChild (Field1, xpos ypos + 80 + 20);
    layoutChild (Field1, 100, 50);

    Field Field2 = getField (2);
                       
    setPositionChild (Field2, xpos ypos + 80 + 145);
    layoutChild (Field2, 100, 50);
                       
    setPosition (150, 220);
    setExtent (width, height);
                        
    }
    public void paint (Graphics graphics)
    {
    graphics.setColor (Color.WHITE);
    Police f = Font.getDefault () .derive (Font.BOLD, 16);
    graphics.setFont (f);
    graphics.drawText ("SEND PIN", 90, 20,0,200);
    graphics.drawText (_userName, 110, 40, 0, 200);
    graphics.setColor (Color.WHITE);
    Super.Paint (Graphics);
    }
             
    };

    _fieldManagerContext.Add (texts);
    _fieldManagerContext.Add (CancelButton);
    _fieldManagerContext.Add (sendButton);
    Add (_fieldManagerContext);
                     
    }

    }

  • Custome Field took a nullpointexception in the labefiled and 7.1 paint method only you have this problem! Pls help me?

    KIM I create a custom entry field as below:

    public class AddEditField extends HorizontalFieldManager {
        private LabelField labelField;
        private EditField contentField;
        private RichTextField wrapaddField;
        HorizontalFieldManager textMgr;
        HorizontalFieldManager wrapMgr;
        private static final int HPADDING = Display.getWidth() <= 320 ? 6 : 8;
        Font font;
    
        public AddEditField(String label, Font font, int maxSpace) {
            this(label, 0, font, maxSpace);
        }
    
        public AddEditField(String label, long style, Font cfont, int maxSpace) {
            super(NO_HORIZONTAL_SCROLL);
            this.font = cfont;
            textMgr = new HorizontalFieldManager(HORIZONTAL_SCROLL | FIELD_VCENTER);
            wrapMgr = new HorizontalFieldManager(FIELD_VCENTER);
            wrapaddField = new RichTextField(RichTextField.TEXT_ALIGN_LEFT);
            long cstyle = 0;
            if (style == 0) {
                cstyle = EditField.NO_NEWLINE | EditField.FOCUSABLE
                        | EditField.EDITABLE | FIELD_VCENTER;
            } else {
                cstyle = EditField.NO_NEWLINE | EditField.FOCUSABLE
                        | EditField.EDITABLE | style | FIELD_VCENTER;
            }
            contentField = new EditField(cstyle) {
                protected void paint(Graphics graphics) {
    
                    // Font font = getFont().derive(Font.PLAIN, fontSize);
                    graphics.setFont(font);
                    graphics.setColor(0x666666);
                    super.paint(graphics);
                }
    
                protected void onFocus(int direction) {
                    super.onFocus(direction);
                    invalidate();
                }
    
                protected void onUnfocus() {
                    super.onUnfocus();
                    // if (VirtualKeyboard.isSupported()) {
                    // VirtualKeyboard vKeyboard =getVirtualKeyboard();
                    // vKeyboard.setVisibility(VirtualKeyboard.HIDE);
                    // }
    
                }
            };
            labelField = new LabelField(label, FIELD_LEFT | FIELD_VCENTER) {
                protected void paint(Graphics graphics) {
                    graphics.setColor(0x006699);
                    graphics.setFont(font);
                    super.paint(graphics);
                }
            };
            LabelField spaceF = new LabelField() {
    
                protected void layout(int width, int height) {
                    // TODO Auto-generated method stub
                    //super.layout(HPADDING, font.getHeight() + 10);
                    setExtent(HPADDING, font.getHeight() + 10);
                }
            };
            add(spaceF);
            add(labelField);
            final int space = maxSpace - font.getAdvance(labelField.getText());
            LabelField spaceF2 = new LabelField() {
    
                protected void layout(int width, int height) {
                    // TODO Auto-generated method stub
                    // super.layout(space, font.getHeight() + 10);
                    setExtent(space, font.getHeight() + 10);
                }
            };
            add(spaceF2);
            textMgr.add(contentField);
            wrapMgr.add(wrapaddField);
            add(textMgr);
        }
    
        public String getText() {
            return contentField.getText();
        }
    
        public void setText(String text) {
            synchronized (UiApplication.getEventLock()) {
                wrapaddField.setText(text);
                contentField.setText(text);
            }
        }
    
        public void setEditMode(boolean editable) {
            String text = wrapaddField.getText();
            synchronized (UiApplication.getEventLock()) {
                if (editable) {
                    contentField.setText(text);
                    if (wrapMgr.getManager() == this) {
                        delete(wrapMgr);
                    }
                    if (textMgr.getManager() != this) {
                        add(textMgr);
                    }
                } else {
                    if (textMgr.getManager() == this) {
                        delete(textMgr);
                    }
                    if (wrapMgr.getManager() != this) {
                        add(wrapMgr);
                    }
                }
            }
        }
    
    }
    

    Then I create: new AddEditField ("address:", cFont, maxSpace);  and add it to a screen.

    When I try to open this form. It is nullpointexception: the eclipse debugger show the info such as:

    AddEditField$ 4labelfield.paint line 385.

    Please help me to check the code. why it can run in 0 s 7.0 and before, only 7.1 has had this problem?

    Thank you

    Hi Flybrid,

    I checked at the time of your code,

    I am able to run your code by deleting page layout override methods in two fields of the label.

    The problem with the substitution of the method of layout in the spaceF and spaceF2 fields.

    But I can't explain why.

    I think that you can achieve the same thing by replacing getPrefferedWidth() and getPrefferedHeight() above the fields instead of page layout.

    Thank you.

  • Get the canvas/screen of an object as a bitmap graphics? Help with post processing filter!

    Let's say I want to create an effect of post-processing, such as changing the pixels of the screen in a color a little more red (AFTER this drawing), or do a screen wavey distortion.

    I thought that my layout as follows:

    final class MyPaintScreen extends FullScreen{
        //
        //... stuff here
        //
        public void paint(Graphics g){
            //all kinds of draw commands here, then
            //the post processing method is called
            PostProcesser.modify(g);
        }
    
    }
    final class PostProcesser{
        final static void modify(Graphics g){
            //here lies the problem.
        }
    }
    

    Ideally, the modify method would use the Graphics object as a parameter, and it would get her a bitmap or an array of bytes/int with the data drawn. Then she do all that the pixel values and then crush them to the Graphics object. Or maybe it would do all this without copying it in a bitmap/picture and just edit a graphic field directly.

    I thought that it would be a way to get an article / a region which was drawn (I want my post method only affect an area of the screen), but there is no method to return the screen stretched somehow, it seems. There is no Bitmap field in class Graphics to mess with. No table with the pixel values. No getBitmap/getRegion method.

    After thinking long and hard, I thought to use a sort of buffer to the screen. Have a Bitmap of the size of the screen and instead draw things on the screen, draw them on the Bitmap object, and then apply the post treatment methods he and then draws the Bitmap over together on the Graphics object... but it seems so memory intensive. Moreover, I have to use the thingies setARGB awful and messy the bitmap instead of the methods of the Graphics class Drawing.

    Any advice on that? Comments? Help? Suggestions?

    Just to confirm the approach of the buffer, you can create a bitmap image in the desired size, create a Graphics using the bitmap object, and then you can call 'paint' provide your own Bitmap, rather than the image of the screen image.

    You can also get it current graph of the screen using . getGraphics().

    Not sure this helps.  Good luck.

  • How to design own graphic interface for text entry

    Hello world

    I use the black background in my application and I would like to create my own custom controls which looks nice on a black background.

    For text input, I managed to create an entry of text with white background and black fonts. But I couldn't make the field to be a little larger than the text nor I was able to focus the State field.

    Code:

    public class CSTextField extends BasicEditField {}

    public {CSTextField()}

    Super (Field.FOCUSABLE |) Field.EDITABLE);

    }

    protected void paint (Graphics g) {}

    g.setBackgroundColor (Color.WHITE);

    g.setColor (Color.WHITE);

    g.fillRoundRect (0, 0, super. getWidth(), super. getHeight(), 5, 5);

    g.setColor (Color.GRAY);

    g.drawRoundRect (0, 0, super. getWidth(), super. getHeight(), 5, 5);

    g.setColor (Color.BLACK);

    Super.paint (g);

    }

    }

    See here: http://liechti-fotografie.ch/share/textfield.png

    Do you have an idea how realize that the focus is visible and the text field seems good?

    Thank you

    Do not design your own text input field - build a Manager around it that meets your needs.

    Here's an example of how this can be done:

    A scrolling line text entry field

    Read the comments - there are a few examples here on adding borders. I don't think you need boundaries, but they can give you ideas on how to position the fields in order to create some padding between the text and the surrounding black background.  You seem to be advanced enough to be able to easily change the code corresponding to your needs.

    Good luck!

  • Adding a LabelField with implementation in custom page &amp; paint freezes App.

    It's the absolute weirdest thing, I met so far. After error for about an hour, I narrowed down it to the following instructions.

    I have a class that extends the screen, I add the following to the constructor of the class and the App freezes each and ever time. The area of the label takes the string value of the variable title twice to create a white color with a slight black shadow text.

    That's it... nothing else.

    However, it freezes the App.

    There is something blatantly obvious that I'm missing?

    LabelField t = new LabelField() {
        int xy = 14;
    
        protected void layout(int width, int height) {
            setExtent(width, getPreferredHeight() + xy);
        }
    
        protected void paint(Graphics g) {
            g.setColor(Color.BLACK);
            g.drawText(title, xy, xy - 3);
            g.setColor(Color.WHITE);
            g.drawText(sportTitle, xy, xy - 2);
            invalidate();
            super.paint(g);
        }
    };
    
    Font font = Font.getDefault().derive(Font.BOLD | Font.SANS_SERIF_STYLE, 8, Ui.UNITS_pt);
    t.setFont(font);
    add(t);
    

    My first instinct is to delete your method invalidate() object.

    I'm sure that it's more than a typo in your case; in general, however, it is an extremely bad approach, aggravated by the frequency with which all kinds of 'gurus' use in their articles and responses. The endless loop it creates is 'soft', which means useful work will have a chance to be, but you'll be safer without him.

    However, there are other problems in your code:

    Your code layout() is not enough. When you extend a real (not abstract) field, you really want to use super.layout there is somewhere - if your super.paint won't know where to paint! Either extend the field and make all paint yourself (and then you could limit the layout to the right setExtent - but you really want to do more there, calculation of widths, positions, etc.), or call the super.layout somewhere.

    Your exersizes with two calls drawText will be spoiled by the later super.paint call. First call super.paint, then paint over it (in general, you should be careful with this approach, but here, it makes sense).

  • Make new graphic problem

    Hi im new in blackberry that I have a problem with the new methods of painting that I have a custom field and I want to make a new class of graphics to draw my pictures below is an example of what I want to do I how you see the idea about what I want to do. Is the right way to do it or is there a better solution for this

    package mypackage;
    Import net.rim.device.api.system.Bitmap;
    Import net.rim.device.api.system.Display;
    Import net.rim.device.api.ui.Color;
    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.Graphics;

    SerializableAttribute public class MyField extends {field}
    private int ttwidth;
    private int hhheight;
    graph graphic private;
        
    public MyField() {}
            
    }
        
    Protected Sub layout (int width, int height) {}
    ttwidth = Display.getWidth ();
    hhheight = Display.getHeight ();
    setExtent (ttwidth, hhheight);
    }
        
    protected void paint (Graphics g) {}
    image = g;
    test (Graphic);
    }
        
    {} public void test (Graphics g)
    Bit bitmap = new Bitmap (500, 500);
    Grap = g.create (bit) graphics;
    grap.drawText ("Test a drawing", 100, 100);
    image = grap;
    }
    }

    you get the graphics as a parameter object, and that it's empty, you can do whatever you want with it, no need to create a bitmap or a new graphic object.

  • method of painting slower typing speed

    Hi, I use CustomEditField in which I have more drive paint method. Every thing is good, but the problem I'm facing is that my type in the textfield slows down. I have several times the debugging and found that it is because of the paint method... Please someone give me suggestions for this...

    -----------------------------------------------------------------xxxxxxxxxx------------------------------------------------------------------------

    class CustomEditField extends EditField
    {
    Private boolean _focusableFlag;
    private String defaultText;

    public CustomEditField(String defaultText)
    {
    Super (FIELD_HCENTER);
    this.defaultText = defaultText;
    }

    {} public void setFocusable (boolean focusable)
    _focusableFlag = active;
    }

    protected void layout (int width, int height)
    {
    Width = Font.getDefault () .derive (Font.BOLD, Font.getDefault () .getHeight () - 2) .getAdvance ("transfer of my linked account") + 40.
    height = Font.getDefault () .getHeight ();
    Super.Layout (Width, Height);
    super.setExtent (width, height);
    super.setFilter (MyTextFilter.get (TextFilter.NUMERIC));
    }
    protected void paint (Graphics g)
    {
    setBorder (BorderFactory.createRoundedBorder (new XYEdges (5,5,5,5), 0xD0D0D0, Border.STYLE_SOLID));
    setBackground (BackgroundFactory.createSolidBackground (Color.WHITE));

    If (Super.GetText () .length () == 0)
    {
    g.setColor (0xD0D0D0);
    g.drawText (defaultText, 0, 0);
    g.Clear ();
    }

    g.setColor (0x484C54);
    Super.Paint (g);

    }

    }

    setBorder and setBackground outside the paint method call

  • appeal of painting in the class as xtends screen

    I'm quite new to blackberry programming, but I have a question. If I invoke paint in a class that extends screen Eclips gives me the following error message "Sub is an invalid type for variable painting."

    The app still seems to work perfectly. When I put on this screen a fieldmanager and run painting in that the error disappeared. The two just draw a simple circle on the screen.

    Why does this happen? code inserted below

    Error:

    public class UserInterfaceScreen extends MainScreen {
    
        HorizontalFieldManager FieldManager;
    
        public UserInterfaceScreen(){
    
            super();
            //FieldManager = new HorizontalFieldManager(Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH){
                protected void paint(Graphics graphics){
    
                    int DevScreenWidth = Display.getWidth();
                    int DevScreenHeight = Display.getHeight();
                    graphics.fillEllipse(DevScreenWidth/2, DevScreenHeight/2, (DevScreenWidth/2)+100, DevScreenHeight/2, DevScreenWidth/2, (DevScreenHeight/2)+100, 0, 360);
    
                }
        }
        //add(FieldManager);
    }
    

    No error:

    public class UserInterfaceScreen extends MainScreen {
    
        HorizontalFieldManager FieldManager;
    
        public UserInterfaceScreen(){
    
            super();
            FieldManager = new HorizontalFieldManager(Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH){
                protected void paint(Graphics graphics){
    
                    int DevScreenWidth = Display.getWidth();
                    int DevScreenHeight = Display.getHeight();
                    graphics.fillEllipse(DevScreenWidth/2, DevScreenHeight/2, (DevScreenWidth/2)+100, DevScreenHeight/2, DevScreenWidth/2, (DevScreenHeight/2)+100, 0, 360);
    
                }
        };
        //add(FieldManager);
    }
    }
    

    You try to set the method object within another method, which is syntactically incorrect.  Put before or after the code for the constructor and you'll be fine.

    The difference in the second case, is that you set paint inside a class - an anonymous HorizontalFieldManager extension, which is a place perfectly for the method definition.

  • Paint problem custom listfield - nullfield

    I created a listfield custom by extending the field manaagers, I use the nullfield for the effect of the update, but it does not work properly. I use two differnet layout for line manager who has no images and the other that contains images. The focus problem occurs only for lines that have pictures. I enclose the code below.

    The images appear correctly once I have the focus and remove on the line.

     //CONSTRUCTOR FOR BITMAPFIELD
        public CustomRow(String _headline, String _metadata, BitmapField bmF)
        {
            bitmapField = new BitmapField();
            bitmapField = bmF;
            _headText = new RichTextField(_headline,RichTextField.NON_FOCUSABLE);
            _metaData = new RichTextField(_metadata,RichTextField.NON_FOCUSABLE);
    
            _headText.setPadding(10, 10, 5, 10);
            _metaData.setPadding(0, 10, 10, 10);
    
            _focus = new NullField(NullField.FOCUSABLE);
            _focus.setFocusListener(this);
    
            bmpRowTextMang = new VerticalFieldManager(){
                public void sublayout(int width, int height)
                {
                    super.sublayout(Width * 3/4, height);
                    setExtent(Width * 3/4, height);
                }
            };
    
            bmpRowBmpMan = new VerticalFieldManager(){
                public void sublayout(int width, int height)
                {
                    super.sublayout(Width/4, height);
                    setExtent(Width/4, height);
                }
            };
    
            bmpRowTextMang.add(_headText);
            bmpRowTextMang.add(_metaData);
            bitmapField.setPadding(10, 10, 0, 5);
            bmpRowBmpMan.add(bitmapField);
            bmpRowMan =  new VerticalFieldManager(){
    
                public void sublayout(int width, int height)
                {
                    setPositionChild(getField(0), 0, 0);
                    layoutChild(getField(0), width, height);
    
                        setPositionChild(getField(1), 0, 0);
                    layoutChild(getField(1), width, height);
    
                    setPositionChild(getField(2),getField(1).getWidth() , 0);
                    layoutChild(getField(2), width, height);
    
                    int height1 = _headText.getHeight() + _metaData.getHeight();
    
                    if(height1<80)
                    {
                        height1 = 80;
                    }
                    setExtent(width, height1);
                }
    
                protected void paint(Graphics graphics)
                {
                    setHeightRow = this.getHeight();
                    graphics.drawLine(10, setHeightRow-1, Display.getWidth()-10, setHeightRow-1);
                    super.paint(graphics);
                }
    
                public int getPreferredHeight()
                {
                    return this.getHeight();
                }
            };
    
            bmpRowMan.add(_focus);
            bmpRowMan.add(bmpRowTextMang);
            bmpRowMan.add(bmpRowBmpMan);
            this.add(bmpRowMan);
        }
        public void focusChanged(Field field, int eventType) {
            // TODO Auto-generated method stub
            this.getManager().invalidate();
        }
        protected void paintBackground(Graphics g) {
              int prevBg = g.getBackgroundColor();
              if (_focus.isFocus()) {
                g.setBackgroundColor(Color.LIGHTBLUE);
              } else {
                g.setBackgroundColor(Color.WHITE);
              }
              g.clear();
              g.setBackgroundColor(prevBg);
            }
    
    }
    

    DEVICE BLACKBERRY BOLD 9780

    One thing to try is to substitute drawFocus do nothing:

    protected void drawFocus(Graphics g, boolean on) {
    }
    

    But the main problem must be somewhere in your sublayout substitutions. First of all, I am always wary with the help of a manager not abstract, never by calling its sublayout (such as super.sublayout). If you want to do this, substitute rather Manager. If your

    bmpRowMan =  new VerticalFieldManager(){
    

    should become

    bmpRowMan =  new Manager(){
    

    Another problem (this is not obvious and is repeated a lot of different people here) is using setExtent after the super.sublayout of a built-in Manager. Simply put - don't! If you change the width and height parameters before you go super.sublayout and want the Manager to have these exact width and height, set it with USE_ALL_WIDTH and USE_ALL_HEIGHT and filing the setExtent altogether! You pouvez use setExtent after super.sublayout, but you really need to know why you do this. An example is the code for this article in the knowledge base, but it feels more like a hack, you don't need:

    Implementation of a standard style scroll bar

    Good luck!

Maybe you are looking for

  • Emails in Mail.app look like programming language

    Departure of emails today in the Mail.app on my retina of MacBook Pro with Mac OS X 10.11.4 look like this: -MSGBOUNDARY_90b9148d-a760 - 42b 7 - be01 - 75bbf16c1d73 Content-Type: text/html; charset = "iso-8859-1". Content-Transfer-Encoding: 7 bit <!

  • HELP, after updating windows vista automatic service pack, cannot start windows

    After the update, I rebooted and now says windows will not be implemented. I don't know a thing about model .can not start windows the same for help. says I have no boot device and something about the material. I've learned to download windows 7 beta

  • error in windows live essential. Photo Gallery causes my pc down

    I had Windows Live essential on my Windows XP. For some time... When you use the Live Photo Gallery and upload new photos. my machine locks up and then crashed... The next time I loaded Photo Gallery, he had problems reading the odd file and on scree

  • recorded on adm.acct.being on fam.acct. search folder?

    Related to: Family Safety: frequently asked Questions Why does time spent on administrator ACCT. introduce yourself to the ACCT of family. search with the exact time and record names such as 'urlfcredscore.htm' or 'urlfalt.htm' or 'pdpalt.htm' or 'ur

  • Notification reason: 0xC004F059

    Separated from this thread. I also have this annoying problem Maybe I didn't validate windows when I bought this laptop from our telecommunications Co (Telkom) But its been almost 3 years now and now only having this problem? Thank you Diagnostic rep