Skip to main content

[PATCH] JXLoginPanel showing user name

2 replies [Last post]
Joined: 2003-06-11

I use Windows XP, and when I login, I have my previous login already filled in and highlighted. It's very convenient, as I can use that or simply type in a new one right away.

JXLoginPanel does not do this, and not seeing a previous login, my users keep telling me that it does not work, and do not understand that they have to select it in the combobox.

Because of this I am using a quick hacked version that does what I need.

--- 359,372 ----
if (saveMode == SaveMode.NONE) {
namePanel = new SimpleNamePanel();
} else {
! ComboNamePanel comboPanel = new ComboNamePanel(userNameStore);
! if(comboPanel.getItemCount()>0){
! comboPanel.setSelectedIndex(0);
+ comboPanel.updateUI();
+ comboPanel.getEditor().selectAll();
+ namePanel = comboPanel;
+ }
JLabel nameLabel = new JLabel(UIManager.getString(CLASS_NAME + ".nameString"));

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-10-14

Rather than hack apart JXLoginPanel so i couldnt update from CVS anymore..

I implemented a few things.. a LoginListener, so when the login suceeds i put the last logged in username to my preferences..

public class ISLoginListener implements LoginListener {

private JXLoginPanel panel;

public ISLoginListener(JXLoginPanel panel) {
this.panel = panel;

public void loginSucceeded(LoginEvent source) {

public void loginStarted(LoginEvent source) {

public void loginFailed(LoginEvent source) {

public void loginCanceled(LoginEvent source) {

I then set the username on a JXLoginPanel using the preference before showing the LoginPanel.. if you need to see some working coded examples of this, pop me an email and i'll send you what i've done

Joined: 2003-06-11

I understand, but the fact is that JXLoginPanel [i]already[/i] stores the username in the preferences, and storing it in another place still should be an unnecessary hack. I believe that it should be at least an option that I can set. Thanks anyway for the suggestion, I'll be forced to use it if the patch is not accepted ;-)