Skip to main content

Windows & Frames In AWT


Windows & Frames

import java.awt.*;
import java.awt.event.*;
class Frame1 extends Frame
{
Frame1(String title)
{
super(title);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});

}
}
public class FrameDemo
{
public static void main(String a[])
{
Frame1 f1=new Frame1("This is title");
f1.show();
f1.setSize(200,300);
}
}

Comments

  1. I guess I am the only one who came here to share my very own experience. Guess what!? I am using my laptop for almost the past 2 years, but I had no idea of solving some basic issues. I do not know how to Crack Softwares Free Download But thankfully, I recently visited a website named ProCrackHere
    Transor for Whatsapp Crack
    Wavepad Sound Editor Crack

    ReplyDelete

Post a Comment

Popular posts from this blog

What is Servet ?

A servlet is a java class that extends an application hosted on a web server. Handles the HTTP request-response process (for our purposes) Often thought of as an applet that runs on a server. Provides a component base architecture for web development, using the Java Platform The foundation for Java Server Pages (JSP). Alternative to CGI scripting and platform specific server side applications.

Panels in AWT

Panels: import java.applet.*; import java.awt.*; /*<applet code="PanelDemo" width=300 height=300></applet>*/ public class PanelDemo extends Applet { public void  init() { setLayout(new BorderLayout()); Panel pn=new Panel(); Button b1=new Button("Button 1"); pn.add(b1); Button b2=new Button("Button 2"); pn.add(b2); add(pn,"North"); Panel pe=new Panel(); Button b3=new Button("Button 3"); pe.add(b3); add(pe,"East"); Panel pw=new Panel(); Button b4=new Button("Button 4"); pw.add(b4); add(pw,"West"); Panel ps=new Panel(); Button b5=new Button("Button 5"); ps.add(b5); Button b6=new Button("Button 6"); ps.add(b6); add(ps,"South"); } }