Estou tentando utilizar o Nimbus, mas não estou conseguindo.
Fiz da seguinte forma:
Criei um arquivo chamado swing.properties, com a linha de código abaixo e salvei no diretórios C:\Program Files\Java\jdk1.7.0_07\lib eC:\Program Files\Java\jre7\lib
swing.defaultlaf = javax.swing.plaf.nimbus.NimbusLookAndFeel
Depois inseri no documento o código abaixo e não funcionou:
public void actionPerformed( ActionEvent event )
{
UIManager.put( “nimbusBase”, new Color( 140, 42, 42 ) );
UIManager.put( “nimbusBlueGrey”, new Color( 190, 167, 167 ) );
UIManager.put( “control”, new Color( 223, 215, 214 ) );
try {
for ( LookAndFeelInfo info : UIManager.getInstalledLookAndFeels() ) {
if (“Nimbus”.equals( info.getName() ) ) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
}
catch(Exception e){
e.printStackTrace();
}
GuiConsultaProjeto panel2 = new GuiConsultaProjeto ();
panel2.setSize( 600, 200 );
panel2.setVisible( true );
} // fim do método actionPerformed
} // fim da classe interna anônima
); // fim da chamada para addActionListener
Alguém poderia dar uma força
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
} catch (Exception e) {
}
tente usar algo assim
Invocando UIManager.setLookAndFeel
Adicione o seguinte trecho em seu código fonte:
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (UnsupportedLookAndFeelException e) {
// handle exception
} catch (ClassNotFoundException e) {
// handle exception
} catch (InstantiationException e) {
// handle exception
} catch (IllegalAccessException e) {
// handle exception
}
O código do Nimbus já não é gerado automaticamente nos JFrames ? Veja:
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
}
//</editor-fold>