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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:16:32+00:00 2026-06-03T00:16:32+00:00

Started making a simple GUI using netbeans and now I’m facing some problem. I

  • 0

Started making a simple GUI using netbeans and now I’m facing some problem.

I have this:

package my.sccsymapp;

public class sccsymapp extends javax.swing.JFrame {
    /*SOME CODE*/                                     
    public static void main(String args[]) {
        /*SOME CODE*/
    }
    // Variables declaration - do not modify
    private javax.swing.JTextField tempmedespCost;
    // End of variables declaration
}

If I run this, it works as expected. testis placed on my JTextField.

But what I want to do is to use tempmedespCost.setText("test"); in some other class of my code.

I have this class:

package my.sccsymapp;

import java.util.*;

public class Servico extends sccsymapp{
    /*SOME CODE*/ 
    public void relat (){
    /*SOME CODE*/ 
    tempmedespCost.setText("test");
    }
    /*SOME CODE*/ 
}

It now says:

tempmedespCost has private access in my.sccsymapp.sccsymapp

So I have changed tempmedespCost to public.

Now no error is shown, runs without errors but testis not placed on my JTextField.

Can you point me in some direction?

  • 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-03T00:16:34+00:00Added an answer on June 3, 2026 at 12:16 am

    tempmedespCost is defined as private in your class

    private members can only be acceded by functions that are members of the class. Children of the class (like Servico) can’t access to private fields.

    You can either change the visibility of tempmedespCost to protected or create a getter that will let you access to tempmedespCost

    I suggest you read some documentation about Java visibility in Controlling Access to Members of a Class.

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

Sidebar

Related Questions

I started making this simple google chrome extension in javascript. And in the beginning
I'm making a simple 2 player game in XNA and started looking into saving
I have checked out code from a svn repository and started making changes. But
Hi. I've got a small game using directX10 and C++. However, I started making
I've been making small scale projects for a while now. I haven't started a
I started using the MVC pattern a half year ago, and I still have
Weirdly, I've never come across this issue before, but I've just started making a
I have gone though the JBehave official docs and have started making a sample
I have started to use Autofac following this tutorials: http://flexamusements.blogspot.com/2010/09/dependency-injection-part-3-making-our.html Simple class with no
My wife recently started a business making soap bars and the soap labels have

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.