This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
So, I have a "Main" class, a "Panel" class and a "Day" class. In my Panel class, I have created a JFrame obejct and inside my Panel class I have created a JButton and a JTextField. When the content of the text field is "Monday" I want to display the name of the day and rather I have school on this day. For that, I want to use JLabel. Since the method of displaying the name of the day etc is inside the Day class, I have to create the JLabel object inside the Panel class but edit it inside the Day class.
However, when I use text.setText("Test"); it does not compile. In Eclipse, it gives the following error: text cannot be resolved (text is my JLabel object). I think that the Day class simply doesn't know the text object (even when I make the text object static, which helped in similar cases).
Does anyone know how to fix this Problem? I can provide code, if needed. But making simple enough to post it here would be exhausting. Maybe someone can help me without. If not, I will absolutely happily do so.
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnprogra...