0% found this document useful (0 votes)
11 views3 pages

Java

The document contains Java code examples demonstrating the use of AWT (Abstract Window Toolkit) for creating graphical user interfaces. It includes three classes: 'f1' which creates a simple frame, 'f2' which extends the frame to display a string with custom font, and 'chbox' which creates a frame with checkboxes for different programming languages. Each class sets up a visible window with specific properties and components.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Java

The document contains Java code examples demonstrating the use of AWT (Abstract Window Toolkit) for creating graphical user interfaces. It includes three classes: 'f1' which creates a simple frame, 'f2' which extends the frame to display a string with custom font, and 'chbox' which creates a frame with checkboxes for different programming languages. Each class sets up a visible window with specific properties and components.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

// first program using awt

import [Link].*;

class f1

public static void main(String a[])

Frame fr1=new Frame();

[Link](true);

[Link](200,200);

[Link]("first frame demo");

D:\saraswati>javac [Link]

D:\saraswati>java f1

import [Link].*;

class f2 extends Frame

public void paint(Graphics g)


{

Font f=new Font("Helvetica",[Link],14);

[Link](f);

//[Link]([Link]);

[Link]("this is my first demo",75,100);

public static void main(String a[])

f2 ff2=new f2();

[Link]([Link]);

[Link]([Link]);

[Link](400,400);

[Link](true);

//chbox

import [Link].*;

import [Link].*;

public class chbox extends Frame

{
public chbox()

Checkbox cd1,cd2,cd3,cd4;

cd1=new Checkbox("vb",false);

cd2=new Checkbox("asp",false);

cd3=new Checkbox("php",false);

cd4=new Checkbox("java",false);

Panel p1=new Panel();

[Link](cd1);

[Link](cd2);

[Link](cd3);

[Link](cd4);

add(p1);

setBackground([Link]);

setSize(400,400);

setVisible(true);

public static void main(String a[])

chbox ch=new chbox();

You might also like