Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1003352 // Swing Password Input Spike (not so good)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Transpiled version (123L) is out of date.

!752

p {
  //JLabel label = new JLabel("Enter a password:");
  new JPasswordField pass;
  /*new JPanel panel;
  panel.add(label);
  panel.add(pass);*/
  JComponent panel = withTitle("Enter a password:", pass);

  S title = "Give password";

  String[] options = {"OK", "Cancel"};
  int option = JOptionPane.showOptionDialog(null, panel, title,
    JOptionPane.NO_OPTION, JOptionPane.PLAIN_MESSAGE,
    null, options, options[1]);
                     
  print("Option: " + option);      
  if (option == 0) { // OK
      char[] password = pass.getPassword();
      print("Your password is: " + new String(password));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003352
Snippet name: Swing Password Input Spike (not so good)
Eternal ID of this version: #1003352/1
Text MD5: 6393cef1430efddce4fc63d37151cb8d
Author: stefan
Category: javax / gui
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-06-20 17:17:09
Source code size: 645 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 471 / 515
Referenced in: [show references]