2
0

Java Client: Fix some minor focus issues

This commit is contained in:
Michael Ziminsky (Z) 2018-11-13 19:05:00 -07:00
parent 8300d48b66
commit e6f56d9da7
2 changed files with 8 additions and 1 deletions

View File

@ -20,6 +20,8 @@ public class MasterPasswordFrame extends JFrame {
private static final Logger logger = Logger.get( MasterPasswordFrame.class ); private static final Logger logger = Logger.get( MasterPasswordFrame.class );
private final UserContentPanel userContent;
@SuppressWarnings("MagicNumber") @SuppressWarnings("MagicNumber")
public MasterPasswordFrame() { public MasterPasswordFrame() {
super( "Master Password" ); super( "Master Password" );
@ -31,7 +33,7 @@ public class MasterPasswordFrame extends JFrame {
root.add( Components.strut() ); root.add( Components.strut() );
root.add( userPanel = Components.panel( new BorderLayout( 0, 0 ) ) ); root.add( userPanel = Components.panel( new BorderLayout( 0, 0 ) ) );
final UserContentPanel userContent = new UserContentPanel(); userContent = new UserContentPanel();
userPanel.add( Components.borderPanel( userPanel.add( Components.borderPanel(
BorderFactory.createBevelBorder( BevelBorder.RAISED, Res.colors().controlBorder(), Res.colors().frameBg() ), BorderFactory.createBevelBorder( BevelBorder.RAISED, Res.colors().controlBorder(), Res.colors().frameBg() ),
Res.colors().controlBg(), BoxLayout.PAGE_AXIS, userContent), BorderLayout.CENTER ); Res.colors().controlBg(), BoxLayout.PAGE_AXIS, userContent), BorderLayout.CENTER );
@ -69,6 +71,10 @@ public class MasterPasswordFrame extends JFrame {
if (config.getWindowMaximized()) if (config.getWindowMaximized())
setExtendedState(MAXIMIZED_BOTH); setExtendedState(MAXIMIZED_BOTH);
else
setExtendedState(NORMAL);
userContent.transferFocus();
} }

View File

@ -367,6 +367,7 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener,
add( masterPasswordField = Components.passwordField() ); add( masterPasswordField = Components.passwordField() );
masterPasswordField.addActionListener( this ); masterPasswordField.addActionListener( this );
masterPasswordField.getDocument().addDocumentListener( this ); masterPasswordField.getDocument().addDocumentListener( this );
masterPasswordField.requestFocusInWindow();
add( errorLabel = Components.label() ); add( errorLabel = Components.label() );
errorLabel.setForeground( Res.colors().errorFg() ); errorLabel.setForeground( Res.colors().errorFg() );
add( Box.createGlue() ); add( Box.createGlue() );