Mr. Negi
Mr. Negi

Reputation: 154

How do I add an abstract Method to Jframe?

I need a global refresh function for all the instances of JFrame in a program, which can be called on any instance of JFrame. I however I need different implementations for different instances. What is the correct way to override JFrame to add my abstract method? if that is indeed the correct way to go about this.

Upvotes: 0

Views: 584

Answers (1)

Roberto Attias
Roberto Attias

Reputation: 1903

public abstract class MyJFrame extends JFrame {
  public abstract void refresh();
}

public class MyJFrameA extends MyJFrame {
  public void refresh() {
    ...
  }
}

It is one of the possible ways.

Upvotes: 2

Related Questions