File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Frame with no maximize button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Frame with no maximize button" Watch "Frame with no maximize button" New topic

Frame with no maximize button

ch praveen
Ranch Hand

Joined: Mar 08, 2004
Posts: 67
Hello Friends,
Can any one suggest how to create a Frame which doesn't include a maximize and minimize button. Even though I included setResizable(false), size can be changed with the help of maximize button in Frame.
Regards Ch.Praveen.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

When I setResizable(false) the Maximize button is disabled and doesn't do anything. There is no way to rid the JFrame of the buttons themselves. You can turn the entire bar off with setDecorationsPainted(false) (not the right method, but something close).
Or you could use a JWindow instead of a JFrame. In both cases, you would need to provide your own closing button because the X won't be there anymore either.

GenRocket - Experts at Building Test Data
ch praveen
Ranch Hand

Joined: Mar 08, 2004
Posts: 67
Hello Gregg Bolinger,
My program is listed below which extends java.awt.Frame and when it is displayed, eventhough it doesn't allow resizing with mouse, it includes a maximize button and maximizing and retoring the Frame are still permitted. My code is given below. Kindly guide me.
import java.applet.Applet;
import java.awt.Label;
import java.awt.Image;
import java.awt.GridLayout;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Toolkit;
import java.awt.Point;
import java.awt.Event;
import java.awt.event.*;
public class Emoticans extends Frame
Applet ap;
public Emoticans(Applet ap,String title,Point location) {
this.ap = ap;
setLayout(new GridLayout(4,4));
URL url = null;
for(int i = 1; i<= 16; i++) {
url = null;
url = new URL(ap.getCodeBase(),"../icon/" + i + "icon.gif");
catch (MalformedURLException ignore) { }
if(url!=null) {
Image img = ap.getImage(url);
//img = Toolkit.getDefaultToolkit().getImage(url);
ImageButton ib = new ImageButton(img,"*" + i);
ib.setBackground(new Color(208,208,236));
public boolean handleEvent(Event event) {
switch ( {
case 1001:
if ( instanceof ImageButton)
case 201:
return true;
The above class is called from an Applet which is illustrated below.
Emoticans emoticans = new Emoticans(this,"Emoticans",emoticansbutton.getLocationOnScreen());
emoticans.setBackground(new Color(208,208,236));
I agree. Here's the link:
subject: Frame with no maximize button
It's not a secret anymore!