Why we use Enable ( ) method? Plz guide
i am have currently started learning java though books and lectures. There are some questions which are creating some conflicts in my mind. Plz guide me.
1. Why we use enableEvents() method?
2. Can a GUI component handle its own events? If yes; then how?
3. Which technique/concept can be use to implement multiple inheritances
in java?
Plz
Re: Why we use Enable ( ) method? Plz guide
I cannot speak on number 1.
For 2, how would you expect the program to know what you were thinking it should do? You can set it to have events, then YOU must specify what actions are to be performed for these events. There are some generic events that the GUI can perform without you such as window closing event and a few others.
There is no way to perform actual multiple inheritance in Java. You can implement multiple Interfaces, but that does not give you the same effect since you can not have implementation inside of the Interface (you can inside of an inner class of an Interface, but that is not quite the same). Java is simply not designed to allow for multiple inheritance.
Re: Why we use Enable ( ) method? Plz guide
Quote:
1. Why we use enableEvents() method?
If you mean the method that is in the java.awt.Component class, then the answer is you probably will never use it. But if you write your own component class that in certain states needs to handle/ignore certain events then you can programmatically enable/disable specific classes of event for your component. By default all events classes are enabled so you are more likely to use the disableEvents() method first.
The classes of event you might want to programmatically disable/enable are things like action events, focus events, key events, adjustment events etc. (See the AWTEvent class for the defined event masks.
Re: Why we use Enable ( ) method? Plz guide
Quote:
Originally Posted by
touseef4pk
... There are some questions which are creating some conflicts in my mind. Plz guide me.
If you explain or describe the conflicts you're having, maybe we can help you understand.
Just answering those questions looks too much like doing your homework for me, but if you explain what it is you don't understand, I might be able to help.
If you can't explain it simply, you don't understand it well enough...
A. Einstein