question of substitution of painting of richtextfield

I replaced richtextfield then substituted the paint method.

Inside the paint method, I want to draw a string.

My goal is that the overridden class object is invalidated from the outside, and then because of the painting of invalidation method is called.

Inside the paint method, I have a chain already present in the form of a variable (which could be obtained somehow). Now, I want to draw this string.

If I use suprer.settext (string) inside the paint method, then it creates an infinite loop. I think it's because as settext() results in call to invalidate that once again calls paint which leads again call settext and therefore the lopp.

This is why I want to know how to draw the given string without that there is an infinite loop.

Just try to do:

If (! getText () .equals (string)) {}

super.setText (string)

}

Tags: BlackBerry Developers

Similar Questions

  • Question of substitution UIComponent

    in my UIComponent custom when I want addchildren, should I always be the substitution and with the

    protected function createChildren ?

    I notice I can use addChild anywhere without overriding the protected createChildren function and it still works.
    Should I not be doing this ?

    Thanks

    It's a good habbit follow Flex SDK Elements Visual cycle of life, because AS a character asynchrounous it is best to keep all the

    activities of the children creation and configuration in overrided createChildren() method, this will keep your class more organized and more predictable,

    Once you are free to addChild anywhere in the code, you could easily get lost in the chain and component initialization logic becomes difficult to track for you once the component is growing. My advice is to use the central task for the activity of creation, rather than random placed addChild calls... This will save you time in the future good luck

  • Fresh paint: muddy brush

    Hello

    I just installed the fresh paint on my surface and I'm pretty impressed.

    I have problems of blend from one color to the other. With the actual painting as you push between 2 colors the brush gets increasingly muddier, which allows to produce a mixture smooth between 2 colors. However here, as soon as I lift my finger, that the painting is clean again then try to refine the mixture is quite a challenge.

    So I have 2 questions.

    Fresh paint, can add the feature to allow the paint brush continue to get muddier as the brush goes on different colors?

    Someone at - it advice to achieve the right mix between colors?

    Thanks, has soon!

    Hey,.

    Take a look at this thread:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_8-Winapps/fresh-paint-questions-about-mixing-colors-and/578436a9-e975-48B6-9ba4-340ab0ffd804

    http://apps.Microsoft.com/Windows/en-in/app/fresh-paint/1926e0a0-5e41-48e1-ba68-be35f2266a03

  • Cannot be saved because the interrupted process (?) photo

    I have some pictures I want to change the "tiff" to "jpg". As soon as I got to save on painting a message pops up saying could not be registered as had been interrupted. I started the process from scratch with the same photo but with the same result. I have not tried the other photos.

    The only other thing I did was to change the name of the photo in question before going to paint.

    Just a suggestion...

    Get another .tiff image, right-click on > open with > paint > file > Save As > Save As Type, click on the pointer to the right, select JPG > save

    PS why use paint? You don't have the Snipping Tool?

    t-4-2

  • EditField / entry user of centering

    I use an EditField to seize a user. I would like to have the input focus in the field. The following code does what I'm looking for:

    EditField efName = new EditField(EditField.FIELD_HCENTER | EditField.NO_NEWLINE){
         public void paint(Graphics g){
        g.drawText(efName.getText(), 0, 0, DrawStyle.HCENTER, getWidth());
         }
    };
    

    The only issue I have with the above code is when I try to use the alt key to insert a comma or something else. When you press the ALT key the cursor moves to the middle of the screen temporarily until the additional text is entered. Is there a way to keep the cursor at the end of the text until I'm done with the rating?

    "I don't know exactly about how best to do it well."

    I would recommend onUnfocus/onFocus.  You must cancel and let the standard method of paint to paint the field when it has the focus (onFocus()) and invalidate() field again when it loses focus (onUnfocus()), but when focused not use your centered drawText method.  But I have never done this, I'd be interested to see how it works.

    "width of the Manager set to 330.

    I don't think that this stops an EditField via two lines.

    1 onFocus / onUnfocus - may be true, but since the TEP are the substitution of painting in any case, I would like this:

    protected void paint(Graphics g) {
        if (isFocus()) {
            super.paint(g);
        } else {
            g.drawText(efName.getText(), 0, 0, DrawStyle.HCENTER, getWidth());
        }
    }
    

    2 EditField wrap indeed if it is too long.  In order to limit the number of characters needed, create EditField with this maximum number of characters:

    EditField yourEditField = new EditField("label", "", , EditField.FOCUSABLE | ...);
    

    Otherwise EditField will be created with DEFAULT_MAXCHARS, which is 1 million...

  • setEmptyString does not work for me

    I use setEmptyString on ListField and does not show the chain when the list is empty.

    clues? by using the simulator of 9900

    THX

    Srinivas

    I was actually of the substitution of paint method and not calling does not super.paint so I wasn't able to make it work.

    an example of custom list where I can do this on my own?

  • Customizing the background color for an element ListField

    I spent the better half of today trying to figure out how to set the background color for when a ListField element has the focus. I tried the substitution of paint and drowFocus and can not get any color other than the default.

    Someone knows how to do this?

    Try something like that.

     public void drawListRow(ListField list, Graphics g, int index, int y, int w)
    {
        if(list.getSelectedIndex() == index)
        {
             g.setColor(0x0000FF);
             g.fillRect(0,(index*rowHight),rowWidth,rowHeight);
             g.setColor(0x000000);
        }
        g.drawText("Text", 0, y, 0, w);
    }
    

    PS: Call disabled, if the previous paint stays on the screen.

  • object change police

    Hey all,.

    I need to update the font size of a field when the element gets repainted. I tried get.setFont () and that has not worked. The reason why I can't do in the constructor of field is I'll be re-sizing of the police based on the resolution on the paint (for example, the storm tilts, the police will have to increase in size)

    Someone at - it suggestions? Also, if I'm generating a font based on a modifier (aka, = font size allows to say.. 20.0 * modifier), I derive a new police each painting, is there a better solution to this?

    Thank you.

    I'm not quite clear on what you have tried so far. My first guess would be the substitution of painting as:

    Protected Sub paint (figure net.rim.device.api.ui.Graphics) {}

    has changed the orientation of the screen?

    If so, change my fonts

    Super.Paint (Graphics);

    }

    You can probably also do it by substituting sublayout I think that is called every time comes a new orientation of the screen.

  • need some advice on TrackwheelListener and display screen

    public class NewApplication extends UiApplication {
        private MainScreen mainScreen;
        private static RichTextField enteredText;
    
            public static void main(String[] args)
            {
                    NewApplication theApp = new NewApplication();
                    theApp.enterEventDispatcher();
            }
    
            public NewApplication()
            {
    
                mainScreen = new MainScreen();
    
                enteredText = new RichTextField("", RichTextField.NON_FOCUSABLE) {
                    public void paint(Graphics graphics) {
                        graphics.setColor(Color.RED);
                        graphics.clear();
                        super.paint(graphics);
                    }
                };
    
                LabelField title = new LabelField("Banner",
                  LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH | LabelField.FIELD_HCENTER) {
                    public void paint(Graphics graphics) {
                        graphics.setBackgroundColor(Color.BLACK);
                        graphics.setColor(Color.WHITE);
                        graphics.clear();
                        super.paint(graphics);
                    }
                };
    
                mainScreen.setBanner(title);
    
                Font myfont1 = Font.getDefault().derive(Font.BOLD, 35);
                Font myfont2 = Font.getDefault().derive(Font.BOLD, 35);
                HorizontalFieldManager aahfm = new HorizontalFieldManager() {
                    public void paint(Graphics graphics) {
                        graphics.setBackgroundColor(Color.BLACK);
                        graphics.clear();
                        super.paint(graphics);
                    }
                };
                RichTextField blackaa = new RichTextField("user input -->    ", RichTextField.NON_FOCUSABLE | RichTextField.USE_TEXT_WIDTH) {
                    public void paint(Graphics graphics) {
                        graphics.setColor(Color.WHITE);
                        graphics.clear();
                        super.paint(graphics);
                    }
                };
                blackaa.setFont(myfont1);
                enteredText.setFont(myfont2);
                aahfm.add(blackaa);
                aahfm.add(enteredText);
    
                //Display the main screen
                pushScreen(mainScreen);
    
                //Create an instance of and display the custom dialog.
                EnterDialog textEntryDialog = new EnterDialog();
                textEntryDialog.show();
    
                mainScreen.setTitle(aahfm);
                mainScreen.add(new SeparatorField());
            }
    
            //Allow the Dialog to update the text by calling this method.
            public static void setText(String newText)
            {
                    enteredText.setText(newText);
            }
    }
    

    How to add the horizontalManagerField after the data of user input?
    the first screen was therefore only banner
    then after the input display user data using the horizontalManagerField

    class EnterDialog extends Dialog implements TrackwheelListener {
         private BasicEditField entryField;
    
         public EnterPinDialog()
         {
             super(Dialog.D_OK, "", 1, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), Manager.FOCUSABLE);
             entryField = new BasicEditField("Enter data : ", "", 8, BasicEditField.EDITABLE | BasicEditField.FILTER_PIN_ADDRESS);
             add(entryField);
         }
    
         public boolean keyChar(char key, int status, int time)
         {
             //Override key commands
             switch (key)
             {
                case Characters.ENTER:
                    //Update main class with the entered text.
                    if (entryField.getTextLength() < 8) {
                        Dialog.alert("must 8 character");
                        break;
                    }
                    blackkeygen.setText(entryField.getText());
                    this.close();
                    break;
                    //Override the backspace key to delete the last character.
                case Characters.BACKSPACE:
                    if (entryField.getTextLength() > 0) {
                        entryField.setText(entryField.getText().substring(0, entryField.getTextLength() - 1));
                    }
                    break;
                    //Override the escape key to delete the last character.
                case Characters.ESCAPE:
                    if (entryField.getTextLength() > 0) {
                        entryField.setText(entryField.getText().substring(0, entryField.getTextLength() - 1));
                    }
                    else if (entryField.getTextLength() == 0) {
                        System.exit(0);
                    }
                    break;
                    //Enter the character the user typed into the EditFie
                default:
                    entryField.setText(entryField.getText() + key);
                    break;
             }
             return false;
         }
         ////////////////////////////////////////////
         /// implementation of TrackwheelListener
         ////////////////////////////////////////////
         public boolean trackwheelClick(int status, int time) {
             if (entryField.getTextLength() == 8) {
                 blackkeygen.setText(entryField.getText());
                 this.close();
             }
             else {
                 Dialog.alert("must 8 caracter");
             }
             return false;
         }
    
         /** Invoked when the trackwheel is released */
         public boolean trackwheelUnclick(int status, int time) {
             return false;
         }
         /** Invoked when the trackwheel is rolled. */
         public boolean trackwheelRoll(int amount, int status, int time) {
             return true;
         }
    }
    

    trackwheelunclick n trackwheelclick works correctly, but the book didn't work? I already call the roll. I missed something?

    im a beginner in programming java n blackberry...
    Thanks before

    My first advice is to get rid of TrackwheelListener. It was not a Blackberry made with a wheel for years.

    It is replaced by navigationMovement().

  • Change the location of backup files saved in CS6?

    Hey all,.

    I use Photoshop CS6 and she put auto save every 10 minutes. I would like to have backup automatically but it keep save them to the desktop and then all this is a mass

    (same question because of Corel Painter) Is there a way to set a folder and make Photoshop Save there?

    Thank you.

    You specify what or readers to use as working disks in the preferences.

    In my case, this is drive G. It is time which files go.

    Photoshop does a folder with the name of PSAutorecover for the AutoSave files.

    for example

    G:\Photoshop Temp10867638828

    G:\PSAutoRecover\MyName\whatever. PSB

  • Program paint questions

    I just discovered this program and I am just learning how to use it.  I think it is simular to "smart scissors"... right?  My question how do I get rid of the background 'white '?  I figured out how to draw around a figure and copy & paste this figure to another "blank document" but I did not understand how to remove the white background remaining to superimpose this image/photo on another photo or background to make it look like that person is, say, standing on Main Street at Disneyworld.  Is that a possibility or should I look elsewhere?

    I'll be more than happy to send an attachment to anyone to explain my question better!

    Thank you...

    Jim K

    Portland

    I just discovered this program and I am just learning how to use it.  I think it is simular to "smart scissors"... right?  My question how do I get rid of the background 'white '?  I figured out how to draw around a figure and copy & paste this figure to another "blank document" but I did not understand how to remove the white background remaining to superimpose this image/photo on another photo or background to make it look like that person is, say, standing on Main Street at Disneyworld.  Is that a possibility or should I look elsewhere?

    I'll be more than happy to send an attachment to anyone to explain my question better!

    Thank you...

    Jim K

    Portland

    What ' paint program are questions on? If it is the program called Paint, which comes with Windows, you should know that he is among the most primitiive of all of these programs. You want to do something more than the simple things, you can buy a much more capable program: maybe Corel PaintShop Pro or Adobe Photoshop

  • Fresh paint - Questions on the mixture of colors and model packs

    Hi all

    I have 2 questions for fresh paint where I can not find an answer for.

    1. own models

    Fresh paint offers to buy packs of model that can be used for painting. I have a few models that I would use it as well. I know, it is possible to open an image and paint it, but there is a big difference. Models that are offered by the application itself have a big advantage - with a special button (showing a few mountains & Sun) to within the application, you can enable / disable the view to the model (which in fact becomes visible or hidden) as a kind of layer, so you can easily check your paint with and without the model. Is it possible to do both for own patterns / Images? When I used my own jpeg file 'mountains' button is not available.

    2 using the palette color mixing and putting them in one of the holes tiny 'color selector' on this issue - how is this possible and how can such color to delete as well?

    I would really like to know how the colors can be mixed / saved / deleted using (the Palette on). Sometimes, when I mixed 2 colors and used in my painting, the color is not yet available in the Palette itself for easy reuse, sometimes it will fill one of the spots on it, however for me ist currently unclear in this case - which makes it unpredictable. Will there be some indications on how to use the color scheme and its functions?

    Thank you very much

    André

    Hi all

    I have 2 questions for fresh paint where I can not find an answer for.

    1. own models

    Fresh paint offers to buy packs of model that can be used for painting. I have a few models that I would use it as well. I know, it is possible to open an image and paint it, but there is a big difference. Models that are offered by the application itself have a big advantage - with a special button (showing a few mountains & Sun) to within the application, you can enable / disable the view to the model (which in fact becomes visible or hidden) as a kind of layer, so you can easily check your paint with and without the model. Is it possible to do both for own patterns / Images? When I used my own jpeg file 'mountains' button is not available.

    2 using the palette color mixing and putting them in one of the holes tiny 'color selector' on this issue - how is this possible and how can such color to delete as well?

    I would really like to know how the colors can be mixed / saved / deleted using (the Palette on). Sometimes, when I mixed 2 colors and used in my painting, the color is not yet available in the Palette itself for easy reuse, sometimes it will fill one of the spots on it, however for me ist currently unclear in this case - which makes it unpredictable. Will there be some indications on how to use the color scheme and its functions?

    Thank you very much

    André

    Hello Andrew,.

    At this time, "Own Templates" are not supported.  This is a feature that is only supported for activity Packs that are published.

    Mixing of colors, custom colors mix you are only saved if you use somewhere in your paint.  Then, they are automatically saved in your palette.  Your custom palette is only applicable to an individual work you created with it.  There is no need to remove the colors we provide a long list, you can scroll through directly under the area of mixture.

    You can reposition your palette customized by drag-and - drop colors between the lodges on the palette.  This allows to reposition some colors in your well static tasks.  Well custom tasks will be to repopulate it based on the most frequently used colors.

  • Question on the paint bucket tool and the magic wand tool

    I try to learn Marie-illustration with PS

    I have a few question, since I'm new on this

    cartoon1.jpg

    first on the paint bucket tool, theres you can see, first of all I do preview, then fill with the pot of paint, but as you can see it, theres always have white line

    so I have to manually paint to fill the white line, is theres no adjustment so the filling does not leave any white line?

    the 2nd issue is on the quick magic wand tool

    cartoon2.png

    cartoon3.jpg

    I make selection to expose and make new layer that fills with a color

    but as you can see, for example, I use red.

    theres a red leak, so I mus manually erasing who

    is there a setting too for wand of the tool, if you fill the selection with the color.

    the color didn't cross the contour line

    so I'm just curious as to what you can change with a few settings, or his normal procces, so whatever it takes, you need cleaning by yourself

    Thank you

    Photoshop is more (or less) a graphical editor hatched (with a handful of vector tools). Tools like the paint bucket tool work on the paradigm of raster. You can set the tolerance in the toolbar options also high he'll go (255) to select (or fill) all the pixels of the layer.

    If you haven't already done so, try looking at Illustrator, because it is a vector editor; You can change the contours and funds of works of art on the fly and evolve it without losing quality to boot.

  • Questions of the font substitution during the creation of the PS file in Distiller PDF

    I don't know if this post should go under Distiller Server, but he doesn't know if there is a difference between X Distiller and Distiller Server.

    Context: I'm trying to convert postscript on my PC files that come from a single Mac built the program and unfortunately receive the following error message:

    %% [Warning: Helvetica not found, using Font Substitution.] Police cannot be incorporated. ]%%
    %% [Warning: Helvetica-Bold not found, using Font Substitution.] Police cannot be incorporated. ]%%
    %% [Warning: Helvetica-BoldOblique not found, using Font Substitution.] Police cannot be incorporated. ]%%

    When I try to convert postscript fonts to PDF in Acrobat Distiller X substitutes in the Arial font. I have a few versions of Helvetica on my PC but Distiller does not recognize them.

    My question is: How can I know distill, by default, to substitute for Helvetica loaded on my PC rather than Arial so that I have eliminated the error message and get specific pdf.

    Any help would be greatly appreciated.

    Thank you.

    You can use the files in distiller by going to settings.  See these two photos (click on it)

    I hope this helps.

  • Question about Windows 7 Microsoft Paint

    Previously in paint, I was able to get rid of the background with a tool called 'magic wand '.  Where is he?  I can't find in this new version.

    Magic wand does not exist in Microsoft Paint application more.

    If you are looking for a magic wand tool, or tools more, I'd recommend checking on Paint.NET - http://www.getpaint.net/index.html

Maybe you are looking for