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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:56:31+00:00 2026-05-14T02:56:31+00:00

I am currently working on my own implementation of a tab bar for a

  • 0

I am currently working on my own implementation of a tab bar for a BlackBerry app, where each tab bar has a title that is right aligned (i.e. the last character in each should be the same distance from the right hand side of the screen). To work out where to draw the text I am using the following calculation:

screen width – advance of title – indent.

The font I am using is ‘BBAlpha Sans’ (height 28). Using BlackBerry OS 4.6 everything seems to be calculated properly and the text is aligned when I move between tabs, however I am finding that when I use OS 5.0 it doesn’t calculate the advance properly and as a result the alignment is off by maybe 5 pixels or so. With the default font (also BBAlpha Sans, but height 24 – for OS 5.0 at least) it works fine in both versions.. but I don’t necessarily always want to use the default font/size, so any ideas what could be going wrong? Is this a bug in the 5.0 API?

Thanks.


Code:


public class TitleBarBackground extends Background {

..

public void draw(Graphics graphics, XYRect rect) {
  graphics.pushRegion(rect);
  ..
  Font titleBarFont = FontFamily.forName("BBAlpha Sans").getFont(Font.PLAIN, 28);
  ...
  int textWidth = titleBarFont.getAdvance(title);
  graphics.drawText(title, rect.width - textWidth - TITLE_OFFSET, textYOffset);
  graphics.popContext();
}

..

}
  • 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-14T02:56:32+00:00Added an answer on May 14, 2026 at 2:56 am

    Are you calling graphics.setFont(titleBarFont) before graphics.drawText()?

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

Sidebar

Related Questions

I'm currently working on a simple web application where users each have their own
Possible Duplicate: Programmatically delete my own app Currently I am working on a iphone
I am currently working on my own implementation of a MVC framework. I would
I am currently working on my own implementation of a PNG Filter. I am
I'm currently working with a PLC that supports ANSI C, but uses its own
I'm currently working on a my own neuroimaging toolbox that runs under MATLAB /
Currently working with converting SQLException error messages into messages that are more useful for
I'm currently working on my own PHP Framework, and I need some help figuring
I am currently working on my own little web crawler thingy and was wondering...
I am currently working on my own version of membership using Entity Framework 4.0

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.