Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple AWT problem 1

Status
Not open for further replies.

timmay3141

Programmer
Dec 3, 2002
468
US
I just started using AWT (I'm new to Java in general) and am encountering a very simple difficulty: I can't get the stupid window to close without using end task. Here's my code:

import java.awt.*;

public class Test extends Frame {

public Test() {
super("Test");

setSize(200, 200);
setLocation(300, 200);
show();
}

public static void main(String[] args) {
new Test();
}
}
Also, I'm using the Eclipse IDE and am getting frustrated with a few things. Coming from C++, I'm used to the MSVC++ .NET IDE that has great features and almost nothing annoying about it. Now I've gone through about 5 Java IDE's because they all seem to have several annoying features that I can't turn off. For Eclipse, there are a couple. First, I want to know if you can make it so that the intellisense box does not go away if you type a letter so that there is no method available. For example, say I know I want a method to set a frame's name but I don't know what the method is called. In my C++ IDE, I could start typing "setText" which isn't a method name, but it would go to an alphabetically close name and keep the box open so I can scroll through it. Eclipse decides that it would be better to just close the box if I enter a letter for which no methods are available, which is annoying. Second, there doesn't seem to be a hotkey for debug or run, and every time it asks if I want to save before running (of course I do). Is there any way to set these features? I've looked but haven't found a way.
 
Try adding these lines :

Code:
		WindowListener l = new WindowAdapter() {
	    		public void windowClosing(WindowEvent e) {System.exit(0);}
	    		public void windowClosed(WindowEvent e) {System.exit(0);}
		};

		addWindowListener(l);

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top