Solved

Question for Martinag  

Posted on 1998-11-15
10
170 Views
Last Modified: 2012-05-04
Hi, Martinag:
Thank you for your help!  Could you please tell me how to create a window without the "Minimize", "Maximize" and "Exit" icons at the right top of the window? I use JDK1.1.6. Thanks!
0
Comment
Question by:leeann
  • 4
  • 3
  • 3
10 Comments
 

Author Comment

by:leeann
ID: 1227513
Edited text of question
0
 
LVL 4

Accepted Solution

by:
martinag earned 20 total points
ID: 1227514
I'm sorry to tell you but I don't think it's possible. Maybe it'll be when Swing is released but then you'll have to upgrade your JDK.

Martin
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227515
What about java.awt.Window ?

'A Window object is a top-level window with no borders and no menubar. It could be used to implement a pop-up menu. The default layout for a window is BorderLayout. A Window object blocks input to other application windows when it is shown. '

  heyhey
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 4

Expert Comment

by:martinag
ID: 1227516
leeann, heyhey_ is right. You can reject my answer and give heyhey_ the points.

Martin
0
 

Author Comment

by:leeann
ID: 1227517
Could you please tell me how to create a window object in my application program?

0
 
LVL 4

Expert Comment

by:martinag
ID: 1227518
Window w = new Window(new Frame());
w.add(new Button("Add components in the same way as with the java.awt.Frame"));
w.pack();
w.show();

You'll have to add the border (if you want one) on your own but that should not be hard.

Martin
0
 

Author Comment

by:leeann
ID: 1227519
I felt a little confuse here.  Are the following codes correct?
public class MainMenu extends Window {
   public MainMenu(){
     add(new Button("Add components in the same way as with the java.awt.Frame"));
      pack();
      show();
      ReportFrame rf = new ReportFrame(this);    //create a new frame
   }
  ...
}
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227520
>>      ReportFrame rf = new ReportFrame(this);    //create a new frame

you don't have to create a new Frame. Window object is a top-level window so .show() should be enough.
0
 

Author Comment

by:leeann
ID: 1227521
But I need to create a new frame in the MainMenu. Is there a way to create a frame without  the "Minimize" and "Maximize"  icons (or both
of them are disabled. Now I have a small test program which does not allow the user enlarge the frame, but looks very confuse. Here are the codes:

import java.awt.event.*;
import java.awt.*;

public class Resize {

 public static void main(String args[]) {
  new ResizeFrame();
 }
}

class ResizeFrame extends Frame {

 ResizeFrame() {
  super();

  addComponentListener(new ComponentAdapter() {
   public void componentResized(ComponentEvent evt) {
    setSize(200,200);}});

  /* Add the window listener */
  addWindowListener(new WindowAdapter() {
   public void windowClosing(WindowEvent evt) {
    dispose(); System.exit(0);}});

  /* Size the frame */
  setSize(200,200);

  /* Center the frame */
  Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
  Rectangle frameDim = getBounds();
  setLocation((screenDim.width - frameDim.width) / 2,(screenDim.height - frameDim.height) / 2);

  /* Show the frame */
  setVisible(true);
 }
}

 
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227522
1. I don't think you can create a Frame without the Mac\ximazi, Minimize, etc. buttons (but you can just checjk the java.awt.Frame docs)
2. isn't there Frame.isResizable and setResizable methods

(working from memory)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question