// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.codeStyle.statusbar;

import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.ui.JBFont;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class CodeStyleStatusBarPanel extends JPanel {
  private final JLabel myLabel;
  private final JLabel myIconLabel;

  public CodeStyleStatusBarPanel() {
    super();
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    setAlignmentY(Component.CENTER_ALIGNMENT);
    myLabel = new JLabel();
    myLabel.setFont(SystemInfo.isMac ? JBUI.Fonts.label(11) : JBFont.label());
    add(myLabel);
    myIconLabel = new JLabel("");
    myIconLabel.setBorder(JBUI.Borders.empty(4));
    add(myIconLabel);
    setBorder(JBUI.Borders.empty(0));
    addMouseListener(new MouseAdapter() {
      @Override
      public void mouseExited(MouseEvent e) {
        setBackground(null);
      }
    });
  }

  public void setText(@NotNull String text) {
    myLabel.setText(text);
  }

  @Nullable
  public String getText() {
    return myLabel.getText();
  }

  public void setIcon(@Nullable Icon icon) {
    myIconLabel.setIcon(icon);
    myIconLabel.setVisible(icon != null);
  }
}

@@ -226,16 +226,70 @@
 emInfo;%0A
+import com.intellij.openapi.wm.impl.status.TextPanel;%0A
 import c
@@ -316,16 +316,16 @@
 JBFont;%0A
-
 import c
@@ -614,28 +614,31 @@
 ivate final 
-JLab
+TextPan
 el myLabel;%0A
@@ -850,16 +850,22 @@
 new 
-JLab
+TextPan
 el()
+ %7B%7D
 ;%0A  
@@ -1042,9 +1042,15 @@
 pty(
-4
+2,2,2,0
 ));%0A

Fix code style widget borders