Extends JFrame vs. creating it inside the program

后端 未结 6 624
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 04:39

When making an application using Swing, I\'ve seen people do one of the two things to create a JFrame. Which is a better approach and why?

I\'m a beginner at Java an

6条回答
  •  心在旅途
    2020-11-22 05:09

    The first approach is better.

    Typically you are not adding any new functionality to the frame so creating a direct instance of the class makes sense.

提交回复
热议问题