BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-22-2007, 09:44 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Posts: 117
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Focus Problem

Please Login to Remove!

This code works fine...

Code:
FixedWidthEditField username  = new FixedWidthEditField("","",10, EditField.EDITABLE|EditField.FIELD_HCENTER|EditField.FOCUSABLE);

class FixedWidthEditField extends EditField
    {
        private Font defaultFont; 
        private String text; 
        FixedWidthEditField(String label, String initialValue, int maxNumChars, long style) {
            super(label, initialValue, maxNumChars, style);
        }   
        public int getPreferredWidth() {
            defaultFont = Font.getDefault();
       
            text = "000000000000000";
            return defaultFont.getAdvance(text);
        }
        protected void layout(int width, int height) {
            width = getPreferredWidth();
            height = super.getPreferredHeight();
            super.layout(width, getHeight());
            super.setExtent(width,getHeight()); 
        }
        protected void paint(Graphics graphics)
        {
            graphics.drawRect(1,1, getPreferredWidth() , getHeight());
            graphics.clear();
            super.paint(graphics);
        }
    }
but when i try to Paint the background of the editfield
Code:
graphics.setBackgroundColor(Color.ANTIQUEWHITE);
the focus is no longer visible....can somebody tell me how to solve it.
__________________
Thanks
Meenal
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

(5PCS) BR95320-WMN6TP IC EEPROM 32KBIT 5MHZ 8SOIC 95320 BR95320
$8.78
(5PCS) BR95320-WMN6TP IC EEPROM 32KBIT 5MHZ 8SOIC 95320 BR95320 pictureSEEQ DM52B33-300/B DM52B33H DQ52B33 8K x 8 EEPROM CDIP28 X 1PC
$6.99
SEEQ DM52B33-300/B DM52B33H DQ52B33 8K x 8 EEPROM CDIP28 X 1PC pictureNEO-6M APM 2.5 GPS Module Arduino EEPROM GY-NEO6MV2 Flight
$12.62
NEO-6M APM 2.5 GPS Module Arduino EEPROM GY-NEO6MV2 Flight picture25 SPI Flash USB Programmer Burner Chip CH341A Series 24 EEPROM BIOS Writer
$5.49
25 SPI Flash USB Programmer Burner Chip CH341A Series 24 EEPROM BIOS Writer pictureW/Software Driver USB Programmer Flash CH341A 24 25 Series DVD EEPROM Flash
$4.38
W/Software Driver USB Programmer Flash CH341A 24 25 Series DVD EEPROM Flash picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.