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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:14:52+00:00 2026-06-17T11:14:52+00:00

In java if we want to navigate the resultset which we get from executing

  • 0

In java if we want to navigate the resultset which we get from executing the query using 2 buttons forward and backward. What is the way we can perform this task

    private void nextActionPerformed(java.awt.event.ActionEvent evt) {                                            
        if(evt.getSource()==bt_previous){
        DBUtil util = new DBUtil();
             try {
                        Connection con = util.getConnection();
                        PreparedStatement stmt = con.prepareStatement("SELECT * FROM DETAILS where id=?");
                        ResultSet rs;
                        String rm = id.getText().trim();
                        stmt.setLong(1, Long.parseLong(rm));
                        rs = stmt.executeQuery();
                        while(rs.next()){

                        String a = rs.getString("weight");
                        txtboxwgt.setText(a);
                        String b = rs.getString("note_state");
                        cbnotstat.setSelectedItem(b);
                        String c = rs.getString("dm_state");
                        cbdmnstat.setSelectedItem(c);
                                      }
                   } catch (Exception e) {
                             JOptionPane.showMessageDialog(null, e.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-17T11:14:53+00:00Added an answer on June 17, 2026 at 11:14 am

    Make an entity class Detail:

    public class Detail {
        private String weight;
        private String noteState;
        private String dmState;
    
        public Detail() {
    
        }
    
        public Detail(String weight, String noteState, String dmState) {
            this.weight = weight;
            this.noteState = noteState;
            this.dmState = dmState;
        }
        // getters and setters below
    }
    

    In your nextActionPerformed method when you iterate over the result set, create a new instance of your entity and add it to some collection, i.e. LinkedList:

                    List<Detail> allDetails = new LinkedList<Detail>();
                    while(rs.next()) {
    
                        String a = rs.getString("weight");
                        String b = rs.getString("note_state");
                        String c = rs.getString("dm_state");
                        allDetail.add(new Detail (a, b, c));
                    }
    

    Then you can navigate the allDetails in any manner supported by the LinkedList. Or consider using another collection if LinkedList doesn’t fit your needs.

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

Sidebar

Related Questions

I want to navigate between menu tabs and display content without using any java
Im a getting errors from some code developed in Java that want to use
I want to use some kind of webbrowser object in java to navigate to
In Java I want to convert a nested List which contains at the deepest
Using Eclipse I want to view the source code for a core Java class
I want to Run shell script using Cygwin in java.i want to add these
How do I create a window which looks like this in Java: I want
Many websites do not allow directory browsing. They want you to navigate from and
I'm using Selenium to navigate a webpage which has a link called Mail, using
I want Java to be installed on my Leopard MacBook, but I couldn't find

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.