Olá Pessoal!
Estou usando o Substance Look and Feel no meu projeto, mas estou tendo problemas quando o meu SplashScreen vai aparecer.
Este é o código da minha classe que tem o método main().
[code]package br.com.sistemaodontoeasy;
import br.com.sistemaodontoeasy.log.Log;
import br.com.sistemaodontoeasy.view.telas.Login;
import br.com.sistemaodontoeasy.view.telas.SplashScreen;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import org.jvnet.substance.skin.SubstanceMistAquaLookAndFeel;
/**
*
-
@author Eliangela Menezes Palharini
-
@version 1.0
-
01/09/2009
*/
public class Main {private static EntityManager em;
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {@Override public void run() { try { UIManager.setLookAndFeel(new SubstanceMistAquaLookAndFeel()); SplashScreen splash = SplashScreen.getSplashScreen(); splash.setVisible(true); EntityManagerFactory emf = Persistence.createEntityManagerFactory("OdontoEasyPU"); em = emf.createEntityManager(); splash.dispose(); new Login().setVisible(true); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Ocorreu um erro:\n" + e.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE); Log.executeLog(Main.class, e.getMessage(), e); } finally { if (em != null) { em.close(); } } } });
}
}[/code]
e este é o código do meu SplashScreen
[code]package br.com.sistemaodontoeasy.view.telas;
import br.com.sistemaodontoeasy.view.components.OdontoLabel;
import br.com.sistemaodontoeasy.view.controls.TamanhoPadrao;
import java.awt.BorderLayout;
import java.io.IOException;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
*
-
@author Eliangela Menezes Palharini
-
@version 1.0
-
28/09/2009
*/
public class SplashScreen extends JFrame {private JPanel panelFundo;
private static SplashScreen splashScreen;private SplashScreen() throws IOException {
setUndecorated(true);
initComponents();
}private void initComponents() throws IOException {
panelFundo = new JPanel(new BorderLayout());setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setResizable(false); getContentPane().add(panelFundo, BorderLayout.CENTER); panelFundo.add(new OdontoLabel(new ImageIcon("img/Dente.png")), BorderLayout.CENTER); panelFundo.add(new OdontoLabel("Carregando aplicação..."), BorderLayout.SOUTH); pack(); setLocation(TamanhoPadrao.getCenter(getHeight(), getWidth()));
}
public static SplashScreen getSplashScreen() throws IOException {
if (splashScreen == null) {
splashScreen = new SplashScreen();
}
return splashScreen;
}
}[/code]
O meu problema é o seguinte:
Se eu comento a linha que seta o look and feel (UIManager.setLookAndFeel(new SubstanceMistAquaLookAndFeel());), aparece o meu splash screen perfeito.
Se eu coloco qualquer lookAndFeel Substance, aparece uma janelinha azul, sem a imagem e sem o label.
Alguém já teve um problema parecido?
Obrigada