Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Hiding Frame in Java

                         

Introduction

This section illustrates you how to hide the Java Awt frame. Here, you have seen in the given following example that provides you the complete code of the program.

Description of  program:

In this program, program you will see that only one method of the frame is important for the purpose. The following program show a frame titled with "Frame Hiding". When you click on the close button of the frame, the frame will not be closed but it will hide certain with holding all frame data as it is.

In this program, program we are handling the event generated by the frame when you click on the close button of the frame. By using the getSource() method of the WindowEvent class we are creating the Frame object and frame hides when you call the setVisible() method by passing a boolean valued argument.

Method's Description:

getSource(): This is the method of EventObject class. Hence, here this method is used for the WindowEvent class so, it can return the Form's object that is done invisible by using the setVisible() method. The getSource() method returns the source of the generated event.

setVisible(false): This is the method of Form class i.e. used for setting the form whether visible or not. This method takes a boolean valued argument which decides the form for visible or not. If you pass the boolean value false then the form will be invisible otherwise if you argument is true then the form object will be visible. By default Java Awt Form is in the invisible state. For showing the form you have to set the form visible by using the setVisible(true) method.

Here is the code of program:

import java.awt.*;
import java.awt.event.*;

public class  FrameHide{
  public static void main(String[] args){
    Frame fa= new Frame("Frame Hiding");
    Panel p =new Panel();
    Label l1=new Label("Welcome roseindia");
    p.add(l1);
    fa.add(p);
    fa.setSize(300,200);
    fa.setVisible(true);
    fa.addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent e){
      Frame frame = (Frame)e.getSource();
      frame.setVisible(false);
       }
    });
   }  
}

Output of this Program:

 

Download this example.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Latest Searches:
java faq
Get Array List in a JS
ASP Flash and ASP Smar
global variable in j
pagination using javas
jQuery to Select Multi
average numbers
jdbc statem,ent for ne
struts 1.2 package lis
timestamp
delete statement form
FlowLayout
Writting an Excel file
Linux Caixa MаÐ??ТÐ?
button tag struts
how to creat the Butto
signature
types of heap sort
html:checkbox is check
how to creat the Butto
HQL find
Hardware material
previous year's date
dynamically Textbox ar
java drop down list
real time in java
pass parameters
how to get input strin
how to capture multipl
Javascript Menus Image
program for display th
jsp action tags
display the sum of 20
how to edit a any file
insert fields blob
java open output strea
meter
ArrayList
FileInputStream
only numeric-validatio
Photoshop Textures and
table model
hashmap
how to print arraylist
print through Button i
to add a jtable
How to write JSP
Java Read File Line by
Action Class in struts
oracle
checking values in dat
Struts1.1 example down
MurachС?в?Ð??С?в??
java string
ejb3
ant using eclipse
Vector
difference between Byt
hibernate examples
how to override...ng i
reading and writing ex
php socket
source code for JTable
examples for email val
<logic:iterate>
create file folder
create protected folde
property formula hib
how to read key value
distributed transactio
<f:verbatim> tag
setstring keyword in j
sample examples in spr
saving a file in a fol
text box character val
PDF generation
fetching Data From dat
distinct query in hibe
how to override...ng i
Combattons la programm
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.