Fixed dark theme on KDE

這個提交存在於:
Arnaud Vergnet 2020-03-22 19:41:56 +01:00
父節點 fa236a612f
當前提交 5a1402bc1d

查看文件

@ -72,6 +72,7 @@ import org.insa.graphs.model.io.BinaryPathReader;
import org.insa.graphs.model.io.GraphReader; import org.insa.graphs.model.io.GraphReader;
import org.insa.graphs.model.io.MapMismatchException; import org.insa.graphs.model.io.MapMismatchException;
public class MainWindow extends JFrame { public class MainWindow extends JFrame {
/** /**
@ -82,7 +83,7 @@ public class MainWindow extends JFrame {
/** /**
* *
*/ */
private static final String WINDOW_TITLE = "BE Graphes INSA"; private static final String WINDOW_TITLE = "CC la famille";
/** /**
* *
@ -344,7 +345,7 @@ public class MainWindow extends JFrame {
JTextArea infoPanel = new JTextArea(); JTextArea infoPanel = new JTextArea();
infoPanel.setMinimumSize(new Dimension(200, 50)); infoPanel.setMinimumSize(new Dimension(200, 50));
infoPanel.setBackground(Color.WHITE); // infoPanel.setBackground(Color.WHITE);
infoPanel.setLineWrap(true); infoPanel.setLineWrap(true);
infoPanel.setEditable(false); infoPanel.setEditable(false);
this.logStream = new StreamCapturer(infoPanel); this.logStream = new StreamCapturer(infoPanel);
@ -377,7 +378,7 @@ public class MainWindow extends JFrame {
mainPanel.setResizeWeight(0.8); mainPanel.setResizeWeight(0.8);
mainPanel.setDividerSize(5); mainPanel.setDividerSize(5);
mainPanel.setBackground(Color.WHITE); // mainPanel.setBackground(Color.WHITE);
mainPanel.setLeftComponent(openPanel); mainPanel.setLeftComponent(openPanel);
mainPanel.setRightComponent(rightComponent); mainPanel.setRightComponent(rightComponent);
this.add(mainPanel, BorderLayout.CENTER); this.add(mainPanel, BorderLayout.CENTER);
@ -844,6 +845,15 @@ public class MainWindow extends JFrame {
// Try to set system look and feel. // Try to set system look and feel.
try { try {
boolean isThemeSet = false;
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(info.getClassName())) {
UIManager.setLookAndFeel(info.getClassName());
isThemeSet = true;
break;
}
}
if (!isThemeSet)
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} }
catch (Exception e) { catch (Exception e) {