Page 3 of 3 FirstFirst 123
Results 41 to 53 of 53
  1. #41
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: password/input masking in terminal

    OK.
    Is the JOptionPane still up at this point?
    If it is then close it and see if you can then type into the console.

    Also, have you actually clicked into the console panel before trying to type into it?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  2. #42
    harshit shah is offline Member
    Join Date
    Jan 2013
    Location
    Kolkata,India
    Posts
    86
    Rep Power
    0

    Default Re: password/input masking in terminal

    Quote Originally Posted by Tolls View Post
    OK.
    Is the JOptionPane still up at this point?
    If it is then close it and see if you can then type into the console.

    Also, have you actually clicked into the console panel before trying to type into it?
    Yes,I have actually clicked into the console panel before trying to type into it.
    the JOptionPane comes and then I click OK in it and goes away..

  3. #43
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: password/input masking in terminal

    Have you tried running it outside the IDE, from the command line?

    I'm just trying to narrow down where the problem sits.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #44
    harshit shah is offline Member
    Join Date
    Jan 2013
    Location
    Kolkata,India
    Posts
    86
    Rep Power
    0

    Default Re: password/input masking in terminal

    well I tried that too but the problem persists..

  5. #45
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: password/input masking in terminal

    OK.
    Based on your code (loosely) this code works on my Eclipse:
    Java Code:
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.SwingUtilities;
    
    public class TestGUI {
       public static void main(String args[]) {
          SwingUtilities.invokeLater(new Runnable() {
             public void run() {
                createAndShowGUI();
             }
    
          });
       }
    
       private static void createAndShowGUI() {
          final JFrame frame = new JFrame();
          JButton button = new JButton("blah");
          frame.getContentPane().add(button);
          button.addActionListener(new ActionListener() {
    
             @Override
             public void actionPerformed(ActionEvent e) {
                JOptionPane.showMessageDialog(frame, "BLAH!", "SUCCESS!", JOptionPane.INFORMATION_MESSAGE);
                try {
                   main_menu();
                } catch (Exception E) {
                   E.printStackTrace();
                }
             }
    
          });
          frame.pack();
          frame.setVisible(true);
       }
    
       private static void main_menu() throws IOException {
          System.out.println("Hello");
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          int ch = 0;
          try {
             ch = Integer.parseInt(br.readLine());
          } catch (java.lang.NumberFormatException ex) {
             main_menu();
          }
          System.out.println(ch);
       }
    }
    It shows a button.
    Click the button it shows a dialog.
    Click the dialog button and the Sysout prints to the console and, when clicking on the console to ensure it has focus, accepts a number for input and echos it back.

    Does this work for you?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #46
    harshit shah is offline Member
    Join Date
    Jan 2013
    Location
    Kolkata,India
    Posts
    86
    Rep Power
    0

    Default Re: password/input masking in terminal

    nope.Not taking input 'ch' at all prints hello and the JVM stops responding..*i use bluej
    even the frame refuses to close after clicking 'blah'...forget about taking input.

  7. #47
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: password/input masking in terminal

    How about outside of BlueJ?
    Executing from the command line?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #48
    harshit shah is offline Member
    Join Date
    Jan 2013
    Location
    Kolkata,India
    Posts
    86
    Rep Power
    0

    Default Re: password/input masking in terminal

    I tried to but it fails there too.

  9. #49
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: password/input masking in terminal

    So it doesn't let you type anything into the cmd window?
    The JOptionPane doesn't close?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #50
    harshit shah is offline Member
    Join Date
    Jan 2013
    Location
    Kolkata,India
    Posts
    86
    Rep Power
    0

    Default Re: password/input masking in terminal

    Quote Originally Posted by Tolls View Post
    So it doesn't let you type anything into the cmd window?
    The JOptionPane doesn't close?
    nope. does not happen.

  11. #51
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: password/input masking in terminal

    Then there's something up with your system.
    Exactly what I have no idea.

    What OS, JRE etc are you on?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  12. #52
    harshit shah is offline Member
    Join Date
    Jan 2013
    Location
    Kolkata,India
    Posts
    86
    Rep Power
    0

    Default Re: password/input masking in terminal

    OS win 8, latest version of java and blueJ

  13. #53
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: password/input masking in terminal

    Could be a Windows 8 thing.
    I don't have that here.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Help with password masking, please
    By krechlich in forum New To Java
    Replies: 10
    Last Post: 03-18-2011, 11:28 AM
  2. input masking 24hour time format (hh:nn) to jTextField
    By newbiejava in forum New To Java
    Replies: 2
    Last Post: 07-24-2010, 01:12 PM
  3. Masking password for logging
    By firewalll in forum New To Java
    Replies: 1
    Last Post: 09-29-2009, 08:04 AM
  4. how to check password for 3 times enterd wrong password
    By sk.mahaboobbhasha@gmail.c in forum New To Java
    Replies: 2
    Last Post: 11-14-2008, 07:53 PM
  5. Creating a dialog to input user/password
    By prfalco in forum New To Java
    Replies: 4
    Last Post: 02-18-2008, 07:03 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •