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

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

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

JEditorPane.addKeyListener介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

private void buildContentPanel() {
 editorPane = new JEditorPane ();
 editorPane.setContentType("text/rtf");
 editorPane.addKeyListener(new InputListener());
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 StyleConstants.setFontFamily(defaultAttrSet, "Lucida Sans");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 try {
  doc.insertString(0, initText, defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 JScrollPane scrollPane = new JScrollPane(editorPane);
 frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
 editorPane.setEditable(true);
}

代码示例来源:origin: stanfordnlp/CoreNLP

private void buildContentPanel() {
 editorPane = new JEditorPane ();
 editorPane.setContentType("text/rtf");
 editorPane.addKeyListener(new InputListener());
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 try {
  doc.insertString(0, initText, defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 JScrollPane scrollPane = new JScrollPane(editorPane);
 frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
 editorPane.setEditable(true);
}

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

textArea.addKeyListener(ka);

代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce

@Override
public void install(JEditorPane editor) {
  super.install(editor);
  editor.addKeyListener(this);
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

private JComponent createLicense() {

  final URL licenseURL = ClassLoader.getSystemClassLoader().getResource(
  "LICENSE/gpl-license.txt");
  // The license editor pane
  JEditorPane license;
  try {
    license = new JEditorPane(licenseURL);
  } catch (final IOException e) {
    license = new JEditorPane();
    license.setText("GPL Licence file cannot be found!");
  }
  license.setEditable(false);
  license.addKeyListener(this);
  final JScrollPane lcsScrollPane = new JScrollPane(license);
  lcsScrollPane.setVerticalScrollBarPolicy(20);
  lcsScrollPane.setHorizontalScrollBarPolicy(30);
  return lcsScrollPane;
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

private JComponent createAcknowledgements() {
  final URL acknowledgementsURL = ClassLoader.getSystemClassLoader()
  .getResource("LICENSE/ACKNOWLEDGEMENTS.txt");
  // The acknoledgement editor pane
  JEditorPane acknowledgements;
  try {
    acknowledgements = new JEditorPane(acknowledgementsURL);
  } catch (final IOException e) {
    acknowledgements = new JEditorPane();
    acknowledgements.setText("Acknoledgements file cannot be found");
  }
  acknowledgements.setEditable(false);
  acknowledgements.addKeyListener(this);
  
  final JScrollPane ackScrollPane = new JScrollPane(acknowledgements);
  ackScrollPane.setVerticalScrollBarPolicy(20);
  ackScrollPane.setHorizontalScrollBarPolicy(30);
  return ackScrollPane;
}

代码示例来源:origin: com.googlecode.jannocessor/jannocessor-ui

private JComponent createOutput(String title, String content) {
  editor = new JEditorPane();
  JScrollPane scroll = new JScrollPane(editor, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
      JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scroll.setMinimumSize(new Dimension(100, 100));
  editor.setContentType("text/java_output");
  editor.setEditable(false);
  editor.setText(content);
  editor.addKeyListener(keyListener);
  JLabel header = new JLabel(title);
  Box box = Box.createVerticalBox();
  box.add(header);
  box.add(scroll);
  return box;
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

about.addKeyListener(this);

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

private JComponent createCode() {
  final JLabel codeLabel = new JLabel(ImageCreator.IMG_OWASP);
  codeLabel.setLocation(20, 45);
  codeLabel.setSize(100, 100);
  final URL codeURL = ClassLoader.getSystemClassLoader()
  .getResource("LICENSE/CODE.txt");
  JEditorPane code; 
  try {
    code = new JEditorPane(codeURL);
    
  } catch (final IOException eAbout) {
    code = new JEditorPane();
    code.setText("Code information cannot be found!");
  }
  code.setEditable(false);
  code.addKeyListener(this);
  
  final JScrollPane codeScroll = new JScrollPane(code);
  codeScroll.setVerticalScrollBarPolicy(20);
  codeScroll.setHorizontalScrollBarPolicy(30);
  codeScroll.setLocation(140, 5);
  codeScroll.setSize(290, 185);
  
  final JPanel codePanel = new JPanel();
  codePanel.setLayout(null);
  codePanel.add(codeLabel);
  codePanel.add(codeScroll);
  return codePanel;
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

disclaimer.addKeyListener(this);

代码示例来源:origin: org.codehaus.sonar.sslr/sslr-devkit

codeEditor.addKeyListener(new KeyAdapter() {
 @Override
 public void keyTyped(KeyEvent event) {

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

panel.editorPane.addKeyListener(new KeyAdapter() {
  @Override
  public void keyPressed(KeyEvent e) {

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

panel.editorPane.addKeyListener(new KeyAdapter() {
  @Override
  public void keyPressed(KeyEvent e) {

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

panel.editorPane.addKeyListener(new KeyAdapter() {
  @Override
  public void keyPressed(KeyEvent e) {

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

button.addActionListener(this);
button.addKeyListener(this);
editorPane.addKeyListener(this);
editorPane.addHyperlinkListener(this);
JPanel panel = new JPanel();

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

public @Override void install (JEditorPane c) {
  super.install (c);
  HyperlinkListener hl = new HyperlinkListener ();
  c.addMouseMotionListener (hl);
  c.addMouseListener (hl);
  c.addKeyListener(hl);
  c.addCaretListener (new MarkOccurrencesSupport (c));
}

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

button.addActionListener(this);
button.addKeyListener(this);
editorPane.addKeyListener(this);
editorPane.addHyperlinkListener(this);
JPanel panel = new JPanel();

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

textArea.addKeyListener(ka);

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

textArea.addKeyListener(ka);

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

viewer.setFont(new Font("Monospaced",Font.PLAIN,12));
viewer.addPropertyChangeListener(new PropertyChangeHandler());
viewer.addKeyListener(new KeyHandler());

相关文章

JEditorPane类方法