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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:50:25+00:00 2026-06-14T16:50:25+00:00

I have been coding for few days with swing, but im getting to a

  • 0

I have been coding for few days with swing, but im getting to a problem …I have functions and variables from different classes that are set in the main class that runs the program and calls the jframe.The problem i have is how do i call the functions in the main class in the jframe code that is set as a new class named as

public class login_sistema extends javax.swing.JFrame

I have tried puting the methods from main as static methods still i cant call the methods this way …If you could help me i would be appreciated …

  • 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-14T16:50:27+00:00Added an answer on June 14, 2026 at 4:50 pm

    I have tried puting the methods from main as static methods still i cant call the methods this way …If you could help me i would be appreciated …

    Static methods are the last thing you should be using. It sounds like you want to have one object call the methods of another object, and to do that the first object must have a valid reference to the second object. This can be achieved by passing it through the first object’s constructor parameter or via a setXXX(…) method.

    For instance if the first object creates the second object, it could pass a reference to itself, this into the second object’s parameter. e.g.,

    The MainClass:

    public class MainClass {
      private OtherClass otherClass;
    
      public MainClass() {
        otherClass = new OtherClass(this);
      }
    }
    

    the OtherClass:

    public class OtherClass {
      public MainClass mainClass;
    
      public OtherClass(MainClass mainClass) {
        this.mainClass = mainClass;
      }
    
      public void someOtherClassMethod() {
         // now we can call methods with the MainClass reference
         mainClass.someMainClassMethod(); 
      }
    }
    

    For more details on your particular problem, consider telling us more about it and showing code.

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

Sidebar

Related Questions

I have been coding up some map functionality. In the last few days, I
from the past few days i have been following a lot of tutorials regarding
I have been sharpening the coding knives and getting back into dev. A few
I have been coding regurlarly in C++ in the past months. I am getting
I am 2 days old with python and coding in general, I have been
I have been coding in iphone platform for about a few months. One thing
I have been coding few examples on method overloading and method overridng. Method overloading
I have been working in android for past few months. The problem for me
I have been working on this project for a few days, it’s a C#
Ive never heard of this before, and I have been coding in PHP for

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.