Search code examples
javaswingjframeextend

Extending from JFrame


Is there a difference from extending to JFrame and javax.swing.JFrame?

Example:

public class Authenticator extends JFrame {

and...

public class Authenticator extends javax.swing.JFrame {

Solution

  • It makes no difference unless you have another class called JFrame and are importing it instead of javax.swing.JFrame.

    That said, as Andrew Thompson said, you shouldn't extend JFrame, you should use an instance.