intorduction about the two chapters awt and swing..!!

                                       awt and swing

First of all what is awt and swing that we need to understand as we know there are many controls such as text field,text area,rich text box,lists,label,buttons....etc.

As we all have noticed thats a common thing we open in any application such as msword,powerpoint or any application these all controls appear one and the same why this happens...?? what is the reason behind all this does all the company provides the same controls we see in any operating systems... !!

The answer is NO all the software companies use the ready made controls provided by the operating system so the better example which can be given is that open a word in windows xp,windows 7,windows 8, windows 10 . You will see a different appearence so why this happens..??

As and when we open by double clicking the icon of any exe file it needs some DLL files at the fisrt and the main which is related to our topic is the ocx files which will be in the system folder which we can see it so it runs the code of the ocx file for the particular control and there are different ocx file for the different controls that are needed to open a software based on mainly GUI platform as these all we can put in the category of graphics what we see are Graphics other wise what would be the scenario if the control might not be present..??

Writing commands on the CUI platform and doing everything if we dont remember the commands we cant do anything that was the limitation here by in this case just clicking on the control something might happen that would amaze the users that something is happening...!!

awt is the abstract window tool kit that is the concept basically given by java that is how java for applet or for any means uses these ready made controls provided by the operating system 

SO lets go deeper inside how java managed to steal the controls the basic behind it is java made a class for each and every control for eg for button java made a button class for label java made a label class for list java made List class and many more so now to apply these controls what to do ..... the answer is nothing just declare the object of the control you want thats it nothing more ....for eg if you want a label than label w1= new label; thats it..!!
but where are these all classes located at..?? the answer is in java.awt.* package  .

SO before using this controls we have to import this package ...!!

Now the question arises that before we discussed that it needed an OCX file then in java what will be the mechanism the answer is simple what java did is that it made the ocx file of the particular control Run in the constructor of the class that java has defined for each control.

THE BIG QUESTION IS BY THIS JAVA BECOMES PLATFORM DEPENDENT...!!

Yes java becomes platform independent at this particular phase so java was determined that it wanted to be platform independent afterall java is java .....

JAVA made all the controls by itself typed the code for all the controls and made the class for each and every control and in their constructor made the whole code run developed by java not only that gave the same name to the class but the only difference is that put J letter in front of the class name  that is for example if we take class label then in abstract window tool kit we have Label as the class name but for swing we have class name JLabel is the only difference .

But the biggest draw back of swing is that we cant change the appearence means the controls cant adapt the appearence of the different operating systems they go in...!!

NOW summary in one line awt is the control defined by the operating system that loads from the OCX file of the operating system and swing is the study of the same control provided by JAVA..!!

Comments

Post a Comment

Popular posts from this blog

State space search / blocks world problem by heuristic approach /TIC TAC TOE

Navigation in Vaadin.

Drag and drop items from one Grid to another