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.

1  
!752
2  
3  
p {
4  
  //JLabel label = new JLabel("Enter a password:");
5  
  new JPasswordField pass;
6  
  /*new JPanel panel;
7  
  panel.add(label);
8  
  panel.add(pass);*/
9  
  JComponent panel = withTitle("Enter a password:", pass);
10  
11  
  S title = "Give password";
12  
13  
  String[] options = {"OK", "Cancel"};
14  
  int option = JOptionPane.showOptionDialog(null, panel, title,
15  
    JOptionPane.NO_OPTION, JOptionPane.PLAIN_MESSAGE,
16  
    null, options, options[1]);
17  
                     
18  
  print("Option: " + option);      
19  
  if (option == 0) { // OK
20  
      char[] password = pass.getPassword();
21  
      print("Your password is: " + new String(password));
22  
  }
23  
}

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: 475 / 522
Referenced in: [show references]