This involves 2 main steps.
Step 1: Create method to set Look & Feel of your preferences.
We use 'Nimbus' Look & Feel for this example.
private void initLookandFeel(){
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
}
Step 2: Setup and update the UI for new Look & Feel after all components have been initiated
When you have the class extended to JFrame class, do the following.
// constructor
public MyClass(){
// IntelliJ IDEA GUI form components binding and initiation
// to the given top panel name: 'mainPanel'
setContentPane(mainPanel);
// setting up Look and Feel and update UI
initLookandFeel();
SwingUtilities.updateComponentTreeUI(this)
}
If you are not sure how to get the IntelliJ IDEA forms be run, check here.
Comments
Post a Comment