Fixed error message layout in LoginDialog
Updated envoy-common dependency to v0.2-alpha in pom.xml
This commit is contained in:
		| @@ -100,19 +100,9 @@ public class LoginDialog extends JDialog { | ||||
| 		}); | ||||
|  | ||||
| 		// Listen to handshake rejections | ||||
| 		EventBus.getInstance().register(HandshakeRejectionEvent.class, evt -> { | ||||
| 			if (errorMessage != null) contentPanel.remove(errorMessage); | ||||
| 			clearPasswordFields(); | ||||
| 			errorMessage			= new JLabel(evt.get()); | ||||
| 			gbc_errorMessage		= new GridBagConstraints(); | ||||
| 			gbc_errorMessage.gridx	= 2; | ||||
| 			gbc_errorMessage.gridy	= 0; | ||||
| 			gbc_errorMessage.fill	= GridBagConstraints.HORIZONTAL; | ||||
| 			gbc_errorMessage.insets	= new Insets(5, 5, 5, 5); | ||||
| 			contentPanel.add(errorMessage, gbc_errorMessage); | ||||
| 			contentPanel.revalidate(); | ||||
| 			contentPanel.repaint(); | ||||
| 		}); | ||||
| 		EventBus.getInstance() | ||||
| 			.register(HandshakeRejectionEvent.class, | ||||
| 					evt -> { clearPasswordFields(); errorMessage.setVisible(true); errorMessage.setText(evt.get()); }); | ||||
|  | ||||
| 		// Exit the application when the dialog is cancelled | ||||
| 		cancelButton.addActionListener(evt -> { logger.info("The login process has been cancelled. Exiting..."); System.exit(0); }); | ||||
| @@ -159,6 +149,7 @@ public class LoginDialog extends JDialog { | ||||
| 	private void initUi() { | ||||
| 		setSize(338, 123); | ||||
| 		setLocationRelativeTo(null); | ||||
| 		setResizable(false); | ||||
| 		getContentPane().setLayout(new BorderLayout()); | ||||
| 		contentPanel = new JPanel(); | ||||
| 		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); | ||||
| @@ -217,6 +208,16 @@ public class LoginDialog extends JDialog { | ||||
| 		gbc_repeatPasswordField.gridx	= 1; | ||||
| 		gbc_repeatPasswordField.gridy	= 2; | ||||
|  | ||||
| 		errorMessage			= new JLabel(); | ||||
| 		gbc_errorMessage		= new GridBagConstraints(); | ||||
| 		gbc_errorMessage.gridx	= 1; | ||||
| 		gbc_errorMessage.gridy	= 3; | ||||
| 		gbc_errorMessage.fill	= GridBagConstraints.HORIZONTAL; | ||||
| 		gbc_errorMessage.insets	= new Insets(5, 5, 5, 5); | ||||
| 		errorMessage.setForeground(Color.RED); | ||||
| 		errorMessage.setVisible(false); | ||||
| 		contentPanel.add(errorMessage, gbc_errorMessage); | ||||
|  | ||||
| 		buttonPane = new JPanel(); | ||||
|  | ||||
| 		registerText = new JTextPane(); | ||||
| @@ -233,14 +234,14 @@ public class LoginDialog extends JDialog { | ||||
| 				case ItemEvent.SELECTED: | ||||
| 					contentPanel.add(lblRepeatPassword, gbc_lblRepeatPassword); | ||||
| 					contentPanel.add(repeatPasswordField, gbc_repeatPasswordField); | ||||
| 					setSize(338, 148); | ||||
| 					setSize(338, 173); | ||||
| 					break; | ||||
|  | ||||
| 				case ItemEvent.DESELECTED: | ||||
| 					if (repeatPasswordField.getParent() == contentPanel) { | ||||
| 						contentPanel.remove(lblRepeatPassword); | ||||
| 						contentPanel.remove(repeatPasswordField); | ||||
| 						setSize(338, 123); | ||||
| 						setSize(338, 148); | ||||
| 					} | ||||
| 					break; | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user