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

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

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

JTextPane.addKeyListener介绍

暂无

代码示例

代码示例来源:origin: zzz40500/GsonFormat

editTP.addKeyListener(new KeyAdapter() {
  @Override
  public void keyReleased(KeyEvent keyEvent) {

代码示例来源:origin: RaiMan/SikuliX2

jsp.setPreferredSize(new Dimension(fWidth, fHeight));
jtp.addKeyListener(new KeyAdapter() {
 @Override
 public void keyTyped(KeyEvent e) {

代码示例来源:origin: RPTools/maptool

/**
   * If the GM enforces typing notification and no listener is present (because the client had notification off), a
   * new listener is added to the command text area
   */
  private void maybeAddTypingListener() {
    if (commandTextArea.getListeners(ChatTypingListener.class).length == 0) {
      commandTextArea.addKeyListener(new ChatTypingListener());
    }
  }
}

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

public void bindToPreferences(JTextPane component, String key, String defaultValue) {
  component.setText(getString(key, defaultValue));
  setString(key, component.getText());
  JTextPaneBindingAction action = new JTextPaneBindingAction(component, key);
  bindings.put(key, action);
  component.addKeyListener(action);
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public void pipeInput()
{
 EventQueue.invokeLater( () -> {
  try
  {
   _oldIn = System.in;
   PipedInputStream sysIn = new PipedInputStream();
   Process process = _processRunner.getProcess();
   if( process == null )
   {
    // Assume we are in-process
    _inWriter = new OutputStreamWriter( new PipedOutputStream( sysIn ) );
    System.setIn( sysIn );
   }
   else
   {
    _inWriter = new OutputStreamWriter( process.getOutputStream() );
   }
  }
  catch( IOException e )
  {
   throw new RuntimeException( e );
  }
  JTextPane outputPanel = _consolePanel.getOutputPanel();
  outputPanel.setEditable( true );
  _sysInListener = new SysInListener();
  outputPanel.addKeyListener( _sysInListener );
 } );
}

代码示例来源:origin: edu.utah.bmi.nlp/nlp-core

this.textPane.addKeyListener(new KeyListener() {

代码示例来源:origin: RPTools/maptool

public void itemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {
      if (ours != null)
        commandTextArea.removeKeyListener(ours);
      ours = null;
      // Go ahead and turn off the chat panel right away.
      MapTool.getFrame().getChatTypingPanel().setVisible(false);
    } else if (e.getStateChange() == ItemEvent.DESELECTED) {
      if (ours == null)
        ours = new ChatTypingListener();
      commandTextArea.addKeyListener(ours);
    }
  }
});

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

this.textPane.addKeyListener(new KeyListener() {
 @Override
 public void keyTyped(KeyEvent e) {

代码示例来源:origin: jdmp/java-data-mining-package

public CommandWindow(Module m) {
  this.module = m;
  textField = new JTextPane() {
    public boolean getScrollableTracksViewportWidth() {
      return false;
    }
    public void setSize(Dimension d) {
      if (d.width < getParent().getSize().width) {
        d.width = getParent().getSize().width;
      }
      super.setSize(d);
    }
  };
  doc = textField.getDocument();
  textField.setFont(new Font("Monospaced", Font.PLAIN, 13));
  textField.addKeyListener(this);
  appendText(">> ");
  endPos = doc.getLength();
  setBorder(BorderFactory.createTitledBorder("Command Window"));
  setLayout(new BorderLayout());
  JScrollPane scrollPane = new JScrollPane(textField);
  add(scrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: CallForSanity/Gaalop

textPane.addKeyListener(new SetChangedStateListener());

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

public class AddWordWindow extends JFrame{

public AddWordWindow(){
  getContentPane().setLayout(null);

  JTextPane wordText = new JTextPane();
  wordText.setBounds(10, 21, 82, 20);
  getContentPane().add(wordText);

  JTextArea descriptionText = new JTextArea();
  descriptionText.setBounds(10, 66, 143, 57);
  getContentPane().add(descriptionText);
  descriptionText.setEnabled(false);

  wordText.addKeyListener(new KeyAdapter() {

    @Override
    public void keyTyped(KeyEvent e) {              
      if(wordText.getText().length()>2){
        descriptionText.setEnabled(true);                   
      }
    }           
  });
}

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

text.setFont( font );
text.setMargin( new Insets(7,5,7,5) );
text.addKeyListener(this);
setViewportView(text);

代码示例来源:origin: RPTools/maptool

commandTextArea.setPreferredSize(new Dimension(50, 40)); // XXX should be resizable
commandTextArea.setFont(new Font("sans-serif", 0, AppPreferences.getFontSize()));
commandTextArea.addKeyListener(new ChatTypingListener());
SwingUtil.useAntiAliasing(commandTextArea);

代码示例来源:origin: T145/JTerm

public Terminal() {
  TextColor.initGui();
  JTerm.IS_WIN = false;
  JTerm.IS_UNIX = true;
  setContentPane(contentPane);
  // call onCancel() when cross is clicked
  setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
  addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
      onCancel();
    }
  });
  // call onCancel() on ESCAPE
  contentPane.registerKeyboardAction(e -> onCancel(),
      KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
      JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
  textPane.setBackground(new Color(28, 28, 28));
  textPane.setEditable(true);
  textPane.addKeyListener(this);
}

代码示例来源:origin: igniterealtime/Spark

pane.addKeyListener(new KeyAdapter() {
  public void keyReleased(KeyEvent e) {
    if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {

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

txtTargetQuery.addKeyListener(new TABKeyListener());
txtSourceQuery.addKeyListener(new TABKeyListener());
tblQueryResult.setFocusable(false);
txtTargetQuery.addKeyListener(new CTRLEnterKeyListener());
txtSourceQuery.addKeyListener(new CTRLEnterKeyListener());
txtMappingID.addKeyListener(new CTRLEnterKeyListener());

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

textArea.addKeyListener(new KeyListener() {
  @Override
  public void keyTyped(KeyEvent ke) {

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

consolePane.addKeyListener(this);
consolePane.addCaretListener(this);

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

/** 
 * Creates new form QueryInterfacePanel
 */
public QueryInterfacePanel(OBDAModel apic, QueryController qc) {
  this.qc = qc;
  this.apic = apic;
  
  initComponents();
  StyleContext style = new StyleContext();
  styledDocument = new DefaultStyledDocument(style);
  queryTextPane.setDocument(styledDocument);
  queryTextPane.setBackground(Color.WHITE);
  queryTextPane.setCaretColor(Color.BLACK);
  queryTextPane.addKeyListener(new CTRLEnterKeyListener());
}

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

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

相关文章

JTextPane类方法