The framework is typically used as a window for Java applications, while applets are windows for Java applets.
Unlike frame, applets are displayed in Web pages, and component layouts can be made by adding a panel.
1 Packagetomawt;2 3 4 ImportJava.applet.Applet;5 Importjava.awt.*;6 Public classTomawt_18extendsapplet{7 PrivateTextField textfield1,textfield2;8 Public voidinit () {9 //construct TextField with default textTentextfield1=NewTextField ("Enter User name here"); One //construct TextField with elements visible ATextfield2=NewTextField (15); - //set the Echo charactor -Textfield2.setechochar (' * ')); the //add components to applet -AddNewLabel ("User name:")); - Add (textField1); -AddNewLabel ("Password:")); + Add (textField2); - } + Public voidPaint (Graphics g) { A String S; ats= "User name:" +Textfield1.gettext (); -s=s+ "Password:" +Textfield2.gettext (); - Showstatus (s); - } -}
Frameworks are typically used as Windows for Java applications, while applets are windows for Java applets