Skip to content

Commit 0413c1d

Browse files
authored
Apply same font to Device Login Dialog (#2731)
1 parent 9887ff8 commit 0413c1d

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azuretools/ijidea/ui/DeviceLoginWindow.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,18 @@
3232
import com.microsoft.aad.adal4j.DeviceCode;
3333
import com.microsoft.intellij.ui.components.AzureDialogWrapper;
3434
import org.apache.log4j.Level;
35-
import org.apache.log4j.LogManager;
3635
import org.apache.log4j.Logger;
3736
import org.jetbrains.annotations.Nullable;
3837

38+
import javax.swing.JComponent;
39+
import javax.swing.JEditorPane;
40+
import javax.swing.JPanel;
41+
import javax.swing.UIManager;
42+
import javax.swing.event.HyperlinkEvent;
43+
import javax.swing.text.html.HTMLDocument;
44+
import java.awt.Color;
3945
import java.awt.Desktop;
46+
import java.awt.Font;
4047
import java.awt.Toolkit;
4148
import java.awt.Window;
4249
import java.awt.datatransfer.Clipboard;
@@ -47,10 +54,6 @@
4754
import java.net.URISyntaxException;
4855
import java.util.concurrent.ExecutionException;
4956
import java.util.concurrent.Future;
50-
import javax.swing.JComponent;
51-
import javax.swing.JEditorPane;
52-
import javax.swing.JPanel;
53-
import javax.swing.event.HyperlinkEvent;
5457

5558
public class DeviceLoginWindow extends AzureDialogWrapper {
5659
private static final String TITLE = "Azure Device Login";
@@ -82,6 +85,15 @@ public DeviceLoginWindow(final AuthenticationContext ctx, final DeviceCode devic
8285
}
8386
}
8487
});
88+
// Apply JLabel's font and color to JEditorPane
89+
final Font font = UIManager.getFont("Label.font");
90+
final Color foregroundColor = UIManager.getColor("Label.foreground");
91+
editorPanel.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
92+
if (font != null && foregroundColor != null) {
93+
editorPanel.setFont(font);
94+
editorPanel.setForeground(foregroundColor);
95+
}
96+
8597
authExecutor = ApplicationManager.getApplication()
8698
.executeOnPooledThread(() -> pullAuthenticationResult(ctx, deviceCode, callBack));
8799
init();

0 commit comments

Comments
 (0)