- Index
- » Java
- » General discussion
- » Extending JFrame VS Instantiating
Extending JFrame VS Instantiating
Extending JFrame VS Instantiating
Hello everyone, i want to know your opinions on this issue.
In creating GUI's in java desktop apps, you can either instantiate the JFrame class or create a class that extends JFrame.
Which of there is much more efficient or in what situation is one method better than the other.
Re: Extending JFrame VS Instantiating
Basically it depends on the situation. And the word better should have it sense .
extending JFrame or using an instance to attach control are almost at the same level of performance.
The key is how easy its going to be for you.
if you need to have many controls in the window it's easier to extend because you will end up having many GUI code so it make send to put in one place (e.i in the JFrame class)
if you need one single control you can use an instance of JFrame. the last case is rarely used in pro apps that's even why most GUI designer alwayse extend JFrame , Form (c#) or
QMainWindow (qt) so I would advise you to take that approach. However remember to not put all your event handlers in you GUI code .
Always try to apply the principle of separation of concern. Also too many private class that are generated by direct implementation of ActionListner make your app slow.
I hope that help.
- Index
- » Java
- » General discussion
- » Extending JFrame VS Instantiating
Board Info
- Board Stats:
- Total Topics:
- 117
- Total Polls:
- 0
- Total Posts:
- 463
- Dormant:
- User Info:
- Total Users:
- 1297
- Newest User:
- margaret0
- Members Online:
- 0
- Guests Online:
- 114
- Most Active Users:
- amadou, ldjiba, ebi, freemancoder, Jean Louis, Sovo, ibrahim, Selom
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked






























