本文整理汇总了Java中org.jdesktop.swingx.auth.PasswordStore类的典型用法代码示例。如果您正苦于以下问题:Java PasswordStore类的具体用法?Java PasswordStore怎么用?Java PasswordStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PasswordStore类属于org.jdesktop.swingx.auth包,在下文中一共展示了PasswordStore类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JXLoginPane
import org.jdesktop.swingx.auth.PasswordStore; //导入依赖的package包/类
/**
* Create a {@code JXLoginPane} with the specified {@code LoginService},
* {@code PasswordStore}, {@code UserNameStore}, and server list.
* <p>
* If you do not want to store passwords or user ids, those parameters can
* be {@code null}. {@code SaveMode} is autoconfigured from passed in store
* parameters.
* <p>
* Setting the server list to {@code null} will unset all of the servers.
* The server list is guaranteed to be non-{@code null}.
*
* @param service
* the {@code LoginService} to use for logging in
* @param passwordStore
* the {@code PasswordStore} to use for storing password
* information
* @param userStore
* the {@code UserNameStore} to use for storing user information
* @param servers
* a list of servers to authenticate against
*/
public JXLoginPane(LoginService service, PasswordStore passwordStore, UserNameStore userStore, List<String> servers) {
setLoginService(service);
setPasswordStore(passwordStore);
setUserNameStore(userStore);
setServers(servers);
//create the login and cancel actions, and add them to the action map
getActionMap().put(LOGIN_ACTION_COMMAND, createLoginAction());
getActionMap().put(CANCEL_LOGIN_ACTION_COMMAND, createCancelAction());
//initialize the save mode
if (passwordStore != null && userStore != null) {
saveMode = SaveMode.BOTH;
} else if (passwordStore != null) {
saveMode = SaveMode.PASSWORD;
} else if (userStore != null) {
saveMode = SaveMode.USER_NAME;
} else {
saveMode = SaveMode.NONE;
}
// #732 set all internal components opacity to false in order to allow top level (frame's content pane) background painter to have any effect.
setOpaque(false);
CapsLockSupport.getInstance().addPropertyChangeListener("capsLockEnabled", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (capsOn != null) {
if (Boolean.TRUE.equals(evt.getNewValue())) {
capsOn.setText(UIManagerExt.getString(CLASS_NAME + ".capsOnWarning", getLocale()));
} else {
capsOn.setText(" ");
}
}
}
});
initComponents();
}
示例2: setPasswordStore
import org.jdesktop.swingx.auth.PasswordStore; //导入依赖的package包/类
/**
* Sets the <strong>PasswordStore</strong> for this panel.
*
* @param store PasswordStore
*/
public void setPasswordStore(PasswordStore store) {
PasswordStore oldStore = getPasswordStore();
PasswordStore newStore = store == null ? new NullPasswordStore() : store;
//newStore is guaranteed to be nonnull
if (!newStore.equals(oldStore)) {
passwordStore = newStore;
firePropertyChange("passwordStore", oldStore, getPasswordStore());
}
}
示例3: JXLoginDialog
import org.jdesktop.swingx.auth.PasswordStore; //导入依赖的package包/类
/**
* @param service the LoginService to use
* @param ps the PasswordStore to use
* @param us the UserNameStore to use
*/
public JXLoginDialog(LoginService service, PasswordStore ps, UserNameStore us) {
super();
setTitle(UIManagerExt.getString(
JXLoginPane.class.getCanonicalName() + ".loginString", getLocale()));
setPanel(new JXLoginPane(service, ps, us));
JXLoginPane.initWindow(this, getPanel());
}
示例4: SimpleNamePanel
import org.jdesktop.swingx.auth.PasswordStore; //导入依赖的package包/类
public SimpleNamePanel(final PasswordStore passwordStore, final JPasswordField passwordField) {
super("", 15);
// listen to text input, and offer password suggestion based on current
// text
if (passwordStore != null && passwordField!=null) {
addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
updatePassword(getText(), passwordStore, passwordField);
}
});
}
}
示例5: updatePassword
import org.jdesktop.swingx.auth.PasswordStore; //导入依赖的package包/类
private void updatePassword(final String username, final PasswordStore passwordStore, final JPasswordField passwordField) {
String password = "";
if (username != null) {
char[] pw = passwordStore.get(username, null);
password = pw == null ? "" : new String(pw);
}
passwordField.setText(password);
}
示例6: showLoginDialog
import org.jdesktop.swingx.auth.PasswordStore; //导入依赖的package包/类
/**
* Shows a login dialog. This method blocks.
* @return The status of the login operation
*/
public static Status showLoginDialog(Component parent, LoginService svc, PasswordStore ps, UserNameStore us, List<String> servers) {
JXLoginPane panel = new JXLoginPane(svc, ps, us, servers);
return showLoginDialog(parent, panel);
}
示例7: showLoginFrame
import org.jdesktop.swingx.auth.PasswordStore; //导入依赖的package包/类
/**
*/
public static JXLoginFrame showLoginFrame(LoginService svc, PasswordStore ps, UserNameStore us) {
return showLoginFrame(svc, ps, us, null);
}
示例8: JXLoginPane
import org.jdesktop.swingx.auth.PasswordStore; //导入依赖的package包/类
/**
* Create a {@code JXLoginPane} with the specified {@code LoginService},
* {@code PasswordStore}, {@code UserNameStore}, and server list.
* <p>
* If you do not want to store passwords or user ids, those parameters can
* be {@code null}. {@code SaveMode} is autoconfigured from passed in store
* parameters.
* <p>
* Setting the server list to {@code null} will unset all of the servers.
* The server list is guaranteed to be non-{@code null}.
*
* @param service
* the {@code LoginService} to use for logging in
* @param passwordStore
* the {@code PasswordStore} to use for storing password
* information
* @param userStore
* the {@code UserNameStore} to use for storing user information
* @param servers
* a list of servers to authenticate against
*/
public JXLoginPane(LoginService service, PasswordStore passwordStore, UserNameStore userStore, List<String> servers) {
//init capslock detection support
if (Boolean.parseBoolean(System.getProperty("swingx.enableCapslockTesting"))) {
capsOnTest = new CapsOnTest();
capsOnListener = new KeyEventDispatcher() {
public boolean dispatchKeyEvent(KeyEvent e) {
if (e.getID() != KeyEvent.KEY_PRESSED) {
return false;
}
if (e.getKeyCode() == 20) {
setCapsLock(!isCapsLockOn());
}
return false;
}};
capsOnWinListener = new CapsOnWinListener(capsOnTest);
} else {
capsOnTest = null;
capsOnListener = null;
capsOnWinListener = null;
capsLockSupport = false;
}
setLoginService(service);
setPasswordStore(passwordStore);
setUserNameStore(userStore);
setServers(servers);
//create the login and cancel actions, and add them to the action map
getActionMap().put(LOGIN_ACTION_COMMAND, createLoginAction());
getActionMap().put(CANCEL_LOGIN_ACTION_COMMAND, createCancelAction());
//initialize the save mode
if (passwordStore != null && userStore != null) {
saveMode = SaveMode.BOTH;
} else if (passwordStore != null) {
saveMode = SaveMode.PASSWORD;
} else if (userStore != null) {
saveMode = SaveMode.USER_NAME;
} else {
saveMode = SaveMode.NONE;
}
// #732 set all internal components opacity to false in order to allow top level (frame's content pane) background painter to have any effect.
setOpaque(false);
initComponents();
}
示例9: getPasswordStore
import org.jdesktop.swingx.auth.PasswordStore; //导入依赖的package包/类
/**
* Gets the <strong>PasswordStore</strong> for this panel.
*
* @return store PasswordStore
*/
public PasswordStore getPasswordStore() {
return passwordStore;
}