javax.swing.JTextPane.addCaretListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(250)

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

JTextPane.addCaretListener介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public class TextPaneHighlightsDemo extends JFrame {

public TextPaneHighlightsDemo() {
  super("SplashScreen demo");
  setSize(300, 200);
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  final JTextPane textPane = new  JTextPane();
  add(textPane);
  textPane.addCaretListener(new CaretListener() {

    @Override
    public void caretUpdate(CaretEvent e) {
      Highlight[] h = textPane.getHighlighter().getHighlights();
      for(int i = 0; i < h.length; i++) {
        System.out.println(h[i].getStartOffset());
        System.out.println(h[i].getEndOffset());
      }

    }
  });
    }

public static void main (String args[]) {
  TextPaneHighlightsDemo test = new TextPaneHighlightsDemo();
  test.setVisible(true);
}
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

m_Output.addCaretListener(this);
m_Output.setDocument(outputOld.getDocument());
m_Output.setCaretPosition(m_Output.getDocument().getLength());

代码示例来源:origin: Waikato/weka-trunk

m_Output.addCaretListener(this);
m_Output.setDocument(outputOld.getDocument());
m_Output.setCaretPosition(m_Output.getDocument().getLength());

代码示例来源:origin: fr.inria.wimmics/kggui

textPaneQuery.addCaretListener(this);

代码示例来源:origin: antlr/codebuff

frame.getContentPane().add(scope.$$$getRootComponent$$$(), BorderLayout.CENTER);
scope.getFormattedTextPane().addCaretListener(new HighlightTokenListener());

代码示例来源:origin: Wimmics/corese

textPaneQuery.addCaretListener(this);

代码示例来源:origin: bbuck/DragonConsole

consolePane.addCaretListener(this);

代码示例来源:origin: org.integratedmodelling/klab-common

consolePane.addCaretListener(this);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mylyn-util

/**
 * Creates new form WikiEditPanel
 */
public WikiEditPanel(String wikiLanguage, boolean editing, boolean switchable) {
  this.wikiLanguage = wikiLanguage;
  this.switchable = switchable;
  this.wikiFormatText = "";
  this.htmlFormatText = "";
  initComponents();
  pnlButtons.setVisible(switchable);
  textCode.getDocument().addDocumentListener(new RevalidatingListener());
  textPreview.getDocument().addDocumentListener(new RevalidatingListener());
  textCode.addCaretListener(new CaretListener() {
    @Override
    public void caretUpdate(CaretEvent e) {
      makeCaretVisible(textCode);
    }
  });
  textCode.getDocument().addDocumentListener(new EnablingListener());
  // A11Y - Issues 163597 and 163598
  UIUtils.fixFocusTraversalKeys(textCode);
  UIUtils.issue163946Hack(scrollCode);
  Spellchecker.register(textCode);
  textPreview.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
  setEditing(editing);
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

editorViewport.setLineWrap(prefs.getBoolean("lineWrap", true));
scrollPane.setViewportView(editorViewport);
editor.addCaretListener(new CaretListener() {

代码示例来源:origin: org.antlr/stringtemplate

viewFrame.output.addCaretListener(caretListenerLabel);

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

jtpMain.addCaretListener(new CaretListener() {
 public void caretUpdate(CaretEvent ce) {
  handleCaretPositionChange(ce);

代码示例来源:origin: com.davidbracewell/hermes-core

editorPane.addCaretListener(e -> {
  JMenuBar menuBar = AnnotationEditor.this.getJMenuBar();
  if (menuBar == null) {

代码示例来源:origin: jsevellec/cassandra-unit

viewFrame.output.addCaretListener(caretListenerLabel);

代码示例来源:origin: org.antlr/ST4

viewFrame.output.addCaretListener(caretListenerLabel);

代码示例来源:origin: antlr/antlr3

viewFrame.output.addCaretListener(caretListenerLabel);

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

viewFrame.output.addCaretListener(caretListenerLabel);

代码示例来源:origin: antlr/stringtemplate4

viewFrame.output.addCaretListener(caretListenerLabel);

代码示例来源:origin: io.virtdata/virtdata-lib-realer

viewFrame.output.addCaretListener(caretListenerLabel);

代码示例来源:origin: apache/servicemix-bundles

viewFrame.output.addCaretListener(caretListenerLabel);

相关文章

JTextPane类方法