diff --git a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/MasterPasswordFrame.java b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/MasterPasswordFrame.java index 95eb9de2..1b81fd10 100644 --- a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/MasterPasswordFrame.java +++ b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/MasterPasswordFrame.java @@ -20,6 +20,8 @@ public class MasterPasswordFrame extends JFrame { private static final Logger logger = Logger.get( MasterPasswordFrame.class ); + private final UserContentPanel userContent; + @SuppressWarnings("MagicNumber") public MasterPasswordFrame() { super( "Master Password" ); @@ -31,7 +33,7 @@ public class MasterPasswordFrame extends JFrame { root.add( Components.strut() ); root.add( userPanel = Components.panel( new BorderLayout( 0, 0 ) ) ); - final UserContentPanel userContent = new UserContentPanel(); + userContent = new UserContentPanel(); userPanel.add( Components.borderPanel( BorderFactory.createBevelBorder( BevelBorder.RAISED, Res.colors().controlBorder(), Res.colors().frameBg() ), Res.colors().controlBg(), BoxLayout.PAGE_AXIS, userContent), BorderLayout.CENTER ); @@ -69,6 +71,10 @@ public class MasterPasswordFrame extends JFrame { if (config.getWindowMaximized()) setExtendedState(MAXIMIZED_BOTH); + else + setExtendedState(NORMAL); + + userContent.transferFocus(); } diff --git a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java index c84fb84c..5a5d4c1f 100644 --- a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java +++ b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java @@ -367,6 +367,7 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, add( masterPasswordField = Components.passwordField() ); masterPasswordField.addActionListener( this ); masterPasswordField.getDocument().addDocumentListener( this ); + masterPasswordField.requestFocusInWindow(); add( errorLabel = Components.label() ); errorLabel.setForeground( Res.colors().errorFg() ); add( Box.createGlue() );