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 2 of 2

Thread: JOptionPane in Filereader

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

    Unhappy JOptionPane in Filereader

    When I logged in to 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 139 Times in 134 Posts

    Default Re: JOptionPane in Filereader

    Please do not double post the same question as this is considered rude forum behavior since it unnecessarily divides discussion. I am locking this post. Please do not do this again in the future.

Similar Threads

  1. Problem with FileReader
    By piulitza in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 10th, 2011, 06:30 AM
  2. Using the fileReader?
    By malconrhymes in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 26th, 2011, 04:47 AM
  3. Scanner/FileReader help
    By JohnTravoltaire in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 27th, 2011, 11:28 PM
  4. FileReader help
    By bibboorton in forum What's Wrong With My Code?
    Replies: 6
    Last Post: September 5th, 2010, 07:29 AM
  5. FileReader need assistance
    By tazjaime in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: November 8th, 2009, 12:12 AM