Solved

Question for Martinag  

Posted on 1998-11-15
10
167 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
 
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now