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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:45:06+00:00 2026-06-09T22:45:06+00:00

I want to when I click on a cell on JTable some text changed

  • 0

I want to when I click on a cell on JTable some text changed in a label in JFrame. I write below code; but when I click, the components’ positions are destroyed, and I see a rearranged gui. I didn’t get any exception in log file, too!

The part of code for JTable mouse listener: (x is a JTable)

x.addMouseListener(new MouseListener() {

    @Override
    public void mouseClicked(MouseEvent e) {

        try {
            String temp = (String) model.getValueAt(x.getSelectedRow(), 0);
            Class.forName(Configure.driver);
            Connection con = DriverManager.getConnection(Configure.url
                + Configure.dbName, Configure.userName, Configure.password);

            java.sql.PreparedStatement prs2 = con.prepareStatement(
                "select count(*) as tedad from messages where receiver=?");

            prs2.setString(1, temp);
            temppResultSet = prs2.executeQuery();
            if (temppResultSet.next()) {

                int RecNum = temppResultSet.getInt("tedad");
                System.out.print("RECEIVED NUM: " + RecNum);

                numberOfMessageReceiveByuser.setText("dsdsdsaf");//LABEL NAME
            }
        } catch (Exception ex) {
            Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
        }

    //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void mousePressed(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void mouseReleased(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void mouseEntered(MouseEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void mouseExited(MouseEvent e) {
        // throw new UnsupportedOperationException("Not supported yet.");
    }
});
  • 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-09T22:45:07+00:00Added an answer on June 9, 2026 at 10:45 pm

    the problem solved.
    i set all of positioned of my components statically(not with layout manager).
    when you want to set positions statically you should set component layout to null with .setLayout(null)
    that was the finger note i forget to do!

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

Sidebar

Related Questions

I want to click the video on this page http://37.128.191.200/?640 using JavaScript but can't
I have some textboxes on a page and I want to click a link
I have a linkbutton in gridview and i want to click event on code
i can display BG image in table view cell but when i click any
I have a GridView on my page. I want to set a cell click
I want a signal to be emitted when I either click on a cell
I have a table as shown below. When I click a table cell(only cells
I have a JTable and I want to open a PopupMenu by a right-click
I have a JTable with editable cells. When I click in a cell, it
I have created a table view and want that when i click a cell

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.