javax.swing.JEditorPane.select()方法的使用及代码示例

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

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

JEditorPane.select介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
  public void messageReceived(Client source, Message m) {
    ChatMessage chat = (ChatMessage) m;
    System.out.println("Received:" + chat);
    // One of the least efficient ways to add text to a
    // JEditorPane
    chatMessages.append("<font color='#00a000'>" + (m.isReliable() ? "TCP" : "UDP") + "</font>");
    chatMessages.append(" -- <font color='#000080'><b>" + chat.getName() + "</b></font> : ");
    chatMessages.append(chat.getMessage());
    chatMessages.append("<br />");
    String s = "<html><body>" + chatMessages + "</body></html>";
    chatLog.setText(s);
    // Set selection to the end so that the scroll panel will scroll
    // down.
    chatLog.select(s.length(), s.length());
  }
}

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

JEditorPane citEditorPane;
//user fills pane with MLA citations.
citEditorPane.selectAll();
citEditorPane.copy();
citEditorPane.select(0, 0);

代码示例来源:origin: org.jspresso.framework/jspresso-swing-components

/**
  * {@inheritDoc}
  */
 @Override
 protected Transferable createTransferable(JComponent c) {
  String text = detailsPane.getSelectedText();
  if (text == null || text.equals("")) {
   detailsPane.selectAll();
   text = detailsPane.getSelectedText();
   detailsPane.select(-1, -1);
  }
  return new StringSelection(text);
 }
}

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

void setData(final CharSequence doc) {
    editorPane.setContentType("text/html"); //NOI18N
    editorPane.setText(doc.toString());
    editorPane.select(0, 0);
  }
}

代码示例来源:origin: org.jspresso/jspresso-swing-components

/**
  * {@inheritDoc}
  */
 @Override
 protected Transferable createTransferable(@SuppressWarnings("unused")
 JComponent c) {
  String text = detailsPane.getSelectedText();
  if (text == null || text.equals("")) {
   detailsPane.selectAll();
   text = detailsPane.getSelectedText();
   detailsPane.select(-1, -1);
  }
  return new StringSelection(text);
 }
}

代码示例来源:origin: net.imagej/ij

public void keyPressed(KeyEvent e) {
  int keyCode = e.getKeyCode(); 
  ij.IJ.setKeyDown(keyCode);
  escapePressed = keyCode==KeyEvent.VK_ESCAPE;
  if (keyCode==KeyEvent.VK_C) {
    if (editorPane.getSelectedText()==null || editorPane.getSelectedText().length()==0)
      editorPane.selectAll();
    editorPane.copy();
    editorPane.select(0,0);
  } else if (keyCode==KeyEvent.VK_ENTER || keyCode==KeyEvent.VK_W || escapePressed)
    dispose();
}

代码示例来源:origin: imagej/ImageJA

public void keyPressed(KeyEvent e) {
  int keyCode = e.getKeyCode(); 
  ij.IJ.setKeyDown(keyCode);
  escapePressed = keyCode==KeyEvent.VK_ESCAPE;
  if (keyCode==KeyEvent.VK_C) {
    if (editorPane.getSelectedText()==null || editorPane.getSelectedText().length()==0)
      editorPane.selectAll();
    editorPane.copy();
    editorPane.select(0,0);
  } else if (keyCode==KeyEvent.VK_ENTER || keyCode==KeyEvent.VK_W || escapePressed)
    dispose();
}

相关文章

JEditorPane类方法