I had a JTextPane
had a differen background and foreground color.Now when the L&F is changed to Nimbus L&F, my JTextPane
's color is changed.How come?Only this class is having such problem.While others works well.What is the problem?
This is how i change L&F :
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(PlayBackVoice.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(PlayBackVoice.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(PlayBackVoice.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(PlayBackVoice.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
On the other hand, the color changed very well before setting this L&F. Or these statements were working well:
jtp.setBackground(Color.BLACK);
jtp.setForeground(Color.WHITE);
Any idea what is wrong?