Java Swing Tutorials

Remove the Title Bar of a Frame a Icon Button
previous Home Next

In this program we will learn how to remove the title bar of a frame or window in java. That means that the frame show on the screen without title bar.

Remove Minimize and Maximize Button of Frame in Java

In this page of the example we are going to create 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. This program provides the facility for doing the disappear to the min and max button. That means that the frame or window show on the screen without min and max button.

Description of program:

In this program show a frame under the dialog box that has not the min and max button. the frame contain only a close button that performs only closing operation

Example

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

public class removeminandmax extends JDialog{
public removeminandmax(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{
removeminandmax frame = new removeminandmax(new JFrame(),
"Remove the Minimize and Maximize button from the Title Bar");
JPanel panel = new JPanel();
panel.setSize(400,400);
JLabel lbl = new JLabel("R4RTech Soft Solution");
panel.add(lbl);
frame.add(panel);
frame.setSize(400, 400);
frame.setVisible(true);
}
catch(IllegalArgumentException e){
System.exit(0);
}
} 
}
previous Home Next