class EditorRegionLabel extends JLabel implements MouseListener, EventObserver {

  protected String pyText;
  protected String oldPyText = null;
  private EditorPane editor;
  private final Color bc = Color.BLACK;
  private final Color bcs = Color.RED;
  private Color fc;
  private final Color fcs = Color.RED;
  private final Border paddingBorder = BorderFactory.createEmptyBorder(0, 4, 0, 3);
  private final Border border = BorderFactory.createLineBorder(bc);
  private final Border borders = BorderFactory.createLineBorder(bcs);
  private final Border bfinal = BorderFactory.createCompoundBorder(paddingBorder, border);
  private final Border bfinals = BorderFactory.createCompoundBorder(paddingBorder, borders);

  private SikuliIDEPopUpMenu popMenu = null;
  private boolean wasPopup = false;

  EditorRegionLabel() {
  }

  EditorRegionLabel(EditorPane pane, String lblText) {
    init(pane, lblText);
  }

  EditorRegionLabel(EditorPane pane, String lblText, String oldText) {
    oldPyText = oldText;
    init(pane, lblText);
  }

  private void init(EditorPane pane, String lblText) {
    editor = pane;
    pyText = lblText;
    setFont(new Font(editor.getFont().getFontName(), Font.PLAIN, editor.getFont().getSize()));
    setBorder(bfinal);
    setCursor(new Cursor(Cursor.HAND_CURSOR));
    addMouseListener(this);
    setText(pyText.replaceAll("Region", "").replaceAll("\\(", "").replaceAll("\\)", ""));
  }

  public boolean isRegionLabel() {
    return true;
  }

  public static EditorRegionLabel labelFromString(EditorPane parentPane, String str) {
    EditorRegionLabel reg = new EditorRegionLabel(parentPane, str);
    return reg;
  }

  @Override
  public String toString() {
    return pyText;
  }

  @Override
  public void mousePressed(MouseEvent me) {
    checkPopup(me);
  }

  @Override
  public void mouseReleased(MouseEvent me) {
     checkPopup(me);
 }

  private void checkPopup(MouseEvent me) {
    if (me.isPopupTrigger()) {
      popMenu = editor.getPopMenuImage();
      if (popMenu != null) {
        wasPopup = true;
        popMenu.show(this, me.getX(), me.getY());
      }
      return;
    }
  }

  @Override
  public void mouseClicked(MouseEvent me) {
    if (wasPopup) {
      wasPopup = false;
      return;
    }
    SikulixIDE ide = SikulixIDE.get();
    ide.setVisible(false);
    setForeground(fc);
    setBorder(bfinal);
    RunTime.pause(0.5f);
    Screen.doPrompt(SikulixIDE._I("msgCapturePrompt"), this);
  }

  @Override
  public void update(EventSubject es) {<FILL_FUNCTION_BODY>}

  @Override
  public void mouseEntered(MouseEvent me) {
    setForeground(fcs);
    setBorder(bfinals);
  }

  @Override
  public void mouseExited(MouseEvent me) {
    setForeground(fc);
    setBorder(bfinal);
  }
}

    OverlayCapturePrompt ocp = (OverlayCapturePrompt) es;
    ScreenImage simg = null; //TODO ocp.getSelection();
    Screen.closePrompt();
    if (simg != null) {
      try {
        Thread.sleep(300);
      } catch (InterruptedException ie) {
      }
      Rectangle roi = simg.getRect();
      pyText = String.format("%d,%d,%d,%d",
              (int) roi.x, (int) roi.y, (int) roi.width, (int) roi.height);
      setText(pyText);
      pyText = "Region(" + pyText + ")";
    }
    Screen.resetPrompt(ocp);
    SikulixIDE.showAgain();
  
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void <init>(javax.swing.Icon) ,public void <init>(java.lang.String, int) ,public void <init>(javax.swing.Icon, int) ,public void <init>(java.lang.String, javax.swing.Icon, int) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.Icon getDisabledIcon() ,public int getDisplayedMnemonic() ,public int getDisplayedMnemonicIndex() ,public int getHorizontalAlignment() ,public int getHorizontalTextPosition() ,public javax.swing.Icon getIcon() ,public int getIconTextGap() ,public java.awt.Component getLabelFor() ,public java.lang.String getText() ,public javax.swing.plaf.LabelUI getUI() ,public java.lang.String getUIClassID() ,public int getVerticalAlignment() ,public int getVerticalTextPosition() ,public boolean imageUpdate(java.awt.Image, int, int, int, int, int) ,public void setDisabledIcon(javax.swing.Icon) ,public void setDisplayedMnemonic(int) ,public void setDisplayedMnemonic(char) ,public void setDisplayedMnemonicIndex(int) throws java.lang.IllegalArgumentException,public void setHorizontalAlignment(int) ,public void setHorizontalTextPosition(int) ,public void setIcon(javax.swing.Icon) ,public void setIconTextGap(int) ,public void setLabelFor(java.awt.Component) ,public void setText(java.lang.String) ,public void setUI(javax.swing.plaf.LabelUI) ,public void setVerticalAlignment(int) ,public void setVerticalTextPosition(int) ,public void updateUI() <variables>static final java.lang.String LABELED_BY_PROPERTY,private javax.swing.Icon defaultIcon,private javax.swing.Icon disabledIcon,private boolean disabledIconSet,private int horizontalAlignment,private int horizontalTextPosition,private int iconTextGap,protected java.awt.Component labelFor,private int mnemonic,private int mnemonicIndex,private java.lang.String text,private static final java.lang.String uiClassID,private int verticalAlignment,private int verticalTextPosition