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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:40:05+00:00 2026-05-15T17:40:05+00:00

I am a Blackberry java developer. I am trying to develop a simple slot

  • 0

I am a Blackberry java developer. I am trying to develop a simple slot machine logic. I am new to animated graphics etc in blackberry. So, can anyone tell me how to design a simple slot machine where on pressing a button the images in 3 blocks must start rotating and after it stops the prizes will be displayed according to the pics. So can u plz help me with some samples or tutorials of how to do it…

Edit: I am developing it just as fun application that doesnt involve any money transactions. So, any Blackberry developers plz guide me how to achieve the task and to spin the three images on click of a button…

  • 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-15T17:40:06+00:00Added an answer on May 15, 2026 at 5:40 pm

    This is a simple example but you will have to deal with decoration, smooth rolling etc yourself.

    Let’s say you have 6 images 70×70.
    Simple BitmapField extension to paint current slot image, half of image above and half of image below:

    class SlotField extends BitmapField {
        Bitmap bmp1 = Bitmap.getBitmapResource("img1.png");
        Bitmap bmp2 = Bitmap.getBitmapResource("img2.png");
        Bitmap bmp3 = Bitmap.getBitmapResource("img3.png");
        Bitmap bmp4 = Bitmap.getBitmapResource("img4.png");
        Bitmap bmp5 = Bitmap.getBitmapResource("img5.png");
        Bitmap bmp6 = Bitmap.getBitmapResource("img6.png");
    
        Bitmap[] bmps = new Bitmap[] { bmp1, bmp2, bmp3, bmp4, bmp5, bmp6 };
    
        int mPos = 0;
    
        public SlotField(int position) {
            mPos = position;
        }
    
        public int getBitmapHeight() {
            return bmp1.getHeight() * 2;
        }
    
        public int getBitmapWidth() {
            return bmp1.getWidth();
        }
    
        protected void layout(int width, int height) {
            setExtent(getBitmapWidth(), getBitmapHeight());
        }
    
        int getNextPos() {
            if (mPos == bmps.length - 1) {
                return 0;
            } else
                return mPos + 1;
        }
    
        int getPrevPos() {
            if (mPos == 0) {
                return bmps.length - 1;
            } else
                return mPos - 1;
        }
    
        protected void paint(Graphics g) {
            Bitmap hImg = bmps[getPrevPos()];
            Bitmap mImg = bmps[mPos];
            Bitmap lImg = bmps[getNextPos()];
            g.drawBitmap(0, 0, 70, 35, hImg, 0, 35);
            g.drawBitmap(0, 35, 70, 70, mImg, 0, 0);
            g.drawBitmap(0, 105, 70, 35, lImg, 0, 0);
        }
    }
    

    Now put these fields on screen and animate with timer:

    class MainScr extends MainScreen {
        SlotField slot1 = new SlotField(0);
        SlotField slot2 = new SlotField(3);
        SlotField slot3 = new SlotField(5);
        boolean running = false;
    
        public MainScr() {
            HorizontalFieldManager hField = new HorizontalFieldManager();
            add(hField);
    
            hField.add(slot1);
            hField.add(slot2);
            hField.add(slot3);
    
            ButtonField btnRoll = new ButtonField("Roll");
            btnRoll.setChangeListener(new FieldChangeListener() {
                public void fieldChanged(Field field, int context) {
                    if (!running)
                        rollSlots();
                }
            });
    
            add(btnRoll);
        }
    
        void rollSlots() {
            Timer timer = new Timer();
            final Random rnd = new Random();
            TimerTask ttask1 = new TimerTask() {
                int cycle = 0;
    
                public void run() {
                    slot1.mPos = slot1.getNextPos();
                    invalidate();
                    cycle++;
                    if (cycle >= 100+rnd.nextInt(6))
                        cancel();
                }
            };
    
            TimerTask ttask2 = new TimerTask() {
                int cycle = 0;
    
                public void run() {
                    slot2.mPos = slot2.getNextPos();
                    invalidate();
                    cycle++;
                    if (cycle >= 100+rnd.nextInt(6))
                        cancel();
                }
            };
    
            TimerTask ttask3 = new TimerTask() {
                int cycle = 0;
    
                public void run() {
                    slot3.mPos = slot3.getNextPos();
                    invalidate();
                    cycle++;
                    if (cycle >= 100+rnd.nextInt(6))
                        cancel();
                }
            };
    
            timer.schedule(ttask1, 0, 50);
            timer.schedule(ttask2, 200, 50);
            timer.schedule(ttask3, 400, 50);
        }
    }
    

    alt text http://img534.imageshack.us/img534/2172/slots.jpg

    For UI functionality read

    Blackberry User Interface Design – Customizable UI?

    and

    Blackberry – fields layout animation

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

Sidebar

Related Questions

I am new on development of Blackberry playbook apps. Can we develop whole apps
I am using Eclipse to develop a Blackberry Java application.Is possible to automatically increment
Is java the only language available to develop applications for blackberry. Though i have
I'm attempting to run a very simple Blackberry/Java application which implements the BrowserField class.
I have done simple java app for blackberry, while building am getting following error.
I'm completely new to BlackBerry development, but I'm experienced in Java ME development. While
Hey everyone! I am new to blackberry programming although I do have some java
i am new in blackberry development world. and i have task to develop the
I'm new to Java and Blackberry and i'm stuck with a registration screen, due
i am developing an simple blackberry application in BlackBerry - Java Plug-in for Eclipse.

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.