OK, let's go over a few things, and you'll probably have to answer a few questions for me.
1) Does the sunday class extend JFrame as well? Is the user interacting with this visual object and the results then are displayed in the results jframe? If so, do you have a sunday object displayed and finding that user interaction is not translating over to the results frame as expected? If so, you may have more than one sunday object, one visible, and one not visible, and unfortunately the invisible one is the one that results is interacting with.
2) I'm not very familiar with NetBeans, but I would guess that that when you set a property of a component such as a JLabel, the property will be set at the JLabel's creation time. This means that if you set your JLabel's text to equal the rslt String, it is likely being set up when the program is being initialized and before any user has had a chance to interact with your program. I'm guessing that your JLabel's text needs to be set dynamically during the running of your program. For that to happen, you could do:
a) create a public method in class results called something setLabel1Text(String text), i.e.:
b) pass a reference to your results class into your sunday class. This can be done either by a method or if results is the only location where sunday is created and displayed, then this could be done via the constructor, as I did in my example. Here is where you would pass a "this" object into sunday.
public void setLabel1Text(String text)
c) have sunday call this method whenever an event occurs that makes it want to change what results should display. One place to call this would be inside of a button's actionPerformed method within its ActionListener.
3) Make sure that there is only one sunday object and only one results object, and that the objects you expect to be dealing with each other are doing just that. You may want to sprinkle your code generously with some System.out.println("..."); where you print out your current location in the program and any key variable values, just to make sure that the code you think is being called is in fact being called. It's a primitive form of debugging.
BTW, Java naming convention dictates that classes should have their first letters capitalized. One reason this is important is so that others reading your code will more easily understand it.
Yes the sunday class extends the JFrame
when you ask do I have a sunday object, I don't understand.
I used the system.out.println() to test
my code. and within the sunday page, I received a null, and I don't know why, because it worked fine before.
do you have a sunday object displayed? I don't know what that would look like, so I don't know what to say about that. I mean my sunday frame shows and I can interact with it.
"Pass a reference to your results class into your sunday class. This can be done either by a method."
I will use a method and place that method into the events section
of the calculate button.
The problem is, does the reference look something like this.
if I used your example here (String aunder)
//for the sunday class
public void setLabel1Text(String aUnder)
//for the results class
public void setLabel1Text(String aUnder)
* If aUnder is a String, then what is aUnder.results? That doesn't make much sense to me as the String class does not have a public results field.
* Are you sure that you want to define setLabel1 within the sunday class? Are you trying to change one of sunday's labels too? From my understanding of your problem, you need to change a label that is within the results class, and if so this method needs to be defined within the results class and called from within the sunday class. It doesn't matter what the name of the parameter is, as you will stuff your string into the method when you call it.
* By "displaying a sunday object" I meant displaying the JFrame that is a sunday object, simple as that.
Sorry, but I'm still getting the sense that you need to review some basic Java before moving on with Swing. If you feel that you still desire to continue, you will probably need to post your code, but if you do, please use code tags, and try if possible to avoid posting NetBeans generated code. It was built to be read by a machine, not by humans.
I figured it out. My original code before this whole post was ok. I figured that my referencing wasn't wrong, the whole time I was referencing a static to a non-static.
I just needed to change the public ... to public static ... and on the sunday form
just reference it that way like this
result.jLabel1.setText("") with my variable inside that.
I appreciate your help with this, and think that it is pretty safe to say that you are glad this was finally resolved :) I was getting tired with myself.
Thank you for sticking through with this though.