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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:41:21+00:00 2026-06-16T13:41:21+00:00

DBUtil util = new DBUtil(); try { JOptionPane.showMessageDialog(null, Connection Opened!); Connection con = util.getConnection();

  • 0
   DBUtil util = new DBUtil();
        try {
            JOptionPane.showMessageDialog(null, "Connection Opened!");
            Connection con = util.getConnection();
            PreparedStatement stmt = con.prepareStatement("SELECT (SUM(box_no),SUM(weight),SUM(TP),SUM(TV)) FROM dbo.mut_det WHERE rm_id=?");
            stmt.setInt(1, Integer.parseInt(rm));// but how to get values from textfield dont know.
            //*and how to put these called values SUM(box_no),SUM(weight),SUM(TP),SUM(TV) in textfields dnt know.*//
            //my textfields are txtboxno, txtweight, txttp, txttv
            stmt.execute();
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
            Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, null, ex);
        }

you see not able to get and put values back into textfields…

  • 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-16T13:41:22+00:00Added an answer on June 16, 2026 at 1:41 pm

    Here is dirty sample code that might help to resolve your issue.

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    
    public class TextDemo extends JFrame implements ActionListener {
        JTextField textData;
        JButton button = new JButton("Press Me");
    
        public TextDemo() {
            JPanel myPanel = new JPanel();
            add(myPanel);
            myPanel.setLayout(new GridLayout(3, 2));
            myPanel.add(button);
            button.addActionListener(this);
            textData = new JTextField();
            myPanel.add(textData);
        }
    
    
        public void actionPerformed(ActionEvent e) {
            if (e.getSource() == button) {
                String data = textData.getText(); // perform your DB operation
                textData.setText(data + " This is new text"); // Set your DB values.
            }
        }
    
        public static void main(String args[]) {
            TextDemo g = new TextDemo();
            g.setLocation(10, 10);
            g.setSize(300, 300);
            g.setVisible(true);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

private void btgetinvActionPerformed(java.awt.event.ActionEvent evt) { //JOptionPane.showMessageDialog(null, REMITTANCE ID IS VALID!); try { DBUtil util
I try to do this for couple of hours. Database db = DBUtil.GetInstance().GetDataBase(); DbCommand
I'm new to this HL7 standard, but earlier I worked on NCPDP standard. Now
I am a programmer, new to jsp, trying to write some code. i have
I am trying to make connections to my database using connection pooling library: DBPool
Recently updated Twisted from 11 to 12 version. Discovered that the twisted.enterprise.util module no
I have a problem with BoneCP (0.7.1 RELEASE). I though that BoneCP.getConnection() ensures it
I have a trouble with dbutil and db. Below is my code (a constructor
Using: select name, id from TEST where id :2 AND name :1 order by
I'm going to call a function, and set some parameters by name, example: Connection

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.