I have several JOptionPane that show messages, example:
JOptionPane.showMessageDialog(loginFrame, " Login Successful");
When I write the message as in the example, I have to put a space before Login Successful so that it looks aligned in the middle of the dialogue if I do not do it the message looks like this:
And I do not like it aesthetically.
Is there any way to align the text / message without having to do it manually with blank spaces?
EDIT:
Try this:
JOptionPane.showMessageDialog(loginFrame, new JLabel("Login Successful", JLabel.CENTER));
And it does not work, the result: