hyperlink label: extract a common constructor

This commit is contained in:
Sergey Ignatov
2015-11-03 13:50:15 +03:00
parent cd78d09e0c
commit 0b542737cc
2 changed files with 8 additions and 14 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.ui.components.panels.HorizontalLayout;
import com.intellij.ui.components.panels.NonOpaquePanel;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.PlatformColors;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -86,7 +85,7 @@ public class EditorNotificationPanel extends JPanel {
}
public HyperlinkLabel createActionLabel(final String text, final Runnable action) {
HyperlinkLabel label = new HyperlinkLabel(text, PlatformColors.BLUE, getBackground(), PlatformColors.BLUE);
HyperlinkLabel label = new HyperlinkLabel(text, getBackground());
label.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,16 +67,11 @@ public class HyperlinkLabel extends HighlightableComponent {
}
public HyperlinkLabel(String text) {
this(text,
PlatformColors.BLUE,
new JBColor(new NotNullProducer<Color>() {
@NotNull
@Override
public Color produce() {
return UIUtil.getLabelBackground();
}
}),
PlatformColors.BLUE);
this(text, UIUtil.getLabelBackground());
}
public HyperlinkLabel(String text, Color background) {
this(text, PlatformColors.BLUE, background, PlatformColors.BLUE);
}
public HyperlinkLabel(String text, final Color textForegroundColor, final Color textBackgroundColor, final Color textEffectColor) {