My problem is quite difficult to formulate, but here is the basic plan:
I have an interface:
public interface TheInterface {
public String getStuff();
}
I have an abstract class that implements this interface:
public abstract class GenericClass implements TheInterface {
public GenericClass() {
}
@Override
public String getStuff() {
return "Random string";
}
}
Then I have a class that extends GenericClass
public class GUIClass extends GenericClass {
private myFrame myNewFrame;
public GUIClass() {
super();
myNewFrame = new myFrame();
}
}
As you can see, GenericClass has a frame:
import javax.swing.JFrame;
public class myFrame extends JFrame {
private myPanel topPanel;
public myFrame() {
topPanel= new myPanel();
add(topPanel);
setSize(400,200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Test Program");
setVisible(true);
}
}
And inside this frame there is a panel containing a label:
import java.awt.GridLayout; import java.awt.Label;
import javax.swing.JLabel; import javax.swing.JPanel;
public class myPanel extends JPanel {
private JLabel myLabel;
public myPanel() {
setLayout(new GridLayout(0,2));
add (new Label("This label should contain the content of getStuff(): "));
myLabel=new JLabel();
add (myLabel);
}
}
getStuff() GenericClass . , , . , - , .
.