CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2008
    Posts
    23

    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

  2. #2
    Join Date
    Feb 2008
    Posts
    966

    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.

  3. #3
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: Why we use Enable ( ) method? Plz guide

    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.

  4. #4
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Why we use Enable ( ) method? Plz guide

    Quote Originally Posted by touseef4pk View Post
    ... 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
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured