wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Frame with no maximize button" Watch "Frame with no maximize button" New topic
Author

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: 15299
    
    6

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.*;
import java.net.URL;
import java.net.MalformedURLException;
public class Emoticans extends Frame
{
Applet ap;
public Emoticans(Applet ap,String title,Point location) {
super(title);
this.ap = ap;
setSize(110,130);
setResizable(false);
setBounds(location.x,location.y-130,110,130);
setVisible(true);
setLayout(new GridLayout(4,4));
URL url = null;
for(int i = 1; i<= 16; i++) {
url = null;
try
{
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));
add(ib);
}
}
}
public boolean handleEvent(Event event) {
switch (event.id) {
case 1001:
if (event.target instanceof ImageButton)
ap.handleEvent(event);
break;
case 201:
ap.handleEvent(event);
dispose();
break;
}
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));
--------------
Regards,
Ch.Praveen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Frame with no maximize button
 
Similar Threads
how to remove the window close icon.
JInternalFrame problem
How to adjust the maximized size of Frame based on resolution of screen
Customize JFrame
JFrame problems.....