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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:17:22+00:00 2026-05-26T19:17:22+00:00

I get trouble when I try to create a check box in canvas. My

  • 0

I get trouble when I try to create a check box in canvas.

My checkbox works well but I don’t know how to store value of each item, that mean when user check row 1 , and then they move to another row check box still check row 1, and when user check row 1 and 2 and move to another row, check box will check row 1 and 2.

But I can’t find out solution for this problem

  • 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-26T19:17:22+00:00Added an answer on May 26, 2026 at 7:17 pm

    modify your code to use selectTodelete as boolean array instead of int, about like shown below

        // ...initialization of DataList
        boolean[] selectTodelete = new boolean[2]; // instead of int
        { selectTodelete[0] = selectTodelete[1] = false; } // init array
        Command editCommand, backCommand,selectCmd, unselectCmd,selectAll;
        //...
    
        protected void paint(Graphics g) {
            //...
            for(int i =0 ; i<countRow; i++ ){
                //draw background
                //...
                         if(selectTodelete[i]){ // was selectTodelete == 1
                                //draw select dot at location for row 'i'
                                //...
                         }
                // remove: you don't need that anymore: if(selectTodelete == 2) {
                                //draw select dot...
                //}
    
                // draw a checkbox before each item
                // ...
            }
        }
    
        public void commandAction(Command c, Displayable d) {
            //...
            if(c == selectCmd){
                selectTodelete[selectedItem] = true;
            }
            if(c== unselectCmd){
                selectTodelete[selectedItem] = false;
            }
            if(c == selectAll){
                selectTodelete[0] = selectTodelete[1] = true;
            }
            repaint();
        }
        //...
    }
    

    update – answer to question in comments

    I want to get RCID fit to checked it mean when row was checked I can get this id and when I use delete command it will delete all rows were checked

    For that, you can expose selectTodelete for use outside of its class with getter, or, better yet, with method like below…

        boolean isSelected(int elementNum) {
            return elementNum >= 0 && elementNum < selectTodelete.length
                    && selectTodelete[elementNum];
        } // modelled after javax.microedition.lcdui.Choice.isSelected
    

    …information exposed like that can be further used anywhere when you need it to deal with RCID, like eg in method below:

        Vector useSelection(DataList dataList, DataStore[][] ds) {
            Vector result = new Vector();
            int count = ds.length;
            for(int i = 0; i < count; i++ ) {
                if (!dataList.isSelected(i)) {
                    continue; // skip non selected
                }
                System.out.println("RCID selected: [" + ds[i][5].cellText + "]");
                result.addElement(ds[i][5]);
            }
            return result;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is UITransitionView ? What is UILayoutContainerView ? Will I get in trouble for
I'm having a real trouble to get accents right, and I believe this may
I am having real trouble trying to get decent answers to my questions from
I have a trouble trying to get this working. I have an Item model,
I am having trouble trying to get iterators for inner sub-containers. Basically imagine this
I'm having trouble figuring out how to get the testing framework set up and
I am having trouble working out how to get a simple fade in fade
I'm having trouble with this PHP script where I get the error Fatal error
I'm having some trouble using regular expression to get date in a string. Example
I'm having a bit of trouble trying to get class variables to work in

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.