Line 38... |
Line 38... |
38 |
import javax.swing.UIManager;
|
38 |
import javax.swing.UIManager;
|
39 |
import javax.swing.UIManager.LookAndFeelInfo;
|
39 |
import javax.swing.UIManager.LookAndFeelInfo;
|
40 |
import javax.swing.UnsupportedLookAndFeelException;
|
40 |
import javax.swing.UnsupportedLookAndFeelException;
|
41 |
import javax.swing.border.LineBorder;
|
41 |
import javax.swing.border.LineBorder;
|
42 |
|
42 |
|
- |
|
43 |
import com.formdev.flatlaf.FlatLightLaf;
|
- |
|
44 |
|
43 |
public class UIPreferencePanel extends DefaultLocalPreferencePanel {
|
45 |
public class UIPreferencePanel extends DefaultLocalPreferencePanel {
|
44 |
|
46 |
|
45 |
private static final String UI_PROPERTIES = "ui.properties";
|
47 |
private static final String UI_PROPERTIES = "ui.properties";
|
46 |
private static final String ALTERNATE_COLOR_BLUE = "ui.list.alternate.color.blue";
|
48 |
private static final String ALTERNATE_COLOR_BLUE = "ui.list.alternate.color.blue";
|
47 |
private static final String ALTERNATE_COLOR_GREEN = "ui.list.alternate.color.green";
|
49 |
private static final String ALTERNATE_COLOR_GREEN = "ui.list.alternate.color.green";
|
Line 59... |
Line 61... |
59 |
public void uiInit() {
|
61 |
public void uiInit() {
|
60 |
this.setLayout(new GridBagLayout());
|
62 |
this.setLayout(new GridBagLayout());
|
61 |
final GridBagConstraints c = new DefaultGridBagConstraints();
|
63 |
final GridBagConstraints c = new DefaultGridBagConstraints();
|
62 |
c.fill = GridBagConstraints.NONE;
|
64 |
c.fill = GridBagConstraints.NONE;
|
63 |
this.add(new JLabel("Look"), c);
|
65 |
this.add(new JLabel("Look"), c);
|
64 |
comboLook = new JComboBox(new String[] { "natif du système", "Nimbus" });
|
66 |
comboLook = new JComboBox(new String[] { "natif du système", "Nimbus", "Flat" });
|
65 |
String look = this.properties.getProperty(UI_LOOK);
|
67 |
String look = this.properties.getProperty(UI_LOOK);
|
66 |
if (look != null && !look.equals("system")) {
|
68 |
if (look != null && look.equals("nimbus")) {
|
67 |
comboLook.setSelectedIndex(1);
|
69 |
comboLook.setSelectedIndex(1);
|
- |
|
70 |
} else if (look != null && look.equals("flat")) {
|
- |
|
71 |
comboLook.setSelectedIndex(2);
|
68 |
} else {
|
72 |
} else {
|
69 |
comboLook.setSelectedIndex(0);
|
73 |
comboLook.setSelectedIndex(0);
|
70 |
}
|
74 |
}
|
71 |
|
75 |
|
72 |
c.gridx++;
|
76 |
c.gridx++;
|
Line 209... |
Line 213... |
209 |
properties.setProperty(ALTERNATE_COLOR_GREEN, String.valueOf(background.getGreen()));
|
213 |
properties.setProperty(ALTERNATE_COLOR_GREEN, String.valueOf(background.getGreen()));
|
210 |
properties.setProperty(ALTERNATE_COLOR_BLUE, String.valueOf(background.getBlue()));
|
214 |
properties.setProperty(ALTERNATE_COLOR_BLUE, String.valueOf(background.getBlue()));
|
211 |
AlternateTableCellRenderer.setDefaultMap(Collections.singletonMap(Color.WHITE, background));
|
215 |
AlternateTableCellRenderer.setDefaultMap(Collections.singletonMap(Color.WHITE, background));
|
212 |
if (this.comboLook.getSelectedIndex() == 0) {
|
216 |
if (this.comboLook.getSelectedIndex() == 0) {
|
213 |
properties.setProperty(UI_LOOK, "system");
|
217 |
properties.setProperty(UI_LOOK, "system");
|
214 |
} else {
|
218 |
} else if (this.comboLook.getSelectedIndex() == 1) {
|
215 |
properties.setProperty(UI_LOOK, "nimbus");
|
219 |
properties.setProperty(UI_LOOK, "nimbus");
|
- |
|
220 |
} else {
|
- |
|
221 |
properties.setProperty(UI_LOOK, "flat");
|
216 |
}
|
222 |
}
|
217 |
|
223 |
|
218 |
if (this.comboDPI.getSelectedIndex() == 1) {
|
224 |
if (this.comboDPI.getSelectedIndex() == 1) {
|
219 |
properties.setProperty(UI_DPI, "1.3");
|
225 |
properties.setProperty(UI_DPI, "1.3");
|
220 |
} else if (this.comboDPI.getSelectedIndex() == 2) {
|
226 |
} else if (this.comboDPI.getSelectedIndex() == 2) {
|
Line 270... |
Line 276... |
270 |
AlternateTableCellRenderer.setDefaultMap(Collections.singletonMap(Color.WHITE, new Color(r, g, b)));
|
276 |
AlternateTableCellRenderer.setDefaultMap(Collections.singletonMap(Color.WHITE, new Color(r, g, b)));
|
271 |
}
|
277 |
}
|
272 |
|
278 |
|
273 |
final String look = properties.getProperty(UI_LOOK);
|
279 |
final String look = properties.getProperty(UI_LOOK);
|
274 |
final String nimbusClassName = getNimbusClassName();
|
280 |
final String nimbusClassName = getNimbusClassName();
|
275 |
|
- |
|
276 |
if (look != null && look.equals("system")) {
|
281 |
if (look != null && look.equals("flat")) {
|
- |
|
282 |
FlatLightLaf.install();
|
- |
|
283 |
} else if (look != null && look.equals("system")) {
|
277 |
useSystemLF();
|
284 |
useSystemLF();
|
278 |
} else if (look != null && look.equals("nimbus")) {
|
285 |
} else if (look != null && look.equals("nimbus")) {
|
279 |
useNimbusLF();
|
286 |
useNimbusLF();
|
280 |
} else if (nimbusClassName == null || !System.getProperty("os.name", "??").toLowerCase().contains("linux")) {
|
287 |
} else if (nimbusClassName == null || !System.getProperty("os.name", "??").toLowerCase().contains("linux")) {
|
281 |
useSystemLF();
|
288 |
useSystemLF();
|
282 |
} else {
|
289 |
} else {
|
283 |
useNimbusLF();
|
290 |
FlatLightLaf.install();
|
284 |
}
|
291 |
}
|
285 |
final String dpi = properties.getProperty(UI_DPI);
|
292 |
final String dpi = properties.getProperty(UI_DPI);
|
286 |
if (dpi != null && dpi.length() > 0 && !dpi.equalsIgnoreCase("1")) {
|
293 |
if (dpi != null && dpi.length() > 0 && !dpi.equalsIgnoreCase("1")) {
|
287 |
setUIFont(Float.valueOf(dpi));
|
294 |
setUIFont(Float.valueOf(dpi));
|
288 |
UIManager.put("dpi.scale", Float.valueOf(dpi));
|
295 |
UIManager.put("dpi.scale", Float.valueOf(dpi));
|