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

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

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

JTextPane.getCaret介绍

暂无

代码示例

代码示例来源: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) {
    JColoredConsole.this.getProxy().getCaret().setVisible(true);
    JColoredConsole.this.getProxy().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

caret = (DefaultCaret) PanelConsoles.NETWORK_TAB_SOURCE.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
caret = (DefaultCaret) PanelConsoles.NETWORK_TAB_PREVIEW.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
caret = (DefaultCaret) PanelConsoles.NETWORK_TAB_HEADER.getCaret();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-project

@Override
public void componentActivated() {
  // Make the caret visible. See comment under componentDeactivated.
  if (text != null) {
    Caret caret = text.getCaret();
    if (caret != null) {
      caret.setVisible(true);
    }
  }
}

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

JTextPane tp = new JTextPane();
DefaultCaret caret = (DefaultCaret) tp.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
textPane.setText("Lorem ipsum dolor sit amet consectetuer tellus sociis sapien porttitor "+
  ....

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

JTextPane textPane = new JTextPane();
DefaultCaret caret = (DefaultCaret)textPane.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
textPane.setText(...);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai-ui

public void run() {
    inbox.getCaret().setVisible(false);
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-project

@Override
public void componentDeactivated() {
  // I have to turn off the caret when the window loses focus. Text components
  // normally do this by themselves, but the TextAreaReadline component seems
  // to mess around with the editable property of the text pane, and
  // the caret will not turn itself on/off for noneditable text areas.
  if (text != null) {
    Caret caret = text.getCaret();
    if (caret != null) {
      caret.setVisible(false);
    }
  }
}

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

@Override
public void popupMenuCanceled(PopupMenuEvent e) {
 editorPane.getCaret().setVisible(true);
}

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

@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
 editorPane.getCaret().setVisible(true);
}

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

for (int i = 0; i < 10; i++) {
  final JTextPane tp = new JTextPane();
  final DefaultCaret caret = (DefaultCaret) tp.getCaret();
  caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
  tp.setText("This is some text in text pane " + i);
  p.add(tp);

  // adding some other components simply leaves the scrollPane at the top
  // JComponent b = new JButton("This is some text in button "
  // + i);
  // p.add(b);
}

final JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(new JScrollPane(p));

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

JTextPane jtp = new JTextPane();
DefaultCaret caret = (DefaultCaret) jtp.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai-ui

private void srcFeedPaneFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_srcFeedPaneFocusGained
  srcFeedPane.getCaret().setVisible(false); //MacOSX hack
}//GEN-LAST:event_srcFeedPaneFocusGained

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

JTextPane textPane = new JTextPane();
DefaultCaret caret = (DefaultCaret) textPane.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);

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

public void run() {
    // XXX #28191: some other piece of code should underline these, etc.
      StringWriter wr = new StringWriter();
      current.printStackTrace(new PrintWriter(wr, true));
      output.setText(wr.toString());
      output.getCaret().setDot(0);
      output.requestFocus ();
  }
});

代码示例来源:origin: com.hynnet/jradius-extended

public LogConsole(String defaultText) {
  this.defaultText = defaultText;
  setLayout(new BorderLayout());
  add(container, BorderLayout.CENTER);
  console.setEditable(false);
  console.getCaret().setBlinkRate(0);
  container.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  container.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  container.getVerticalScrollBar().addAdjustmentListener(this);
  singleton = this;
}

代码示例来源:origin: net.jradius/jradius-extended

public LogConsole(String defaultText) {
  this.defaultText = defaultText;
  setLayout(new BorderLayout());
  add(container, BorderLayout.CENTER);
  console.setEditable(false);
  console.getCaret().setBlinkRate(0);
  container.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  container.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  container.getVerticalScrollBar().addAdjustmentListener(this);
  singleton = this;
}

代码示例来源:origin: coova/jradius

public LogConsole(String defaultText) {
  this.defaultText = defaultText;
  setLayout(new BorderLayout());
  add(container, BorderLayout.CENTER);
  console.setEditable(false);
  console.getCaret().setBlinkRate(0);
  container.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  container.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  container.getVerticalScrollBar().addAdjustmentListener(this);
  singleton = this;
}

代码示例来源:origin: MegaMek/mekhq

private void initComponents() {
  setLayout(new BorderLayout());
  setBorder(BorderFactory.createTitledBorder("Daily Log"));
  txtLog.setContentType("text/html"); // NOI18N
  txtLog.setEditable(false);
  DefaultCaret caret = (DefaultCaret)txtLog.getCaret();
  caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
  JScrollPane scrLog = new JScrollPane(txtLog);
  scrLog.setBorder(new EmptyBorder(2,10,2,2));
  add(scrLog, BorderLayout.CENTER);
}

相关文章

JTextPane类方法