File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frame with no maximize button

 
ch praveen
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ch praveen
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic