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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:07:17+00:00 2026-06-06T04:07:17+00:00

This is the code of a button that when is clicked it searches for

  • 0

This is the code of a button that when is clicked it searches for a user id in a database and displays name, last name and hours. What I want to do is to pop up a message(JOptionPane.showMessage()) that shows the time when the user clocks in/out so what I thought I could do is to add “JOptionPane.showMessage()” to do exactly that, but when I put this code(no matter where) there is a red line under “showMessage” and an error message saying:

==cannot find symbol
==symbol: method showMessage(java.lang.String)
==location:class javax.swing.JOptionPane

Not sure what that means. Any help very much appreciated. Thank you.

private void clockInOutActionPerformed(java.awt.event.ActionEventevt){   

    // TODO add your handling code here:
    try{
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,  ResultSet.CONCUR_UPDATABLE);
           String sql = "SELECT * FROM Students WHERE STUDENTID = ?";
        PreparedStatement pstmt = con.prepareStatement(sql);
        pstmt.setInt(1, Integer.parseInt(jTextField1.getText()));
        ResultSet rs = pstmt.executeQuery();

        if(rs.next()){
            String first = rs.getString(2);
            String last = rs.getString(3);
            String hours = rs.getString(6);

            fName.setText(first);
            lName.setText(last);
            tHours.setText(hours);
        }       
    }
    catch(SQLException err){
        JOptionPane.showMessageDialog(Student.this, err.getMessage());
    }
}
  • 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-06T04:07:20+00:00Added an answer on June 6, 2026 at 4:07 am

    Probably you misspelled the class name or you didn’t import the class name, check that and try again. And also what Andrew Said.

    In case you are using the IDE Eclipse if you press Ctrl+Shift+o (letter O) it imports everything automatically for you.

    Hope it helps.

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

Sidebar

Related Questions

I have this code that has one button that let's me choose an entry
this is the code that I use to disable the button $(#btnSubmit).attr('disabled', 'disabled') $(#btnSubmit).disabled
i am using this code below to dynamically capture the name of the button
If the user manually clicks the 'submit' button, i use this code: if (isset($_POST['submit_findall']))
I have a small WPF application. This application has a button that when clicked,
I have a button that when clicked, should only execute its code if the
I created this simple code, It it just a button that stays on a
I've created a compose note button that when clicked displays an initially hidden div
i have this code in the button click to show selection image when the
this code will not pass the query string to default3.aspx on Image Button ..

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.