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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:05:54+00:00 2026-06-15T10:05:54+00:00

Having a tiny issue where not sure how to call a specific function to

  • 0

Having a tiny issue where not sure how to call a specific function to print its details.
I created a Radio button that checks the Total physical Memory on a PC, also have one for GPU and both work just fine.

Now I am lost on how to call that same function so it prints in the bigger window when I do a system scan of specific system properties.

if (isWindows()) {

        jTextArea1.setText(header + "User Name : " + name
                + "\nOperating System :" + jComboBox1.getSelectedItem()
                + "\nSelected Gamer Ability : " + this.jComboBox4.getSelectedItem()
                + "\nSelected Age Group :" + this.jComboBox5.getSelectedItem()
                + "\nSystem Version : " + System.getProperty("os.version")
                + "\nSystem Architecture : " + System.getProperty("os.arch")
  PROBLEM PART  + "\nSystem Total Ram : " + this.jRadioButton2......
                + "\nScan ID : " + n + "\n \n")

 }



private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt)       {                                              
    String filepath = "..\\Checker\\src\\batchchecker\\memory.bat";
    try 
    {
        Process p = Runtime.getRuntime().exec(filepath); // filepath
        p.waitFor();
        InputStream in = p.getInputStream();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        int c = -1;
        while ((c = in.read()) != -1) 
        {
            baos.write(c);
        }
        String response = new String(baos.toByteArray());
        jRadioButton2.setText(evt.getActionCommand());
        JOptionPane.showMessageDialog(null, "" + evt.getActionCommand()
            + response);

        }
        catch (Exception e) 
        {
            e.printStackTrace(System.err);
        }
    }
}

As you can see from above code, my radio does what it needs to and tested. I am just not sure how to call the same result into the bigger picture where it actual prints all the details along with the rest. The line of code is + "\nSystem Total Ram : " + this.jRadioButton2......

  • 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-15T10:05:55+00:00Added an answer on June 15, 2026 at 10:05 am

    Seems like you just need to move your implementation to a separate method that can be called from both your actionPerformed() method and your other call. For example:

    public String findMemoryDetails() {
        // ... put code here
    }
    

    Then call it here:

    private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        String memDetails = findMemoryDetails();
        JOptionPane.showMessageDialog(null, "" + evt.getActionCommand() + memDetails);
    }
    

    And here:

    + "\nSystem Total Ram : " + findMemoryDetails()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a tiny issue with my App_Code folders. I'm learning ASP.NET and, therefore,
I've created a compose note button that when clicked displays an initially hidden div
Having trouble with each function... Will try to explain by example... In my code,
Having just added a new button in my web application, I get an error
Having issue with slider navigation. Works perfectly fine when there are no other unordered
I'm trying to ignore IE7 and IE8 but am having a tiny bit of
I have an equation that is only a tiny bit too wide for one
In general, I have been having difficulties porting my .NET Windows Forms applications created
When designing a class that can be moved but not copied, it's natural to
I am writing a tiny tiny thing for a museum that is just basically

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.