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 377961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:44:49+00:00 2026-05-12T14:44:49+00:00

I want to create a RichTextField at the bottom half of the screen, while

  • 0

I want to create a RichTextField at the bottom half of the screen, while I paint my own custom graphics at the top half of the screen. Is that possible in BlackBerry? It tried defining a LayoutManager and trying to position the RichTextField at the bottom of the screen but the RichTextField, scroll through the entire screen. This is the code for the LayoutManager(). Is it the right way or is there any other way to do what I have mentioned above.

class LayoutManager extends Manager 
{

  public LayoutManager() 
  { 
    //construct a manager with vertical scrolling    
    super(VERTICAL_SCROLL);
  }

  //overwrite the nextFocus method for custom navigation  
  protected int nextFocus(int direction, boolean alt)  
  {
        return super.nextFocus(direction, alt);
  }

  protected void sublayout(int width, int height) 
  {
    Field field;
    //get total number of fields within this manager
    int numberOfFields = getFieldCount();     
    int x = 0;
    int y = 0;
    System.out.println("******** Fields: " + numberOfFields + " W/H: " + width + " / " + height );
    for(int i = 0;i < numberOfFields;i++) {
      field = getField(i);      //get the field
      x = 20;
      y = 80;
      System.out.println("******** X/Y: " + x + " / " + y);
      setPositionChild(field, x, y);  //set the position for the field
      layoutChild(field, width, y);  //lay out the field
    }
    setPosition(0, 80);
    setExtent(width, 80);

  }

  public int getPreferredWidth() 
  {
   return 160;
  }

  public int getPreferredHeight() 
  {
    int height= 0;
    int numberOfFields= getFieldCount();

    for(int i= 0; i < numberOfFields; i++) 
    {
        height += getField(i).getPreferredHeight();
    }
    return 160;
  }
}
  • 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-12T14:44:50+00:00Added an answer on May 12, 2026 at 2:44 pm

    UPDATE – custom scrollbar

    custom scrollbar http://img146.imageshack.us/img146/7775/scroll.png

    VerticalFieldManager with custom size limitation and scrolling:

    class SizedVFM extends VerticalFieldManager {
        int mWidth;
        int mHeight;
    
        public SizedVFM(int width, int height) {
            super(VERTICAL_SCROLL | VERTICAL_SCROLLBAR);
            mWidth = width;
            mHeight = height;
        }
    
        public int getPreferredHeight() {
            return mHeight;
        }
    
        public int getPreferredWidth() {
            return mWidth;
        }
    
        protected void sublayout(int maxWidth, int maxHeight) {
            super.sublayout(maxWidth, maxHeight);
            setExtent(getPreferredWidth(), getPreferredHeight());
        }
    
        protected void paint(Graphics graphics) {
            super.paint(graphics);
            if (getVisibleHeight() < getVirtualHeight()) {
                int y1 = 0, y2 = 0, x1 = 0, x2 = 0;
                int scrollOff = getVerticalScroll();
                if (scrollOff > 0) {
                    y1 = scrollOff + 12;
                    y2 = scrollOff + 2;
                    x1 = getVisibleWidth() - 20;
                    x2 = getVisibleWidth() - 2;
    
                    graphics.setColor(Color.DARKRED);
                    int[] xPts = new int[] { x1, x2, x1 + 9 };
                    int[] yPts = new int[] { y1, y1, y2 };
                    graphics.drawFilledPath(xPts, yPts, null, null);
                }
                if (scrollOff < (getVirtualHeight() - getVisibleHeight())) {
                    y1 = scrollOff + getVisibleHeight() - 12;
                    y2 = scrollOff + getVisibleHeight() - 2;
                    x1 = getVisibleWidth() - 20;
                    x2 = getVisibleWidth() - 2;
                    graphics.setColor(Color.DARKRED);
                    int[] xPts = new int[] { x1, x2, x1 + 9 };
                    int[] yPts = new int[] { y1, y1, y2 };
                    graphics.drawFilledPath(xPts, yPts, null, null);
                }
            }
        }
    }
    

    Fields for painting and text:

    class HeaderPainting extends SizedVFM {
        BitmapField mBitmapField;
        public HeaderPainting(Bitmap bitmap, int width, int height) {
            super(width, height);
            add(mBitmapField = new BitmapField(bitmap, FOCUSABLE));
        }
    }
    class FooterText extends SizedVFM {
        ExRichTextField mTextField;
        public FooterText(String text, int width, int height) {
            super(width, height);
            int bgColor = Color.SANDYBROWN;
            int textColor = Color.DARKRED;
            add(mTextField = new ExRichTextField(text, bgColor, textColor));
        }
        class ExRichTextField extends RichTextField {
            int mTextColor;
            int mBgColor;
            public ExRichTextField(String text, int bgColor, int textColor) {
                super(text);
                mTextColor = textColor;
                mBgColor = bgColor;
            }
            protected void paint(Graphics graphics) {
                graphics.clear();
                graphics.setColor(mBgColor);
                graphics.fillRect(0, 0, getWidth(), getHeight());
                graphics.setColor(mTextColor);
                super.paint(graphics);
            }
        }
    }
    

    Example of using:

    class Scr extends MainScreen {
        HeaderPainting mBitmapField;
        FooterText mTextField;
        public Scr() {
            int width = Display.getWidth();
            int height = Display.getHeight() / 2;
            Bitmap bitmap = customPaint(width, height);
            String text = "Lorem ipsum dolor sit amet, consectetuer "
                    + "adipiscing elit, sed diam nonummy nibh euismod "
                    + "tincidunt ut laoreet dolore magna aliquam erat "
                    + "volutpat. Ut wisi enim ad minim veniam, quis "
                    + "nostrud exerci tation ullamcorper suscipit "
                    + "lobortis nisl ut aliquip ex ea commodo consequat. "
                    + "Duis autem vel eum iriure dolor in hendrerit in "
                    + "vulputate velit esse molestie consequat, vel "
                    + "illum dolore eu feugiat nulla facilisis at vero "
                    + "eros et accumsan et iusto odio dignissim qui "
                    + "blandit praesent luptatum zzril delenit augue "
                    + "duis dolore te feugait nulla facilisi.";
            add(mBitmapField = new HeaderPainting(bitmap, width, height));
            add(mTextField = new FooterText(text, width, height));
        }
        protected Bitmap customPaint(int width, int height) {
            Bitmap bmp = new Bitmap(width, height);
            Graphics graphics = new Graphics(bmp);
            graphics.setColor(Color.BLUE);
            graphics.fillRect(10, 10, width - 20, height - 20);
            graphics.setColor(Color.RED);
            graphics.fillRect(10, 10, 50, height - 20);
            return bmp;
        }
    }
    

    If you don’t like focus inside RichTextField see
    Blackberry Java: TextField without the caret?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want create a custom json data from the mssql 2008 results so that
I want to create a simple Blackberry app that plays an audio file whenever
I want create wordpress website into which I want create user management... That means
I want to create a new field (or two) in my table that is
i want create a counter that retrieve the number of month, day, hour, minute
I want to create a rectangle glass and a menu exact like that is
Guys I want create files for check somethings, and create my owner custom rules,
I want create texture atlas(matrix of images) from multiple images.Is their any applescript that
I want create a cache so that when an item doesn't exist, only one
I want create a function that verify if the numbers of a list fall

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.