Which is the best way to create a JFrame
and handle it?
JFrame
JFrame
like class MyClass extends JFrame
Whenever possible, do not use inheritance (your class is-a JFrame) but choose composition (e.g. your class has-a JFrame). It's a common design principle.
And it doesn't have any significant impact on performance.
Basically, the only times you should extend JFrame is if you need to overload any methods in it.
That being said, there shouldn't be any noticeable performance hit one way or the other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With