eirikbakke commented on code in PR #5795:
URL: https://github.com/apache/netbeans/pull/5795#discussion_r1161342975
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLafOptionsPanel.java:
##########
@@ -51,9 +64,49 @@ public class FlatLafOptionsPanel extends javax.swing.JPanel {
public FlatLafOptionsPanel(FlatLafOptionsPanelController controller) {
this.controller = controller;
initComponents();
+ initAccentColor();
Review Comment:
Some indent problems in this patch/file (mix of tabs and spaces). Existing
indents are spaces, so maybe use spaces.
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLafOptionsPanel.java:
##########
@@ -51,9 +64,49 @@ public class FlatLafOptionsPanel extends javax.swing.JPanel {
public FlatLafOptionsPanel(FlatLafOptionsPanelController controller) {
this.controller = controller;
initComponents();
+ initAccentColor();
updateEnabled();
}
+ private void initAccentColor() {
+ ArrayList<String> names = new ArrayList<>();
+ ArrayList<Color> colors = new ArrayList<>();
+ names.add("default");
+ colors.add(DEFAULT);
+
+ String s = UIManager.getString("nb.accentColors.predefined");
+ if (s == null) {
+ // FlatLaf is not the current look and feel
+ Properties properties = new Properties();
+ try {
+
properties.load(getClass().getClassLoader().getResourceAsStream(
+ "org/netbeans/swing/laf/flatlaf/FlatLaf.properties"));
+ s = properties.getProperty("nb.accentColors.predefined");
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ if (s != null) {
+ for (String part : s.split(";")) {
+ int sepIndex = part.indexOf(':');
+ if (sepIndex > 1) {
Review Comment:
Technically should be >= 1, but there are no single-character color names,
so it doesn't really matter...
##########
platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLafPrefs.java:
##########
@@ -35,6 +37,28 @@ class FlatLafPrefs {
private static final Preferences prefs =
NbPreferences.forModule(FlatLafPrefs.class);
+ static Color getAccentColor() {
+ return parseColor(prefs.get(ACCENT_COLOR, null));
Review Comment:
What happens in this case when the "default" color was selected? Does the
accent color then end up being taken from the various FlatLAF.properties files,
or does it end up being explicitly set to the zero-alpha DEFAULT color, with
invisible accents?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists