Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: JOptionPane Problem

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Location
    philippines
    Posts
    28
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Unhappy JOptionPane Problem

    When I logged into a textfile correct passcode is there still appears JOptionPane.
    lgnbb.addActionListener(new ActionListener(){
    		public void actionPerformed(ActionEvent ee){
     
    				try{
    					File file = new File("Database.txt");
    					BufferedReader br = new BufferedReader(new FileReader(file));
    					String line = "";
    					while((line = br.readLine())!=null){
     
    						String acc[] = line.split("-");
    						String account = acc[0];
    						String passcode = acc[2];
    						if((txf1.getText().equals(account))&&
    							(txf2.getText().equals(passcode))){
    								JOptionPane.showMessageDialog(null,
    								"Login Success!!!",
    								"Login Successfully!!!",
    								JOptionPane.INFORMATION_MESSAGE);
    								Administrator exe = new Administrator();
    								exe.adminAcc();
    								txf2.setText("");
     
    							}
    					}
     
    						}
    						 catch (IOException ex) {
    		           			 ex.printStackTrace();
    		       			}
     
     
    					if((txf1.getText().equals(""))&&
    					(txf2.getText().equals("")))
                    	{
    					JOptionPane.showMessageDialog(null,
    					"Please Type!!",
    					"Incomplete",
    					JOptionPane.WARNING_MESSAGE);
    					}
    					else if(!(txf1.getText().equals(admin))||
    							!(txf2.getText().equals(adpass)))
                    			{
    							JOptionPane.showMessageDialog(null,
    							"Incorrect..\nPlease try again!",
    							"Incorrect",
    							JOptionPane.WARNING_MESSAGE);
                    			}
     
    					if((txf1.getText().equals(admin))&&
    							(txf2.getText().equals(adpass))){
    								JOptionPane.showMessageDialog(null,
    								"Login Success!!!",
    								"Login Successfully!!!",
    								JOptionPane.INFORMATION_MESSAGE);
    								Administrator exe = new Administrator();
    								exe.adminAcc();
    								txf2.setText("");
     
    							}
    		}
    		});


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: JOptionPane Problem

    Your current question has been asked in such a way that you assume that we know what you're trying to do. Please understand that we're terrible at reading minds. If you don't get a decent answer soon, consider
    • editing your original post, getting rid of the [quote][/quote] tags on your first line and the bold as they're distracting.
    • putting in some effort to better describe your problem and just how your current code is misbehaving.


    Luck!

    --- Update ---

    Please do not double post the same question in the forum as this is considered rude forum behavior and is not fair to the volunteers who help out in this forum. I have locked your duplicate post and ask you not to do this again in the future.

    --- Update ---

    Edit: Also I see that you've posted several threads in this forum, many which have received replies which you have never replied to. This is also not looked kindly upon by forum volunteers, since why should we put in effort to try to help you if you won't give the courtesy of a reply to that help?

    Note that these comments are being posted in an effort to make you a better forum member which will help you get better help in the future, so please look on them in that light.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: JOptionPane Problem

    What do you think should happen?
    Which message is displayed?
    Is that message incorrect?
    Which message should be displayed?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Still having problem with JOptionPane
    By runkerr in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 28th, 2013, 07:40 PM
  2. [SOLVED] JOptionPane problem
    By sonicjr in forum AWT / Java Swing
    Replies: 8
    Last Post: September 30th, 2011, 03:39 PM
  3. JOptionPane problem
    By frozen java in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 7th, 2011, 06:16 PM
  4. Convert to JOptionPane
    By ahzim8 in forum Java Theory & Questions
    Replies: 1
    Last Post: March 10th, 2011, 09:52 AM
  5. JOptionPane using If and Else
    By Liuric in forum Member Introductions
    Replies: 7
    Last Post: October 1st, 2010, 12:05 AM