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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:47:40+00:00 2026-06-05T13:47:40+00:00

I need to create a Customised PopUp to work like a ToolTip How can

  • 0

I need to create a Customised PopUp to work like a ToolTip How can i achieve it
i have worked on a code please check out and tell me where i need improvement

import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.PopupScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;


    public class ToolTip extends PopupScreen{

        private static VerticalFieldManager vfm;
        private LabelField lbl;
        private int xPosition;
        private int yPosition;
        private String message;
        public ToolTip(String message,int xPos,int yPos){
            super(vfm);
            this.xPosition=xPos;
            this.yPosition=yPos;
            this.message=message;
            vfm=new VerticalFieldManager(){
                protected void paint(Graphics graphics) {
                    graphics.setColor(0x00FFFFFF); 
                    graphics.fillRect(0,0,getWidth(),getHeight());
                    graphics.setColor(0x00000000);
                    graphics.drawRect(0,0,getWidth(),getHeight());
                    super.paint(graphics);
                }       

            };

            lbl=new LabelField(message);
            vfm.add(lbl);
        }

        protected void sublayout(int width, int height) {
            super.sublayout(width, height);
            setExtent(lbl.getPreferredWidth(), lbl.getPreferredHeight());
            setPosition(xPosition, yPosition);


        }

    }

i get an error of NullPointer Exception at super(vfm) because vfm is null when i use it as follows . How can i optimise my code .

ButtonField bf1=new ButtonField("Login"){
            protected boolean navigationClick(int status, int time) {

            UiApplication.getUiApplication().pushScreen(new ToolTip("Hello ", 50, 50));
                return super.navigationClick(status, time);
            }

        };
        add(bf1);
  • 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-06-05T13:47:42+00:00Added an answer on June 5, 2026 at 1:47 pm

    Pass an initialized instance of VerticalFieldManager to super(..) of PopupScreen. Check following code.

    class ToolTip extends PopupScreen {
        private static VerticalFieldManager vfm = new VerticalFieldManager() {
            protected void paint(Graphics graphics) {
                graphics.setColor(0x00FFFFFF);
                graphics.fillRect(0, 0, getWidth(), getHeight());
                graphics.setColor(0x00000000);
                graphics.drawRect(0, 0, getWidth(), getHeight());
                super.paint(graphics);
            }
        };
    
        // other codes
    
        public ToolTip(String message, int xPos, int yPos) {
            super(vfm);
            // other codes
        }
    
        protected void sublayout(int width, int height) {
            // other codes
        }
    }
    

    Updated code for custom background support

    class ToolTip extends PopupScreen {
        private int xPosition;
        private int yPosition;
    
        public ToolTip(String message, int xPos, int yPos) {
            super(new VerticalFieldManager());
    
            // Define and set background here
            // Use - BackgroundFactory.createBitmapBackground(bitmap) for bitmap background
            getDelegate().setBackground(BackgroundFactory.createSolidBackground(Color.RED));
    
            // Add other UI Field here
            this.xPosition=xPos;
            this.yPosition=yPos;
    
            add(new LabelField(message));
            // other codes
        }
    
        // Empty implementation of this will disable default rounded border.
        protected void applyTheme() {
        }
    
        protected void sublayout(int width, int height) {
            super.sublayout(width, height);
            setPosition(xPosition, yPosition);
        }
    }
    

    You need to use getDelegate().setBackground(..) to set the background. Check the class BackgroundFactory for creating custom background.

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

Sidebar

Related Questions

I need create clone repository. but I do not know where can I get
I need create a document word with Java. And I ask, how can I
I have dynamically created WrapPanel (_wp) with several Borders. And I need create handler
Need to create a custom DNS name server using C which will check against
I need to create my own grid which will have customized paging and sorting.
Gonna need some advice for my work. In my computer I have installed VS2010
In my C# application I need to create a .resx file of strings customized
I need create custom dialog and put JPanel into it. Is it possible?
i need create an email list sending to many emails. what is best solution
i need create a variable with parent subclass. Example: Parent Class <?php class parentClass

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.