Good afternoon mates,
Currently I have the last problem with my project software and thank heaven it is nothing more than aesthetic.
I'm doing the project with MVC and since I already have all the views with the "nimbus" look and feel, I'll show you the login below.
But I make the call from the main using the following code
public static void main(String[] args) {
Vista_Login VistaL = new Vista_Login();
Modelo_AdministradorDAO ModeloAdminDAO = new Modelo_AdministradorDAO();
Modelo_MedicoDAO ModeloMedDAO= new Modelo_MedicoDAO();
Modelo_PacienteDAO ModeloPacDAO= new Modelo_PacienteDAO();
Controlador_Login ControladorL = new Controlador_Login(VistaL, ModeloAdminDAO, ModeloMedDAO, ModeloPacDAO);
ControladorL.InicializarLogin();
}
The ControllerL.InitializeLogin(); contains the following:
public void InicializarLogin (){
VistaLog.setVisible(true);
VistaLog.setLocationRelativeTo(null);
}
So from what you see, it's nothing to write home about.
But when executing the main, the login loses the nimbus style and the windows style appears, like this:
Which leaves me wondering how to fix it. The view doesn't have any code, it just has the components.
How do I get the nimbus style to run and persist during program execution?
The
main()
first thing you should do is set the LAF with the methodUIManager.setLookAndFeel()
:You only have to do it once and it is recommended to do it at startup because from then on all UI Components will use the specified LAF.