In second cardpanel the username and password alignment is not coming properly.
By default a JPanel uses a FlowLayout so the components are displayed on a single line.
Is there any way to fix it?
Use an appropriate layout manager (or combination of layout managers) to get the desired alignment.
Read the section from the Swing tutorial on Layout Managers for more information and examples.