
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This lecture is delivered by Prem Vikas at Jaypee Institute of Information Technology University for discussing following points of Java Network Programming: Components, Hierarchy, GUI, Classes, Properties, JBuilder7, AWT, Components, Event, Handling
Typology: Slides
1 / 24
This page cannot be seen from the preview
Don't miss anything!
java.awt jvax.swings
Abstract Windowing Kit GUI-Components are drawn according to the underlying windowing system Initial set of Components developed AWT Components Buttons Text Fields Labels Text Areas Check Boxes Menus Radio Buttons Canvases Lists Scroll Panes Choices
public Button firstButton = new Button(“ Click It ”);
public class ButtonApplet extends Applet{ public Button firstButton = new Button(“Click It public void init( ){ add(firstButton);
} }
import java.awt.*;
import java.applet.*;
public class ButtonApplet extends Applet{
//creating the button component
public Button firstButton = new Button(“One”);
public Button secondButton = new Button(“Two”);
public Button thirdButton = new Button(“Threet”);
public void init( ){
//adding to the applet
add(firstButton); add(secondButton); add(thirdButton); }
}
Flow Layout GridLayout Border Layout CardLayout GridBagLayout
The default layout manager
Create the container class e.g. applet Set layout
setLayout(Object of a Layout Class)
Flow Layout…cont..
Using Flow Layout constructor 1
import java.awt.; import java.applet.;
public class flowLayoutTest extends Applet{
public FlowLayout myFlowLayout=new FlowLayout(); Button B=new Button(“Click It”);
public void init(){ setLayout(myFlowLayout);
add(B); } }
Flow layout cont..
import java.awt.; import java.applet.;
public class flowLayoutTest extends Applet{
Button B=new Button(“Click It”);
public void init(){ setLayout(myFlowLayout); add(B); } }
Labels..
A label for a button import java.awt.; import java.applet.;
public class flowLayoutTest extends Applet{
public FlowLayout myFlowLayout= newFlowLayout((FlowLayout.Right );
Label label_save=new Label( “Save”); Button B=new Button(“Save”);
public void init(){
setLayout(myFlowLayout); add(label_save); add(B); }}
Creates an empty text area with default size (9 rows,47 columns)
Creates a text area and displays the given text
Creates a text area according to the given number of rows and coumns
Adds text at the end of the current text in the text area
Adds text at specified character position
A button click Clicking a check box
Writing text to a field Clicking on the applet surface
Depricated method previously used for handling events Cannot deal all sorts of events Syntax public boolean action(Event evnt, Object obj){ -------code to perform some actions----------- }