diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18aad455..e911fb46 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ FlatLaf Change Log
"FlatLaf". Use `UIManager.getLookAndFeel().getID().startsWith( "FlatLaf" )` to
check whether the current look and feel is FlatLaf.
- Fixed selection background of checkbox in table cell.
+- Fixed color of links in HTML text.
- Fixed jittery submenu rendering on Mac. (issue #10)
- Button: Make button square if button text is "..." or a single character.
- ComboBox: Fixed issues with NetBeans `org.openide.awt.ColorComboBox`
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java
index ba401d8c..e9055e1d 100644
--- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java
@@ -42,6 +42,7 @@ import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.basic.BasicLookAndFeel;
import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.text.html.HTMLEditorKit;
import com.formdev.flatlaf.util.SystemInfo;
import com.formdev.flatlaf.util.UIScale;
@@ -149,6 +150,9 @@ public abstract class FlatLaf
mnemonicListener = null;
}
+ // restore default link color
+ new HTMLEditorKit().getStyleSheet().addRule( "a { color: blue; }" );
+
if( base != null )
base.uninitialize();
@@ -217,6 +221,13 @@ public abstract class FlatLaf
if( useScreenMenuBar )
defaults.put( "MenuBarUI", aquaMenuBarUI );
+ // update link color in HTML text
+ Color linkColor = defaults.getColor( "Component.linkColor" );
+ if( linkColor != null ) {
+ new HTMLEditorKit().getStyleSheet().addRule(
+ String.format( "a { color: #%06x; }", linkColor.getRGB() & 0xffffff ) );
+ }
+
return defaults;
}
diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties
index e6d92580..d55cd793 100644
--- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties
+++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties
@@ -122,6 +122,7 @@ Component.borderColor=#646464
Component.disabledBorderColor=#646464
Component.focusedBorderColor=#466d94
Component.focusColor=#3d6185
+Component.linkColor=#589df6
#---- List ----
diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties
index f730a7a4..e50adcea 100644
--- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties
+++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties
@@ -124,6 +124,7 @@ Component.borderColor=#c4c4c4
Component.disabledBorderColor=#cfcfcf
Component.focusedBorderColor=#87afda
Component.focusColor=#97c3f3
+Component.linkColor=#4a78c2
#---- HelpButton ----
diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.java
index 11b88bff..71443174 100644
--- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.java
+++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/OptionPanePanel.java
@@ -296,7 +296,7 @@ class OptionPanePanel
private JOptionPane optionPane;
ShowDialogLinkLabel() {
- setText( "Show dialog" );
+ setText( "Show dialog" );
addMouseListener( new MouseAdapter() {
@Override
diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java
index 7f048d41..5aec6569 100644
--- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java
+++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.java
@@ -784,7 +784,7 @@ public class FlatComponentsTest
"[]"));
//---- label3 ----
- label3.setText("JLabel HTML
Sample content
text");
+ label3.setText("JLabel HTML
Sample content
text with link");
panel3.add(label3, "cell 0 0");
//======== scrollPane15 ========
@@ -792,7 +792,7 @@ public class FlatComponentsTest
//---- editorPane6 ----
editorPane6.setContentType("text/html");
- editorPane6.setText("JEditorPane HTML
Sample content
text");
+ editorPane6.setText("JEditorPane HTML
Sample content
text with link");
scrollPane15.setViewportView(editorPane6);
}
panel3.add(scrollPane15, "cell 0 1,grow");
@@ -802,7 +802,7 @@ public class FlatComponentsTest
//---- textPane6 ----
textPane6.setContentType("text/html");
- textPane6.setText("JTextPane HTML
Sample content
text");
+ textPane6.setText("JTextPane HTML
Sample content
text with link");
scrollPane16.setViewportView(textPane6);
}
panel3.add(scrollPane16, "cell 0 2,grow");
diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.jfd
index 22af28a8..dfe4dcf6 100644
--- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.jfd
+++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentsTest.jfd
@@ -737,7 +737,7 @@ new FormModel {
"opaque": false
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
- "text": "JLabel HTML
Sample content
text"
+ "text": "JLabel HTML
Sample content
text with link"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
@@ -746,7 +746,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane6"
"contentType": "text/html"
- "text": "JEditorPane HTML
Sample content
text"
+ "text": "JEditorPane HTML
Sample content
text with link"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1,grow"
@@ -756,7 +756,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane6"
"contentType": "text/html"
- "text": "JTextPane HTML
Sample content
text"
+ "text": "JTextPane HTML
Sample content
text with link"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2,grow"
diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.java
index ee2e1960..aed743a4 100644
--- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.java
+++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatOptionPaneTest.java
@@ -296,7 +296,7 @@ public class FlatOptionPaneTest
private JOptionPane optionPane;
ShowDialogLinkLabel() {
- setText( "Show dialog" );
+ setText( "Show dialog" );
addMouseListener( new MouseAdapter() {
@Override