Home Java Example Java Swing Remove Minimize and Maximize Button of Frame in Java
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Remove Minimize and Maximize Button of Frame in Java

Advertisement
In this section we are going to learn the coding methods to remove the minimize and maximize button from the title bar of a frame.

Remove Minimize and Maximize Button of Frame in Java

     

In this section we are going to learn the coding methods to remove the minimize and maximize button from the title bar of a frame. We know that the title bar contains icon, minimize, maximize and close buttons. The following program provides the facility for doing it. That means, the frame or window displays on the screen without minimize and maximize button but it has only the icon and close button on the title bar that helps us at the time of closing the frame or window. See more information below.

Description of program:

This program displays a frame under the dialog box that hasn't the minimize and maximize button. It contains only a close button that performs only closing operation that means our window closes when you click on it. So follow the program for better understanding and you will find that the title bar has only close botton.  

Here is the code of program:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class RemoveMaxAndMinButton extends JDialog{
  public RemoveMaxAndMinButton(JFrame frame, String str){
  super(frame,str);
  addWindowListener(new WindowAdapter(){
  public void windowClosing(WindowEvent evt){
  System.exit(0);
  }
  });
  }
  public static void main(String[] args){
  try{
  RemoveMaxAndMinButton frame = new RemoveMaxAndMinButton(new JFrame(),
    
"Remove the Minimize and Maximize button from the Title Bar");
  JPanel panel = new JPanel();
  panel.setSize(200,200);
  JLabel lbl = new JLabel("RoseIndia.Net");
  panel.add(lbl);
  frame.add(panel);
  frame.setSize(400400);
  frame.setVisible(true);
  }
  catch(IllegalArgumentException e){
  System.exit(0);
  }
  
}

Download this example.

Output of program:

 

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 14, 2007

Ask Questions?    Discuss: Remove Minimize and Maximize Button of Frame in Java   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Dinesh Sharma
August 17, 2011
Core java

Your ans is so good not long and not short i like it
DMCA.com