I am trying to create a custom class that extends
another class (JFrame
) but forces the assignment of a certain variable upon implementation (I want each JFrame
in my application to have a "screen ID"). Java, however, does not have abstract variables. Nor am I able to figure out how to make an interface that extends JFrame
. This one's really got my head spinning =D
The class code would look similar to this:
public interface CustomFrame extends javax.swing.JFrame {
public abstract int screen_id;
}
And the implementation of CustomFrame
would look something like this:
public class NewFrame implements CustomFrame {
public int screen_id = 5;
NewFrame() {
setVisible(true);
// etc...
}
}
Does this problem even make sense to anyone?? I know what my objective is I am just lost trying to work it out in my brain....