javax.swing.text.Caret.setVisible()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中javax.swing.text.Caret.setVisible()方法的一些代码示例,展示了Caret.setVisible()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Caret.setVisible()方法的具体详情如下:
包路径:javax.swing.text.Caret
类名称:Caret
方法名:setVisible

Caret.setVisible介绍

暂无

代码示例

代码示例来源:origin: skylot/jadx

CodeArea(CodePanel panel) {
  this.contentPanel = panel;
  this.node = panel.getNode();
  setMarkOccurrences(true);
  setEditable(false);
  loadSettings();
  Caret caret = getCaret();
  if (caret instanceof DefaultCaret) {
    ((DefaultCaret) caret).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
  }
  caret.setVisible(true);
  setSyntaxEditingStyle(node.getSyntaxName());
  if (node instanceof JClass) {
    JClass jClsNode = (JClass) this.node;
    ((RSyntaxDocument) getDocument()).setSyntaxStyle(new JadxTokenMaker(this, jClsNode));
    setHyperlinksEnabled(true);
    CodeLinkGenerator codeLinkProcessor = new CodeLinkGenerator(contentPanel, this, jClsNode);
    setLinkGenerator(codeLinkProcessor);
    addHyperlinkListener(codeLinkProcessor);
    addMenuItems(jClsNode);
  }
  registerWordHighlighter();
  setText(node.getContent());
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Sets the text mode for this editor pane.  If the currently installed
 * caret is an instance of {@link ConfigurableCaret}, it will be
 * automatically updated to render itself appropriately for the new text
 * mode.
 *
 * @param mode Either {@link #INSERT_MODE} or {@link #OVERWRITE_MODE}.
 * @see #getTextMode()
 */
public void setTextMode(int mode) {
  if (mode!=INSERT_MODE && mode!=OVERWRITE_MODE) {
    mode = INSERT_MODE;
  }
  if (textMode != mode) {
    Caret caret = getCaret();
    if (caret instanceof ConfigurableCaret) {
      ((ConfigurableCaret)caret).setStyle(carets[mode]);
    }
    textMode = mode;
    // Prevent the caret from blinking while e.g. holding down the
    // Insert key to toggle insert/overwrite modes
    caret.setVisible(false);
    caret.setVisible(true);
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
  public void focusGained(FocusEvent arg0) {
    DialogTranslate.this.textToTranslate[0].getCaret().setVisible(true);
    DialogTranslate.this.textToTranslate[0].getCaret().setSelectionVisible(true);
  }
});

代码示例来源:origin: ron190/jsql-injection

@Override
  public void focusGained(FocusEvent arg0) {
    browser.getCaret().setVisible(true);
    browser.getCaret().setSelectionVisible(true);
  }
});

代码示例来源:origin: ron190/jsql-injection

@Override
  public void focusGained(FocusEvent arg0) {
    text[0].getCaret().setVisible(true);
    text[0].getCaret().setSelectionVisible(true);
  }
});

代码示例来源:origin: ron190/jsql-injection

@Override
  public void focusGained(FocusEvent arg0) {
    JPopupTextPane.this.getProxy().getCaret().setVisible(true);
    JPopupTextPane.this.getProxy().getCaret().setSelectionVisible(true);
  }
});

代码示例来源:origin: ron190/jsql-injection

@Override
  public void focusGained(FocusEvent arg0) {
    JPopupTextArea.this.getProxy().getCaret().setVisible(true);
    JPopupTextArea.this.getProxy().getCaret().setSelectionVisible(true);
  }
});

代码示例来源:origin: ron190/jsql-injection

@Override
  public void focusGained(FocusEvent arg0) {
    JColoredConsole.this.getProxy().getCaret().setVisible(true);
    JColoredConsole.this.getProxy().getCaret().setSelectionVisible(true);
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public void focusGained(java.awt.event.FocusEvent e) {
// DEBUG System.out.printf("disasm: focusGained()\n");
editorPane.getCaret().setVisible(true);
}
public void focusLost(java.awt.event.FocusEvent e) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-extension-openide

/**
 * called to restore the state of a component
 * because a drop was performed.
 */
protected void restoreComponentStateForDrop(JComponent comp) {
  JTextComponent c = (JTextComponent) comp;
  Caret caret = c.getCaret();
  caret.setVisible(visible);
}

代码示例来源:origin: mucommander/mucommander

/**
   * Appends the specified string to the shell output area.
   * @param s string to append to the shell output area.
   */
  private void addToTextArea(String s) {
    outputTextArea.append(s);
    outputTextArea.setCaretPosition(outputTextArea.getText().length());
    outputTextArea.getCaret().setVisible(true);
    outputTextArea.repaint();
  }
}

代码示例来源:origin: ro.isdc.wro4j/rhino

@Override
  public void internalFrameActivated(InternalFrameEvent e) {
    // hack
    if (consoleTextArea.hasFocus()) {
      consoleTextArea.getCaret().setVisible(false);
      consoleTextArea.getCaret().setVisible(true);
    }
  }
});

代码示例来源:origin: com.github.houbie/rhino-mod

@Override
  public void internalFrameActivated(InternalFrameEvent e) {
    // hack
    if (consoleTextArea.hasFocus()) {
      consoleTextArea.getCaret().setVisible(false);
      consoleTextArea.getCaret().setVisible(true);
    }
  }
});

代码示例来源:origin: omegat-org/omegat

@Override
  public void focusGained(FocusEvent e) {
    Caret caret = comp.getCaret();
    caret.setVisible(true);
    caret.setSelectionVisible(true);
  }
};

代码示例来源:origin: org.apache.uima/uimaj-tools

@Override
public void focusGained(FocusEvent e) {
 // Need to make the caret visible when gaining focus. Sometimes this happens automatically, but
 // not always. Not sure if there is a better way to do this.
 this.main.getTextArea().getCaret().setVisible(true);
}

代码示例来源:origin: com.github.tntim96/rhino

/**
 * Called when the mouse is clicked.
 */
public void mouseClicked(MouseEvent e) {
  checkPopup(e);
  requestFocus();
  getCaret().setVisible(true);
}

代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger

/**
 * Called when the mouse is clicked.
 */
public void mouseClicked(MouseEvent e) {
  checkPopup(e);
  requestFocus();
  getCaret().setVisible(true);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-extension-openide

/**
 * called to restore the state of a component 
 * because a drop was not performed.
 */
protected void restoreComponentState(JComponent comp) {
  JTextComponent c = (JTextComponent) comp;
  Caret caret = c.getCaret();
  caret.setDot(mark);
  caret.moveDot(dot);
  caret.setVisible(visible);
}

代码示例来源:origin: org.zaproxy/zap

private ZapTextArea getRequestField() {
  if (requestField == null) {
    requestField = new ZapTextArea();
    requestField.setEditable(false);
    requestField.setLineWrap(true);
    requestField.getCaret().setVisible(true);
  }
  return requestField;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-extension-openide

/**
 * called to save the state of a component in case it needs to
 * be restored because a drop is not performed.
 */
protected void saveComponentState(JComponent comp) {
  JTextComponent c = (JTextComponent) comp;
  Caret caret = c.getCaret();
  dot = caret.getDot();
  mark = caret.getMark();
  visible = caret.isVisible();
  caret.setVisible(true);
}

相关文章