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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting lost in popup Dialog in Applet

Status
Not open for further replies.

motoslide

MIS
Oct 30, 2002
764
0
0
US
I have a little Applet that needs to alert the user when they enter an invalid value (non-integer, or integer out of range). The pop-up occurs, but there is no way to get out of it short of killing the application (AppletViewer or IE). Here is the method that generates the popup(s). They are both acting incorrectly:

Code:
    private class selectNumber implements ActionListener
    {   
        public void actionPerformed(ActionEvent ae)
        {
            Frame child = new Frame();
            boolean isGoodNumber = false;
            Integer lineNumber = new Integer(0);
            while (!isGoodNumber)
            {
                try
                {
                    lineNumber = Integer.parseInt(number.getText());
                    isGoodNumber = true;
                }
                catch(NumberFormatException nfe)
                {               
                    JOptionPane.showMessageDialog(child, 
                        "That wasn't an Entrant number!", 
                        "Entrant Number Error", 
                        JOptionPane.ERROR_MESSAGE);
                }
                    
                if(isGoodNumber)
                {
                    Entrant b = map.get(lineNumber);
                    if (b == null)
                    {
                        JOptionPane.showMessageDialog(child, 
                            "Entrant number " + lineNumber.intValue() + " does not exist!", 
                            "Entrant Number Error", 
                            JOptionPane.ERROR_MESSAGE);
                        isGoodNumber = false;
                    }
                    else
                        getEntrant(b);
                }
            }
        }
    }

How do I close the dialog box and return control back to the Applet? I'm very much a novice at this, so don't take anything for granted regarding my background knowledge. Thanks in advance!

"Proof that there is intelligent life in Oregon. Well, Life anyway.
 
Thanks for the quick response. I see lots of good examples in at that website. In my case, the problem ended up being caused by bad logic on my part. I thought it was an issue with Parent/Child frame problems, but I simply needed to change my "while" to an "if".


"Proof that there is intelligent life in Oregon. Well, Life anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top