<commit_before>/*
 * Copyright 2000-2011 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.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.ui.components;

import com.intellij.ui.AnchorableComponent;
import com.intellij.ui.ColorUtil;
import com.intellij.util.SystemProperties;
import com.intellij.util.ui.UIUtil;
import consulo.awt.TargetAWT;
import consulo.desktop.util.awt.StringHtmlUtil;
import consulo.ui.image.Image;
import org.intellij.lang.annotations.JdkConstants;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.EditorKit;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.Collections;

public class JBLabel extends JLabel implements AnchorableComponent {
  private UIUtil.ComponentStyle myComponentStyle = UIUtil.ComponentStyle.REGULAR;
  private UIUtil.FontColor myFontColor = UIUtil.FontColor.NORMAL;
  private JComponent myAnchor = null;
  private JEditorPane myEditorPane = null;
  private JLabel myIconLabel = null;
  private boolean myMultiline = false;
  private boolean myAllowAutoWrapping = false;

  public JBLabel() {
    super();
  }

  public JBLabel(@Nonnull UIUtil.ComponentStyle componentStyle) {
    super();
    setComponentStyle(componentStyle);
  }

  public JBLabel(@Nullable Image image) {
    super(TargetAWT.to(image));
  }
  
  public JBLabel(@Nonnull String text) {
    super(text);
  }

  public JBLabel(@Nonnull String text, @Nonnull UIUtil.ComponentStyle componentStyle) {
    super(text);
    setComponentStyle(componentStyle);
  }

  public JBLabel(@Nonnull String text, @Nonnull UIUtil.ComponentStyle componentStyle, @Nonnull UIUtil.FontColor fontColor) {
    super(text);
    setComponentStyle(componentStyle);
    setFontColor(fontColor);
  }

  public JBLabel(@Nonnull String text, @JdkConstants.HorizontalAlignment int horizontalAlignment) {
    super(text, horizontalAlignment);
  }

  public JBLabel(@Nullable Image image, @JdkConstants.HorizontalAlignment int horizontalAlignment) {
    super(TargetAWT.to(image), horizontalAlignment);
  }

  public JBLabel(@Nonnull String text, @Nullable Image icon, @JdkConstants.HorizontalAlignment int horizontalAlignment) {
    super(text, TargetAWT.to(icon), horizontalAlignment);
  }

  public void setComponentStyle(@Nonnull UIUtil.ComponentStyle componentStyle) {
    myComponentStyle = componentStyle;
    UIUtil.applyStyle(componentStyle, this);
  }

  public UIUtil.ComponentStyle getComponentStyle() {<commit_msg>text can be null if icon not null<commit_after>/*
 * Copyright 2000-2011 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.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.ui.components;

import com.intellij.ui.AnchorableComponent;
import com.intellij.ui.ColorUtil;
import com.intellij.util.SystemProperties;
import com.intellij.util.ui.UIUtil;
import consulo.awt.TargetAWT;
import consulo.desktop.util.awt.StringHtmlUtil;
import consulo.ui.image.Image;
import org.intellij.lang.annotations.JdkConstants;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.EditorKit;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.Collections;

public class JBLabel extends JLabel implements AnchorableComponent {
  private UIUtil.ComponentStyle myComponentStyle = UIUtil.ComponentStyle.REGULAR;
  private UIUtil.FontColor myFontColor = UIUtil.FontColor.NORMAL;
  private JComponent myAnchor = null;
  private JEditorPane myEditorPane = null;
  private JLabel myIconLabel = null;
  private boolean myMultiline = false;
  private boolean myAllowAutoWrapping = false;

  public JBLabel() {
    super();
  }

  public JBLabel(@Nonnull UIUtil.ComponentStyle componentStyle) {
    super();
    setComponentStyle(componentStyle);
  }

  public JBLabel(@Nullable Image image) {
    super(TargetAWT.to(image));
  }
  
  public JBLabel(@Nonnull String text) {
    super(text);
  }

  public JBLabel(@Nonnull String text, @Nonnull UIUtil.ComponentStyle componentStyle) {
    super(text);
    setComponentStyle(componentStyle);
  }

  public JBLabel(@Nonnull String text, @Nonnull UIUtil.ComponentStyle componentStyle, @Nonnull UIUtil.FontColor fontColor) {
    super(text);
    setComponentStyle(componentStyle);
    setFontColor(fontColor);
  }

  public JBLabel(@Nonnull String text, @JdkConstants.HorizontalAlignment int horizontalAlignment) {
    super(text, horizontalAlignment);
  }

  public JBLabel(@Nullable Image image, @JdkConstants.HorizontalAlignment int horizontalAlignment) {
    super(TargetAWT.to(image), horizontalAlignment);
  }

  public JBLabel(@Nullable String text, @Nullable Image icon, @JdkConstants.HorizontalAlignment int horizontalAlignment) {
    super(text, TargetAWT.to(icon), horizontalAlignment);
  }

  public void setComponentStyle(@Nonnull UIUtil.ComponentStyle componentStyle) {
    myComponentStyle = componentStyle;
    UIUtil.applyStyle(componentStyle, this);
  }

  public UIUtil.ComponentStyle getComponentStyle() {
{'fraction_non_alphanumeric': 0.08960403849187569, 'fraction_numerical': 0.003786086133459536, 'mean_word_length': 4.9698681732580035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '422023', 'n_tokens_mistral': 1823, 'n_tokens_neox': 1790, 'n_words': 491}