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

Iconifying and Maximizing a frame in Java

                         

In this section, you will learn about the Iconifying and maximizing a frame in java. Iconifying means to show a frame in minimized form. This program displays a frame in both forms. By default the frame will be in the minimized form. Following is the image of the frame which has to be minimized or maximized: 

This is normal window which has to be maximized

Code Description:

frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG):
The setWindowDecorationStyle() is the method of the JRootPane class which sets the window decoration type using the constant property PLAIN_DIALOG of the JRootPane class.

setExtendedState():
It sets the state of window to minimize and maximize. It uses the constant field of the JFrame class.

MAXIMIZED_BOTH
This state is used to maximize the frame horizontal and vertical.

ICONIFIED
This state checks whether the frame is minimized or not.

Here is the code of program:

import javax.swing.*;

public class IconifyAndMaximizeFrm{
  public static void main(String[] args){
    JFrame frame = new JFrame("Iconifying and Maximizing a Frame");
    frame.setUndecorated(false);
    frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
    frame.setExtendedState(JFrame.MAXIMIZED_BOTH);  //Maximizing the frame
    frame.setExtendedState(JFrame.ICONIFIED | frame.getExtendedState());
  
//Minimizing or Iconifing the frame
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
  }
}

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 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

Good example, but there's one major drawback to it: when frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); is called, the look and feel is changed. Therefore, visually, the head of the JFrame has a different lookAndFeel than its contentPane!! Is there any way to get back the previous look and feel? Thanks, -J

Posted by Jimmy Boy on Wednesday, 02.6.08 @ 20:02pm | #47434

Latest Searches:
iterator
action form struts
swing program
create file folder
requestDispatcher
3DS MAX Effects Advanc
tiles2
delete data in mysql d
Flash Interactivity Sc
strust example
update checkbox row in
what is static inner c
How to Use JFrame in J
ttcn
jpa quries
Maya Effects Interpart
Photoshop Text Effects
array list
c:out in var of c:fore
page refresh
techiques to use subst
java.nio
Scanner
how to traverse throug
File InputStream
Flash Math Physics Fla
struttutorial
java / objects
Javascript Links and B
DispatchAction
toString
ASP Ad Management Crea
struts formfile
date jsp
Submit comments in dat
Create PDF file exampl
session
API
for loop
gwt ext tree structure
JavaWorld article abou
midi
average numbers
Declare tag methods in
where we place ...-in
login jsp
ajax auto complete
login
pagination taglib
factory
Photoshop Basics Using
MULTIPLE SELECT COMBO
techiques to use subst
password match jsf
jboss connection pool
Servlet Context
how to use tab control
create text file using
HQL
struts 1.2 download
41.Name the class that
Use of <fn:substringBe
dynamic table
Photoshop Effects Psyc
JTable Renderer to be
Time
Photoshop Drawing 3D P
Web Site promotion ser
Math.random()
create csv file
layout
how to select an drawn
yield function in thre
java merge two xml doc
Javascript DHTML Javas
selecting option value
php socket
log4j
primitive data types
remove rectangle awt
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.