drawFocus and paint

OK, I feel like I've lived all possible resources but still do not get it

public class BitmapButtonField  extends BaseButtonField{
    private Bitmap[] _bitmaps;
    private static final int NORMAL = 0;
    private static final int FOCUS = 1;

    public BitmapButtonField( Bitmap normalState )
    {
    this( normalState, normalState, 0 );
    }

    public BitmapButtonField( Bitmap normalState, Bitmap focusState )
    {
    this( normalState, focusState, 0 );
    }

    public BitmapButtonField( Bitmap normalState, Bitmap focusState, long style )
    {

    super( Field.FIELD_HCENTER | Field.FIELD_VCENTER | Field.FIELD_BOTTOM |Field.FOCUSABLE );

    if( (normalState.getWidth() != focusState.getWidth())
    || (normalState.getHeight() != focusState.getHeight()) ){

    throw new IllegalArgumentException( "Image sizes don't match" );
    }

    setPadding(10,10,10,10);

    _bitmaps = new Bitmap[] { normalState, focusState };

    }

    public void setImage( Bitmap normalState ){
    _bitmaps[NORMAL] = normalState;
    invalidate();
    }

    public void setFocusImage( Bitmap focusState ){
    _bitmaps[FOCUS] = focusState;
    invalidate();
    }

    public int getPreferredWidth() {
        return _bitmaps[NORMAL].getWidth()+10;
    }

    public int getPreferredHeight() {
        return _bitmaps[NORMAL].getHeight()+10;
    }

    protected void layout( int width, int height ) {
    setExtent( _bitmaps[NORMAL].getWidth(), _bitmaps[NORMAL].getHeight() );
    }

    protected void paint( Graphics g ) {

        int index = g.isDrawingStyleSet( Graphics.DRAWSTYLE_FOCUS ) ? FOCUS : NORMAL;
        g.drawBitmap( 0, 0, _bitmaps[index].getWidth(), _bitmaps[index].getHeight(), _bitmaps[index], 0, 0 );

    }

    /**
    * With this commented out the default focus will show through
    * If an app doesn't want focus colours then it should override this and do nothing
    **/
    /*
    protected void paintBackground( Graphics g ) {
    // Nothing to do here
    }

    */

    protected void drawFocus( Graphics g, boolean on ) {
    // Paint() handles it all

        g.setDrawingStyle(Graphics.DRAWSTYLE_FOCUS, true );
        paintBackground(g);
        paint(g);
    }

}

How can I make the image to highlight with a color circle or something. I think I'm guess ovewrite the paintBackground but with what? When I put g.setBackgroundColor (Color.YELLOWGREEN); in painting, it colors the whole bitmap

We do not understand what is in BaseButtonField, so there may be a problem here, but everything I do is substitute drawFocus because I only want to highlight a small part of my field.

protected void drawFocus (final graph graphics, final boolean on) {}
drawHighlightRegion (graphics, Field.HIGHLIGHT_FOCUS, 0, 0, 48, 48);

}

Chris

Tags: BlackBerry Developers

Similar Questions

  • Brush Tip in CS4 and paint brush w advanced icons icons

    Why in Photoshop CS4 is no icons tip brush paint on the edges of the line wiped out icon. They all paint pixels (etc.) 4 to 5 behind the line of brush tip. CS2 and painted 3 deaths on the dotted line of brush if you want. -What I am missing how to do? in CS4? I'm not painting with the brush and the BRUSH. I expect the brush tip icon to show me exactly what area I'm going to paint. Am I wrong?

    This could be a case where someone has changed

    System Preferences > universal access > mouse > cursor size

    "to something else than ' normal '?

  • having xp on HPpavilion dv9000 should help to use the screenshot and painting program

    What is the sequence to make a screenshot of a web page and paste nit in ms paint?

    Take a screenshot of the entire desktop press Combination, take a screenshot of just the active window Alt + combinationpress. Now open Paint and select Paste or use Ctrl + V to paste. He must now paste the screenshot in Paint; Now you can use record under to save the image in the format (.jpg, .png, .bmp, .gif, etc.) you want and choose where the file should be saved.

    I hope this helps.

  • FreeCell and paint has been removed. How to restore (on Windows XP)?

    Frecell and the paint has been removed.  How to restore (on Windows XP)?

    Hi Louis590,

    Please see the next about the painting thread:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-windows_install/how-do-i-re-install-MS-paint/3aef9c72-e6e0-4d27-b7d8-e182d759a3f3

    And the following about freecell:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-system/reinstall-XP-games/05868730-7703-490c-B045-3d1760956037

    I hope this helps!

  • Line and Paint Bucket tools headaches

    OK so I'm not very good at drawing with my hand, but I can do a decent bit of art with the online tool and then manipulate the lines of the way I want them to be. I also need to use a "Width" which is not strong, but the curves (1st image as example). My problem is filling in sections with colors using paint with these conditions. I need to have "object drawing Mode OFF' to fill in the blanks. However at the joints it starts to do weird things. The first picture shows (for example) how I want the online tool to make the final product looks like, but requires that I use "object drawing Mode WE" who let me use the paint bucket tool to fill the white central room. If I use "Object drawing Mode OFF"I get the picture 2nd as a result. How do I fix this so I can get something that looks like the first image, but allows me to fill in the blanks with a new color using the paint bucket tool? Thank you in advance.

    Object Drawing On.png

    Object Drawing Off.png

    1. draw your hash table as you have using the object Mode:

    2 using the selection tool select the drawing that you want to fill:

    3. in the section fill and stroke of the Properties window, you will see three options. Select expand to fill in on the left.

    4 using the paint bucket tool, fill the Center:

  • I use Photoshop CC 2015... The tool eyedropper and paint bucket tool have stopped working all of a sudden. They both have a strange shape in their box now and I can't choose one of them. I have an install and re install photoshop and then creative cl

    photoshop_issue.png

    They are not the paint bucket tool or the eyedropper tool. It looks like the cc 2015... Edit feature of the toolbar was used to remove the pipette and bucket tool in the toolbar of paint.

  • Unknown cursor/drawing and painting problem

    bandicam 2016-02-17 18-31-47-913.jpg

    (In the photo) appeared earlier today and I cannot yet understand how get rid of it. I can't draw, paint or select options on my picture - I can - with her even if I click on my different tools. I want that it to go, but I don't know what it is, or even to figure out how it got there. Can someone explain what it is and how to get rid of?

    It appears on objects that have the locked layer? And you try to use a tool, you can not.

  • I've just updated CC 2015 and paint bucket expenses has disappeared! It is not under the gradient either tool. Any help?

    I'm working on a piece for someone and I really need the paint bucket tool to change.

    Hi ambii_anne,

    Greetings.

    Try resetting the preferences if you are sure that the paint bucket is not there in the tools.

    Concerning

    Rohit

  • Rounded corners and paint bucket tool

    Hello everyone. First of all, I should mention that I'm kind of a newbie with PS, so go easy on me.

    I have been using the bucket tool to fill the bottom of a few images, but after a while the color I selected resulted in a different shade. For example, black lead in gray, and so on. What can be the source of this? I accidentally selected something that does?

    Another problem I have is to create corners rounded for a picture. I used this tutorial http://www.websitemagazine.com/content/blogs/posts/archive/2008/09/03/round-corners-in-pho toshop.aspx and it worked great the first few times, but the area around the corners became white instead of transparent. I did tell them apart exactly as in this tutorial, but without effect.

    Example: it looks ok, but it's because the white background of the page, move it to a place that is colored and white areas appear.

    http://desmond.imageshack.us/Himg818/scaled.php?server=818&filename=18449469.png&res=landing

    Also, it is average another, easier to create the rounded corners?

    Thank you for your time.

    When the paint bucket tool is active, look at the Options bar. Maybe the opacity is less than 100%. If you are you pour the paint into a layer above that is sampled, then perhaps the opacity of the layer or fill is less than 100%.

    For rounded corners, draw a path, not a shape, with the rounded, Rectangle tool, and then simply add a vector mask that contains the path of your image layer. To add the virtual computer, target the layer and mask path access then Cmd/Ctrl-click on the Add button at the bottom of the layers panel.

  • What are the causes of network culture and painting to be multiple pointers?

    Culture and the paint bucket pointers consist of 3 pointers side by side.  They are arranged in this way *.  They cover about half an inch and they are a bit thin.  It is difficult to determine the point where the action takes place.

    This is a bug in PSE - you'll need to reduce the size of text in Windows display any value less than 150%.  See this FAQ:

    http://www.johnrellis.com/psedbtool/Photoshop-elements-FAQ.htm#_Setting_the_Windows

  • Photoshop CS4 type tool and paint bucket

    I'm teaching my students Photoshop CS4 and have started to have problems, I've ever met.

    Problem #1 - text tool will not work. We can create a text box and type in it. Text does not appear on the document, but appears in the layers palette. I made sure the layer is on top and text is not too large for the text box font color contrast the background. I have looked at the character and paragraph palettes you are looking for something unusual but found nothing.

    Problem #2 - the paint bucket is "stuck" on one color. Any sample of the color I chose, the color does not change. I created new documents and also closed and reopened the program but that didn't help either.

    Enyone met these problems? How you solve the problem?

    1st thing I would do is put him tools. I use a Mac and CS3, but I think he's still in the same place on CS4 and Windows:

  • Calculator, games and painting is no longer in my programs menu all the

    don't know what happened... it has been a few months.

    Hello

    Install / add games and related things refer: http://support.microsoft.com/kb/307768

    I hope this helps.

  • How to have the same parameters of brush brush Eraser and paint

    Hi, I was wondering if there is a way to define the gum and brush in photoshop are always the same.

    now, I often change the settings or move the brush when I switch between the tools.

    I like to keep the same brush and parameters during these two tools.

    There is no built-in feature to block them all. You intentionally and manually configure identically (using predefined settings or otherwise), then you can just switch between them using the shortcuts to the key letter, b and e.

  • Component problem, transparency and paint custom paint

    It is a little weird to describe problem so I tried to compact an example I can in small. I have a component that goes to a defined framerate, so it has a runnable interface and loop through and call repaint() on himself. If the component is not in a loop to repaint there is no problem, he draws the JInternalFrame transparent very well, but when he loop it creates a reall mess, sort of 'pulse' draw the background all wrong, and the buttons that you hover over appear in the upper right of the pane, its really weird.

    In any case, I was wondering if someone could take a look at my sample code and see if they can see what's wrong with it:
    import java.awt.Color;
    import java.awt.Graphics;
    
    import javax.swing.JDesktopPane;
    import javax.swing.JFrame;
    import javax.swing.JInternalFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    
    
    public class Test extends JFrame
    {
         public Test()
         {
              this.setVisible(true);
              this.setSize(1000, 600);
              JDesktopPane dtp = new JDesktopPane();
              this.add(dtp);
              
              JInternalFrame internalFrame1 = new  JInternalFrame("frame1",true,
                        true,true,true);
              internalFrame1.setLocation(100, 100);
              internalFrame1.setSize(300, 300);
              internalFrame1.setVisible(true);
              internalFrame1.setBackground(new Color(250,0,0,50));
              internalFrame1.setOpaque(false);
              dtp.add(internalFrame1);
              
              JInternalFrame internalFrame2 = new  JInternalFrame("frame2",true,
                        true,true,true);
              internalFrame2.setLocation(500, 100);
              internalFrame2.setSize(300, 300);
              internalFrame2.setVisible(true);
              internalFrame2.setBackground(new Color(250,0,0,50));
              internalFrame2.setOpaque(false);
              internalFrame2.add(new JLabel("check transparency on this"));
              dtp.add(internalFrame2);
              
              CustomPaintComponent cpc = new CustomPaintComponent();
              
              internalFrame1.add(cpc);
              
              this.validate();
         }
         
         public static void main(String args[])
         {
              Test t = new Test();          
         }
         
         class CustomPaintComponent extends JPanel implements Runnable
         {
              public CustomPaintComponent()
              {
                   Thread thread = new Thread(this);
                   thread.start();
                   this.setOpaque(false);
                   
              }
              
              public void paintComponent(Graphics g)
              {
                   super.paintComponent(g);
                   g.drawOval(0, 0, 50, 50);
                   g.drawString("CustomPaintComponent", 10, 10);
              }
    
              @Override
              public void run()
              {
                   while(true)
                   {
                        try
                        {
                             System.out.println("repainting!");
                             Thread.sleep(100);
                             repaint();
                        } catch (InterruptedException e)
                        {
                             e.printStackTrace();
                        }
                        
                   }
              }
         }
    }

    I'm under JDK 1.6.0_24 on Windows XP

    CustomPaintComponent cpc = new CustomPaintComponent() {
      @Override public void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor( new Color(250,0,0,50) );
        g.fillRect(0, 0, getWidth(), getHeight());
    
        g.setColor( Color.BLACK );
        g.drawOval(0, 0, 50, 50);
        g.drawString("CustomPaintComponent", 10, 10);
      }
    };
    //internalFrame1.add(cpc);
    internalFrame1.setContentPane(cpc);
    //or
    //JComponent c = (JComponent)internalFrame1.getContentPane();
    //c.setOpaque(false);
    //c.add(cpc);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    

    Published by: aterai on 08/03/2011 21:59

  • ListField: why complexity?

    Hello everyone.

    I'm trying to do something that should be very simple.  I'm doing a ListField, filling and drawing, which was not a simple task.  Now, I'm doing a row of buttons at the bottom of the ListField so that I can load or remove the selected menu item.

    I want the list to occupy the top of the page 300 pixels of the screen and scrolling in the 300 pixels, and I want the buttons to raise the low 60 pixels (locked in landscape mode).

    I tried a bunch of things:

    -paint using graphics.fillRectangle buttons, etc. and catch the touchEvent, but when the list scrolls buttons not painted at the bottom of the screen, they scroll up with the list?

    -make a child class of ListField that redraws the buttons at the bottom of the screen on drawFocus and paint, also sets the preferred height of 300px.  There is nothing to help the situation

    ANY help would be appreciated!  Thanks in advance guys!

    -paul

    I suggest you add your buttons in the status area on your screen (setStatus()).

    The trick here is that you are trying to achieve with fields, you should really use managers to do.  If you need to add your ListField to a manager who is always 300 pixels high (you can use the sublayout method to impose the operation), and let the scrolling ListField statement.  Then you must create a high 60 Manager that you add after the 300 high Manager and you add buttons to it.

    However just add your buttons to a HorizontalFieldManager and adding then the HFM to the status area should do it for you also.

    Give it a go and let us know.

Maybe you are looking for

  • Reverse scrolling option on s7 - 392

    So I just got a S7-392-9890.  I really don't like having to scroll upward on the trackpad to do something down the screen.  I found the Synaptics ClickPad v8.1 settings in the control panel and found the box for 'enable reverse scroll '.  But it won'

  • Overview of the Mac and TeXShop print not PDF correctly on Laserjet 600 M601

    Hi all New here and of course with an insoluble problem. Since the upgrade to: (10.8.3), one Mountain Lion iMac and new HP printer, I cannot preview either no Mac or TeXShop to PDF print correctly on my printer HP Laserjet 600 M601 (this by the way i

  • DHCP relay does not not in in-band mode

    Hi Faisal,. wireless client does not have dhcp via a CAS server server ip address,. Here's the scenario, 1. inband case network configuration: Trust interface (for protected network) Untrusted interface (network management) IP address Subnet mask Def

  • BlackBerry smartphones more smileys in BBM

    I was wondering if anyone else think BBM lack little variety in the smileys? Free applications like whatsapp seem to have a selection of them much better... All the world agree with that? A way to get more smileys on bbm? Thanks for your replies!

  • Question on the browsers on the storm blackBerry Smartphones

    Hello everyone, I have a few questions about web browsers and the storm. If I still want to use a specific browser to a certain website how can I do this? The firefox browser remember passwords and login information? Is this a secure way to hold this