Home
Tutorials
Core Java
Introduction To Java
Java Evolution
Overview of Java
Constants, Variables and Data Types
Java Operators
Branching Statements
Looping Statements
Classes, Objects and Methods
Inheritance
Array, String and Vectors
Java Interfaces
Java Packages
Applet Programming
Graphics Programming
Advanced Java
Java AWT
Java Event Handling
Java File Handling
Java MultiThreading
Java Swing-I
Java Swing-II
Exception Handling
Socket Programming
Java Database
Java RMI
Java Servlets
Java Beans
Programms
Projects
Downloads
Contact
Java Programming
!doctype>
Creating a Frame & Setting Frame Properties in Advanced Java Programming
/* =========================================================== File Name : Framed.java WebSite : http://javaproglang.blogspot.in/ Facebook : https://www.facebook.com/AdvanceJavaProgramming Created By : Bintu Chaudhary =========================================================== */ import java.awt.*; import java.awt.event.*; public class Framed extends Frame { public static void main(String args[]) { /* Creating a frame object */ Framed frmobj=new Framed(); Framec fc=new Framec(frmobj); /*Set frame properties*/ frmobj.setSize(400,450); frmobj.setVisible(true); frmobj.setTitle("Demo"); /*Setting the Background color for frame using color object.*/ Color col = new Color(178,185,255); frmobj.setBackground(col); /*Add windowListener method to provide window functionality*/ frmobj.addWindowListener(fc); } } /*Subclass of the windowadapter class is created to provide window events such as closing a frame or minimizing a frame.*/ class Framec extends WindowAdapter { /*Object of the frame subclass is created*/ Framed fd; /*Object of frame subclass is passed as arguments in the windowadpter method*/ Framec(Framed f) { fd = f; } /* Closing event is defined for frame.*/ public void windowClosing(WindowEvent we) { System.exit(0); } }
Saved file with Framed.java and follow below commands:
C:\>jdk1.4\bin>javac Framed.java
C:\>jdk1.4\bin>java Framed
Download Complete Program
-
Read more »
1 comment:
Venkatesh CS
June 13, 2019 at 11:32 PM
This information is really useful to me.Thanks for sharing.
Java Training in Chennai
Reply
Delete
Replies
Reply
Add comment
Load more...
This information is really useful to me.Thanks for sharing.
ReplyDeleteJava Training in Chennai