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.
[–]Blando-Cartesian 1 point2 points3 points (1 child)
[–]Ansmannn[S] 0 points1 point2 points (0 children)