Solved

Question for Martinag  

Posted on 1998-11-15
10
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.

726 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