Login: (dialog) refactor Exception handler, edit javadoc
authorEddie <dev@fun2be.me>
Sat, 6 Jun 2015 10:44:26 +0000 (11:44 +0100)
committerEddie <dev@fun2be.me>
Sat, 6 Jun 2015 10:44:26 +0000 (11:44 +0100)
src/uk/ac/ntu/n0521366/wsyd/client/Login.java

index 27779e1..a2f9409 100644 (file)
  */
 package uk.ac.ntu.n0521366.wsyd.client;
 
-import javax.swing.JFrame;
 /**
- *
+ * Log-in dialog.
+ * 
  * @author Eddie Berrisford-Lynch
  */
 public class Login extends javax.swing.JDialog {
 
     /**
      * Creates new form WSYD_Login
+     * @param parent owner window
+     * @param modal true if modal
      */
     public Login(java.awt.Frame parent, boolean modal) {
         super(parent, modal);
@@ -39,6 +41,10 @@ public class Login extends javax.swing.JDialog {
         this.getRootPane().setDefaultButton(gButtonLogin);
              
     }
+    /**
+     * update the username field.
+     * @param newName the new username
+     */
     public void setUserName(String newName) {
         if (newName != null)
         gFieldName.setText(newName);
@@ -215,20 +221,18 @@ public class Login extends javax.swing.JDialog {
                     break;
                 }
             }
-        } catch (ClassNotFoundException ex) {
-            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
-        } catch (InstantiationException ex) {
-            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
-        } catch (IllegalAccessException ex) {
-            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
-        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
             java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
         }
         //</editor-fold>
         //</editor-fold>
+        
+        //</editor-fold>
+        //</editor-fold>
 
         /* Create and display the dialog */
         java.awt.EventQueue.invokeLater(new Runnable() {
+            @Override
             public void run() {
                 Login dialog = new Login(new javax.swing.JFrame(), true);
                 dialog.addWindowListener(new java.awt.event.WindowAdapter() {