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

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)"/>
commented: there 's a huge difference between java and javascript, make sure you know what you are offering as answer -2

what GUI

- Swing/AWT


- another Java GUI

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

commented: show/hide is long time died +9
Member Avatar for hfx642

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.