1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
public void updateLookAndFeel() {
try {
UIManager.setLookAndFeel(currentLookAndFeel);
this.update();
this.updateUI();
} catch (Exception ex) {
System.out.println("Failed loading L&F: " + currentLookAndFeel);
System.out.println(ex);
}
}
private void update() {
JFrame frame = getFrame();
if (frame == null) {
SwingUtilities.updateComponentTreeUI(this);
} else {
SwingUtilities.updateComponentTreeUI(frame);
}
}
public JFrame getFrame() {
return frame;
}
public void itemStateChanged(ItemEvent e) {
if (e.getSource() == Jmetal) {
setLookAndFeel(metal);
} else if (e.getSource() == Jwindows) {
setLookAndFeel(windows);
} else if (e.getSource() == Jaqua && Jmetal.isSelected()) {
MetalLookAndFeel.setCurrentTheme(new AquaTheme());
this.updateLookAndFeel();
} else if (e.getSource() == Jcontrast && Jmetal.isSelected()) {
MetalLookAndFeel.setCurrentTheme(new ContrastTheme());
this.updateLookAndFeel();
} else if (e.getSource() == Jemrald && Jmetal.isSelected()) {
MetalLookAndFeel.setCurrentTheme(new EmeraldTheme());
this.updateLookAndFeel();
} else if (e.getSource() == Jocean && Jmetal.isSelected()) {
MetalLookAndFeel.setCurrentTheme(new OceanTheme());
this.updateLookAndFeel();
} else if (e.getSource() == Jruby && Jmetal.isSelected()) {
MetalLookAndFeel.setCurrentTheme(new RubyTheme());
this.updateLookAndFeel();
} else if (e.getSource() == Jsteel && Jmetal.isSelected()) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
this.boutonsLook="3";
this.updateLookAndFeel();
} else if (e.getSource() == Jcharcoal && Jmetal.isSelected()) {
MetalLookAndFeel.setCurrentTheme(new CharcoalTheme());
this.boutonsLook="2";
this.updateLookAndFeel();
}
} |
Partager