I ask for a help please , I'm still very new to programming. I just create a simple JFrame
in NeatBeans with some Look And Feel's /Themes available using the JComboBox
for the user to choose the LAF/theme
what he wants, and also I put the "Save" button to Action , so far I can change the "Theme" perfectly , the problem is that the " LAF / Theme " just chosen is " save " at the moment of execution, when closing and perform the JFrame
again the LAF chosen remains unsaved , I would like to know how to create a method to "Save " and Keep the " LAF / theme " chosen . Can someone help me? Thank you very much in advance!
Here's the example:
Here is the button Save Code
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {
//Button Save Action
String t = (String)jComboBoxLAF.getSelectedItem();
JOptionPane.showMessageDialog(null, t);
try {
if ("Metal".equals(t)){
UIManager.setLookAndFeel(new MetalLookAndFeel());
this.setVisible(false);
new TelaJtable().setVisible(true);
}else if("Nimbus".equals(t)){
UIManager.setLookAndFeel(new NimbusLookAndFeel());
this.setVisible(false);
new TelaJtable().setVisible(true);
}else if("CDE/Motif".equals(t)){
UIManager.setLookAndFeel(new MotifLookAndFeel());
this.setVisible(false);
new TelaJtable().setVisible(true);
}else if("Windows".equals(t)){
UIManager.setLookAndFeel(new WindowsLookAndFeel());
this.setVisible(false);
new TelaJtable().setVisible(true);
}
else if("Windows Classic".equals(t)){
UIManager.setLookAndFeel(new WindowsClassicLookAndFeel());
this.setVisible(false);
new TelaJtable().setVisible(true);
}
} catch (Exception e) {
}
}