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

  • Home
  • SEARCH
  • 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 6039485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:22:31+00:00 2026-05-23T06:22:31+00:00

I want to work with the selected row of a Table when the device

  • 0

I want to work with the selected row of a Table when the device is a touch one in the pointerPressed method , and what I get is a wrong value : for example I clicked the third line ( PS : the header line is -1 ) and I got 0 as a value in the System.out.println ! And when I click another row then I get the row I selected before !
So how to synchronize LWUIT with the selected row ?

  • 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-23T06:22:32+00:00Added an answer on May 23, 2026 at 6:22 am

    Ok , I found the solution : in the constructor I wrote :

    for (short idxComp=3; idxComp<tList.getComponentCount(); idxComp++)
            {
                tList.getComponentAt(idxComp).addFocusListener(this);
            }
    isTableSelected = false;
    

    And here are the implemented methods :

    public void pointerPressed(int x, int y)
        {
            int startX, startY, endX, endY, nbComps;
            nbComps = tList.getComponentCount();
            startX = tList.getComponentAt(3).getAbsoluteX();
            endX = tList.getComponentAt(5).getAbsoluteX() + tList.getComponentAt(5).getWidth();
            startY = tList.getComponentAt(3).getAbsoluteY();
            endY = tList.getComponentAt(nbComps-1).getAbsoluteY() + tList.getComponentAt(nbComps-1).getHeight();
            if ( (x >= startX && x <= endX) && (y >= startY && y <= endY) )
            {
                isTableSelected = true;
                if ( (x >= selectedComp.getAbsoluteX() && x <= (selectedComp.getAbsoluteX()+selectedComp.getWidth())) && (y >= selectedComp.getAbsoluteY() && y <= (selectedComp.getAbsoluteY()+selectedComp.getHeight())) )
                    afficheFicheCredit(selectedRow);
            }
        }
        public void focusGained(Component comp) {
            tList.repaint();
            selectedComp = tList.getComponentAt(3*selectedRow+3);
            if (isTableSelected)
            {
                isTableSelected = false;
                selectedRow = tList.getSelectedRow();
                afficheFicheCredit(selectedRow);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to let the user select one row to use to submit the
I want to programmatically deselect the currently selected row (or rows) in a JTable.
For my GWT application, I want to show the selected row in a FlexTable,
I want to work with a file-based database using apache derby. I was wondering
I want to work with PE files in Perl and didn't find a module,
I want to work on the Rijndael algorithm using C#. Can anybody help me
I want to work on intelliJ on my webapps and I don't know how
The code I want to work: $.ajax({ type: POST, url: _Source/ajap/ajap.nlSrch.php, data: { sndJson
If I want to work with an object and leverage LINQ to SQL what
Hi I want to work around a 'bug' in certain RSS-feeds , which use

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.