Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 505619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:37:01+00:00 2026-05-13T06:37:01+00:00

i want to create 2 buttons for blackberry which look like this… alt text

  • 0

i want to create 2 buttons for blackberry which look like this…alt text http://img260.imageshack.us/img260/3285/button2.jpg

and the second one inverted of the above

i wanted to do this without using images (for efficiency) and the buttons should appear only when there is focus on them and dis sapper when focus goes off..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:37:02+00:00Added an answer on May 13, 2026 at 6:37 am

    ArrowButtonField as a Field extention:

    class ArrowButtonField extends Field {
        public static final int TYPE_UP = 0;
        public static final int TYPE_DOWN = 1;
    
        private int mBackgroundColor = Color.WHITE;
        private int mFillColor = Color.CRIMSON;
        private int mWidth = 20;
        private int mHeight = 12;
        private int mArrowType = TYPE_UP;
    
        public ArrowButtonField(int bgColor, int fillColor, int arrowType) {
            super(FOCUSABLE);
            setMargin(0, 0, 0, 0);
            setPadding(0, 0, 0, 0);
            mArrowType = arrowType;
            mBackgroundColor = bgColor;
            mFillColor = fillColor;
        }
    
        // cancel theme border and background style
        protected void applyTheme(Graphics arg0, boolean arg1) {
        }
    
        protected boolean navigationUnclick(int status, int time) {
            fieldChangeNotify(0);
            return true;
        }
    
        protected void onUnfocus() {
            invalidate();
            super.onUnfocus();
        }
    
        protected void paint(Graphics graphics) {
            graphics.clear();
            graphics.setColor(mBackgroundColor);
            graphics.fillRect(0, 0, mWidth, mHeight);
            if (isFocus()) {
                graphics.setColor(mFillColor);
                int xc = 10;
                int y1 = 0, y2 = 0, x2 = xc - 9, x1 = xc + 9;
    
                switch (mArrowType) {
                case TYPE_DOWN:
                    y1 = 11;
                    y2 = 1;
                    break;
                case TYPE_UP:
                    y1 = 1;
                    y2 = 11;
                    break;
                default:
                    break;
                }
                int[] xPts = new int[] { x1, x2, xc };
                int[] yPts = new int[] { y1, y1, y2 };
                graphics.drawFilledPath(xPts, yPts, null, null);
            }
        }
    
        public int getPreferredWidth() {
            return mWidth;
        }
    
        public int getPreferredHeight() {
            return mHeight;
        }
    
        protected void layout(int width, int height) {
            setExtent(mWidth, mHeight);
        }
    }
    

    Classes for Up and Down Arrow:

    class UpArrowButtonField extends ArrowButtonField {
        public UpArrowButtonField(int backgroundColor, int fillColor) {
            super(backgroundColor, fillColor, TYPE_UP);
        }
    }
    
    class DownArrowButtonField extends ArrowButtonField {
        public DownArrowButtonField(int backgroundColor, int fillColor) {
            super(backgroundColor, fillColor, TYPE_DOWN);
        }
    }
    

    Sample of use:

    class Scr extends MainScreen implements FieldChangeListener {
        UpArrowButtonField arrowUp;
        DownArrowButtonField arrowDown;
    
        public Scr() {
            arrowUp = new UpArrowButtonField(Color.WHITE, Color.RED);
            arrowUp.setChangeListener(this);
            add(arrowUp);
            arrowDown = new DownArrowButtonField(Color.WHITE, Color.RED);
            arrowDown.setChangeListener(this);
            add(arrowDown);
        }
    
        public void fieldChanged(Field field, int context) {
            if (field == arrowUp) {
                Dialog.inform("UP");
            } else if (field == arrowDown) {
                Dialog.inform("DOWN");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to create links looking like buttons with dynamic text
I want to create android buttons but the look something like the one in
In this example I create three buttons 'one' 'two' 'three'. When clicked I want
I have created a splash screen in which i want to create two buttons
I want to create a custom View which contains two buttons without using xml.
I want to create buttons like these: In modern browsers the effect is created
I want to create an NSOutlineView subclass where some of the entries look like
In my application I want to create buttons, minus the whole button part. Like
I want to create a linear layout with buttons and text but I need
I want to create and then destroy buttons, all with code, but can't find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.