Question: I have 2 classes in Java. One is my Gui, and one is an empty class. What would a method look like that i could
I have 2 classes in Java. One is my Gui, and one is an empty class. What would a method look like that i could create in the second empty class that I could be call within the GUI class, that would create a JLabel and initialize the label and also add it to the contentpane and everything. I keep getting errors when i create a method with the code that i would use to create a label and call that method from the other class in the GUI, I just get tons of errors and do not what I am doing wrong. Please create some example code of this being done. Basically I just need a method in a seperate class that will completely create the label and add it to the GUI in the other class, Im not sure how to get it to work since they are in seperate classes. Create and show and EXPLAIN an example of this.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
