Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  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 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.

                         

» View all related tutorials
Related Tags: c memory image class images interface io colors sed color get implementation display icon height value source width int id

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

Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

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 | Flex 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.