Ok so I am writing this GUI menu and one of the choices on the menu requires the user to log in. So I open a new window that prompts the user for a username password. However after the user inputs the information how do I just close the window? I don't mean exit the program but just close the GUI window. Or when user hits the cancel button I just want to close the window

Edited by akaicewolf: n/a

5 Years
Discussion Span
Last Post by hfx642

As you open a new window for the user to enter the username and password you can close that window using self.close() function in javascript by assigning it to the cancel button.So when the user clicks on the cancel button the window gets closed

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript" language="javascript">
function closewin()

<input type="button" value="cancel" onclick="closewin(this)"/>
Votes + Comments
there 's a huge difference between java and javascript, make sure you know what you are offering as answer

I am not to sure which library its from. Javascript doesn't help me out tho. Here is my code for the one of the windows

But my code uses things like JFrame,JPanel,JButton, ActionListener etc... not sure which library that is


there are a few methods that come in handy that you can use

Votes + Comments
show/hide is long time died

I don't get any indication from the OP that this is an applet.
Look up JOptionPane to display a dialog window.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.