⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abstractmainview.java~2~

📁 具有不同语法高亮的编辑器实例
💻 JAVA~2~
📖 第 1 页 / 共 5 页
字号:
  /**
   * Notifies all registered <code>CurrentTextAreaListener</code>s of a
   * change in the current text area.
   *
   * @param type The type of event to fire.
   * @param oldValue The old value.
   * @param newValue The new value.
   */
  protected void fireCurrentTextAreaEvent(int type, Object oldValue,
                                          Object newValue) {
    // Guaranteed to return a non-null array.
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event.
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
      if (listeners[i] == CurrentTextAreaListener.class) {
        ( (CurrentTextAreaListener) listeners[i + 1]).
            currentTextAreaPropertyChanged(
            new CurrentTextAreaEvent(this, type,
                                     oldValue, newValue));
      }
    }
  }

      /*****************************************************************************/

  /**
   * Returns the requested action.
   *
   * @param action The action to fetch, e.g., <code>FIND_ACTION</code> or
   *               <code>PRINT_ACTION</code>.
   * @see #getActions
   */
  public
  /*RecordableTextAction*/ Action getAction(int action) {
    return actions[action];
  }

      /*****************************************************************************/

  /**
   * Returns all actions owned by this main view.
   *
   * @return All actions owned by this main view.
   * @see #getAction
   */
  public Action[] getActions() {
    return actions;
  }

      /*****************************************************************************/

  /**
   * Returns the alpha value used to make the background image translucent.
   * This value does NOT change the background if no image is used (i.e., if
   * the background is just a color).
   *
   * @return The alpha value used to make a background image translucent.
   *         This value will be in the range 0.0f to 1.0f.
   * @see #setBackgroundImageAlpha
   */
  public float getBackgroundImageAlpha() {
    return imageAlpha;
  }

      /*****************************************************************************/

  /**
   * Returns the full path to the file containing the current background
   * image.
   *
   * @return The path, or <code>null</code> if the current background is a
   *         color.
   * @see #setBackgroundImageFileName
   */
  public String getBackgroundImageFileName() {
    return backgroundImageFileName;
  }

      /*****************************************************************************/

  /**
   * Returns the <code>Object</code> representing the background for all
   * documents in this tabbed pane; either a <code>java.awt.Color</code> or a
   * <code>java.lang.String</code>.
   */
  public Object getBackgroundObject() {
    return backgroundObject;
  }

      /*****************************************************************************/

  /**
   * Returns the blink rate for all text areas.
   *
   * @return The blink rate.
   * @see #setCaretBlinkRate
   */
  public int getCaretBlinkRate() {
    return caretBlinkRate;
  }

      /*****************************************************************************/

  /**
   * Returns the caret style for either the insert or overwrite caret.
   *
   * @param mode Either <code>RTextArea.INSERT_CARET</code> or
   *             <code>RTextArea.OVERWRITE_CARET</code>.
   * @return The style of that caret, such as
   *        <code>ConfigurableCaret.VERTICAL_LINE_STYLE</code>.
   * @see #setCaretStyle
   * @see org.fife.ui.rtextarea.ConfigurableCaret
   */
  public int getCaretStyle(int mode) {
    return carets[mode];
  }

      /*****************************************************************************/

  /**
   * Returns the name and path of the "default file;" that is, the file that
   * is created when the user selects "New".
   *
   * @return The new, empty file's name.
   */
  private final String getDefaultFileName() {
    return owner.getWorkingDirectory() +
        System.getProperty("file.separator") + owner.getNewFileName();
  }

      /*****************************************************************************/

  /**
   * Returns the background color used in bracket matching.
   *
   * @return The background color used when highlighting a bracket.
   * @see #setMatchedBracketBGColor
   */
  public Color getMatchedBracketBGColor() {
    return matchedBracketBGColor;
  }

      /*****************************************************************************/

  /**
   * Returns the border color used in bracket matching.
   *
   * @return The border color used when highlighting a bracket.
   * @see #setMatchedBracketBorderColor
   */
  public Color getMatchedBracketBorderColor() {
    return matchedBracketBorderColor;
  }

      /*****************************************************************************/

  /**
   * Returns the color being used for the carets of all text areas in this
   * main view.
   *
   * @return The <code>java.awt.Color</code> being used for all carets.
   */
  public Color getCaretColor() {
    return caretColor;
  }

      /*****************************************************************************/

  /**
   * Returns the color being used to highlight the current line.  Note that
   * if highlighting the current line is turned off, you will not be seeing
   * this highlight.
   *
   * @return The color being used to highlight the current line.
   * @see #isCurrentLineHighlightEnabled
   * @see #setCurrentLineHighlightEnabled
   * @see #setCurrentLineHighlightColor
   */
  public Color getCurrentLineHighlightColor() {
    return currentLineColor;
  }

      /*****************************************************************************/

  /**
   * Returns the currently active text area.
   *
   * @return The currently active text area.
   */
  public RTextEditorPane getCurrentTextArea() {
    return currentTextArea;
  }

      /*****************************************************************************/

  /**
   * Returns the name being displayed for the document.  For example, in a
   * tabbed pane subclass, this could be the text on the tab for this
   * document.
   *
   * @param index The index at which to find the name.  If the index is
   *              invalid, <code>null</code> is returned.
   * @return The name being displayed for this document.
   */
  public abstract String getDocumentDisplayNameAt(int index);

      /*****************************************************************************/

  /**
   * Returns the location of the document selection area of this component.
   *
   * @return The location of the document selection area.
   */
  public abstract int getDocumentSelectionPlacement();

      /*****************************************************************************/

  /**
   * Returns the index of the specified document.
   *
   * @return The index of the specified file, or <code>-1</code> if the file
   *         is not being edited.
   */
  public int getFileIndex(String fileFullPath) {
    int numDocuments = getNumDocuments();
    for (int i = 0; i < numDocuments; i++) {
      if (getRTextEditorPaneAt(i).getFileFullPath().equals(fileFullPath)) {
        return i;
      }
    }
    return -1;
  }

      /*****************************************************************************/

  /**
   * Returns the system icon associated with the file being edited in the
   * given scroll pane (actually, in the text area inside of it).  This
   * method is called by subclasses that want to display a system icon for
   * open files.
   *
   * @param scrollPane The scroll pane.
   * @return The icon.
   */
  protected Icon getIconFor(RTextScrollPane scrollPane) {
    RTextEditorPane textArea = (RTextEditorPane) scrollPane.textArea;
    return FileTypeIconManager.getInstance().getIconFor(textArea);
  }

      /*****************************************************************************/

  /**
   * Returns whether or not line numbers are visible in the open documents.
   */
  public boolean getLineNumbersEnabled() {
    return lineNumbersEnabled;
  }

      /*****************************************************************************/

  /**
   * Returns whether or not line (word) wrap is enabled for the open
   * documents.
   */
  public boolean getLineWrap() {
    return lineWrapEnabled;
  }

      /*****************************************************************************/

  /**
   * Returns the cursor to use when a macro is being recorded.
   *
   * @return The cursor for text areas when a macro is being recorded.
   */
  private static synchronized final Cursor getMacroCursor() {

    if (macroCursor == null) {

      // OS's will force the cursor to be a certain size (e.g., Windows
      // will make it 32x32 usually), even if you try to set the cursor
      // to some other size.  So, we create a cursor that is the "best"
      // cursor size to prevent our cursor image from being stretched.

      try {

        java.awt.Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit();
        java.awt.Dimension dim = toolkit.getBestCursorSize(16, 16);
        BufferedImage transparentImage = new BufferedImage(
            dim.width, dim.height,
            BufferedImage.TYPE_INT_ARGB);

        Graphics2D g2d = transparentImage.createGraphics();
        BufferedImage image = null;

        ClassLoader cl = AbstractMainView.class.getClassLoader();
        image = ImageIO.read(cl.getResource(
            "org/fife/rtext/graphics/macrocursor.gif"));
        g2d.drawImage(image, 0, 0, null);
        g2d.dispose();

        Point hotspot = new Point(0, 0);
        macroCursor = toolkit.createCustomCursor(transparentImage,
                                                 hotspot, "macroCursor");

        // If something fails (such as the cursor image not being found),
        // just use the crosshair cursor.
      }
      catch (Exception e) {
        macroCursor = Cursor.getPredefinedCursor(
            Cursor.CROSSHAIR_CURSOR);
      }

    } // End of if (macroCursor==null).

    return macroCursor;

  }

      /*****************************************************************************/

  /**
   * Returns the margin line's color.
   *
   * @return The color of the margin (even if it is not enabled).
   * @see #setMarginLineColor
   */
  public Color getMarginLineColor() {
    return marginLineColor;
  }

      /*****************************************************************************/

  /**
   * Returns the position of the margin line (even if it is not enabled).
   *
   * @return The position of the margin line.
   * @see #setMarginLinePosition
   */
  public int getMarginLinePosition() {
    return marginLinePosition;
  }

      /*****************************************************************************/

  /**
   * Returns the color selected by the user for "mark all."
   *
   * @return The color.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -