You are on page 1of 4

JAVA NOTES

Gui development is done using lib swing and awt package. These are organized in many classes in the swing and awt package. The packages contains dot, these are nested packages, and these are for logical organization. SUN either use java and javax (extension of java). import javax.swing.*; //WINDOWS + CONTROL swing is written after awt. Stack Frame inherits JFrame class, whatever we can do with JFrame object we can do with StackFrame object. Because of inheritance if the methods is not found in the class then the method is going to search in the inherited class the reference of the inherited class is passed along with the class Allowed to call sub class method as well as superclass method. Subclass method as well as superclass method both works in subclass object. Subclass objects contains data member of its superclass and its own irrespective of any access modifier applied to those data members. We can do extra coding because of inheritance, in the subclass we can write the extra functions according to our need. Methods are more important because they do operations.

Why there is something in awt and something in swing?


Ans. Awt is abstract window toolkit, but sun microsystem wrote code which call OS specific code for creating frame, so it gave different GUI for different platforms, awt also has some classes in awt which were not OS specific. Swing is generic to OS, so we can get same GUI on every platform, those awt classes which are Operating System independent has been inherited in the swing package.

EXTRA INFO: [JavaScript use ===] Because there was bug in == Java has a concept called LAYOUTS Every panel has layouting (placing) mechanism. Java gave pre-created layout like1. Border Layout. (default layout) 2. Grid Layout. 3. Card Layout. When we want to use both the stack of iiitb.datastructure and java.utils.Stack. then use fully qualified name, it is an important tool for resolving names.

THREADS thread is considered as unit of execution Internally thread is an object, which is important for the scheduler to schedule the execution of the code. It gives time slot to user, once the quantum ended then it get context switched and other thread got the quantum to be executed, every thread keeps an info about some code to be executed, when thread is scheduled the code of the thread gets executed, scheduled means giving the timeslot. Concurrent processor-> thread executing in the single processor. Parallel Processing- 2 thread working on 2 different processor. Thread is used to keep information what code to be executed. Whenever that code is executed and the thread is preempted whichever last instruction is stored in thread gets the quantum again the execution starts from there. Thread is scheduled it means it receive the quantum. Thread contains the stack to allocate statically created objects and variables. A thread has a thread local storage.

Primary thread calls the main and then setVisible is called, one more thread is launched by the primary thread known as secondary thread, which launch some code.

This loop comes to about each and every user interaction in the whole window. this loops controls each and every action of the frame because it has been created by the call of the setVisible. The object which started the loop it monitors the window created by the object and its children. The buttons and the text field came to know that the pointer is over it is told by the message loop, and the special method is being executed by the object that created that control.

In C to make a late bound call we have to use function pointer, in java we have to use interface or class with virtual functions. Interface is for late bounding. The interface used by the Sun programmers is the ActionListener. The callee has to implement the code, by implementing all the functions of actionListener.

INNER CLASSES:A class inside another class can either be static or non-static. Non static class is called INNER CLASS and non-static is call NESTED CLASS/Static Inner class, and there is a huge difference in them. Inner class object has to be created using outer class object, nested class object can be created without using outer class object. Inner class object holds reference of outer class object that created it, so that u can freely access outer class objects data members and call outer class object methods.

You might also like