View RSS Feed

Recent Blogs Posts

  1. What You Can Do in a Subclass

    by , 04-26-2012 at 06:29 PM
    Subclass inherits protected and public members of parent no matter in which package is the subclass. If subclass and parent are in same package then package-private members are also inherited. Inherited members could be used to hide them, replace them or supplement them, with newer members:

    • Just the way other fields do, inherited fields can also be directly used.
    • A field can be declared in subclass with similar name just like that present in superclass hence hiding it (which
    Tags: subclass Add / Edit Tags
  2. Creating a Thread (implementing Java Runnable Interface)

    by , 11-12-2011 at 06:58 PM (My Java Tips)
    A better way to create a thread in Java is to implement Runnable interface. A thread can be created by extending Java Thread class also. Now the question arises why implementing Runnable interface is a better approach? Answer is, if the thread class you are creating is to be subclass of some other class, it canít extend from the Thread class. This is because Java does not allow a class to inherit from more than one class. In such a case one can use Runnable interface to implement threads.
  3. SWT Dialog

    by , 11-10-2011 at 06:57 PM (My Java Tips)
    Dialog class is the abstract superclass of the classes that represent the built in platform dialogs. A Dialog typically contains other widgets that are not accessible. A Dialog is not a Widget.

    This class can also be used as the abstract superclass for user-designed dialogs. Such dialogs usually consist of a Shell with child widgets. The basic template for a user-defined dialog typically looks something like this:

    Java Code:
     import org.eclipse.swt.*;
     import org.eclipse.swt.widgets.*;
    Tags: dialog, subclass, swt Add / Edit Tags
    SWT / JFace