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

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

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

JTextPane.requestFocus介绍

暂无

代码示例

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

public void actionPerformed(ActionEvent e) {
    if (generateClassTF.isFocusOwner()) {
      editTP.requestFocus(true);
    } else {
      onOK();
    }
  }
});

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

@Override
  public void keyReleased(KeyEvent keyEvent) {
    super.keyReleased(keyEvent);
    if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
      editTP.requestFocus(true);
    }
  }
});

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

@Override
public void requestFocus() {
  if (text != null) {
    text.requestFocus();
  }
}

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

@Override
  public void mousePressed(MouseEvent evt) {
    editor.requestFocus();
  }
});

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

@Override
public void requestFocus() {
  commandTextArea.requestFocus();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/ostermiller-syntax

public void windowActivated(WindowEvent e) {
    // focus magic
    textPane.requestFocus();
  }
});

代码示例来源:origin: net.sf.ingenias/ingeniasjgraphmod

/**
   * Transfers the focus to the editing component.
   */
  public boolean shouldSelectCell(EventObject event) {
    editorComponent.requestFocus();
    return super.shouldSelectCell(event);
  }
}

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

public void requestFocus()
{
  super.requestFocus();
  text.requestFocus();
}

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

public void showEditor() {
  setVisible(true);
  this.xmlPane.requestFocus();
}

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

@Override
public void requestFocus() {
  super.requestFocus();
  outbox.requestFocus();
}

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

private void sendLinkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendLinkButtonActionPerformed
    insertLink();
    outbox.requestFocus();
}//GEN-LAST:event_sendLinkButtonActionPerformed

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

public void actionPerformed(ActionEvent e) {
    try {
      out.getDocument().insertString(out.getCaretPosition(),outText, null);
      out.requestFocus();
    } catch (BadLocationException ex) {
      Exceptions.printStackTrace(ex);
    }
  }
}

代码示例来源: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: org.netbeans.modules/org-netbeans-modules-kenai-ui

public void actionPerformed(ActionEvent e) {
    String outText = "ISSUE:123";//NOI18N
    try {
      out.requestFocus();
      int caretPosition = out.getCaretPosition();
      out.getDocument().insertString( caretPosition, " " + outText + " ", null); // NOI18N
      out.setSelectionStart(caretPosition+7);
      out.setSelectionEnd(caretPosition+outText.length()+1);
    } catch (BadLocationException ex) {
      Exceptions.printStackTrace(ex);
    }
  }
}

代码示例来源:origin: Vhati/Slipstream-Mod-Manager

private void showMenu( MouseEvent e ) {
    AttributeSet tmpAttr = doc.getCharacterElement( textPane.viewToModel( e.getPoint() ) ).getAttributes();
    Object targetObj = tmpAttr.getAttribute( ATTR_HYPERLINK_TARGET );
    if ( targetObj != null ) {  // Link menu.
      textPane.requestFocus();
      lastClickedLinkTarget = targetObj.toString();
      int nx = e.getX();
      if ( nx > 500 ) nx = nx - linkPopup.getSize().width;
      linkPopup.show( e.getComponent(), nx, e.getY() - linkPopup.getSize().height );
      e.consume();
    }
  }
};

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

public void actionPerformed(ActionEvent e) {
    String outText = "FILE:foo/bar/Test.java:23"; // NOI18N
    try {
      out.requestFocus();
      int caretPosition = out.getCaretPosition();
      out.getDocument().insertString( caretPosition, " " + outText + " ", null); // NOI18N
      out.setSelectionStart(caretPosition+6);
      out.setSelectionEnd(caretPosition+outText.length()+1);
    } catch (BadLocationException ex) {
      Exceptions.printStackTrace(ex);
    }
  }
}

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

private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendButtonActionPerformed
  KeyEvent e = new KeyEvent((Component) evt.getSource(),evt.getID(), evt.getWhen(), evt.getModifiers(), KeyEvent.VK_ENTER, '\n');
  keyTyped(e);
  outbox.requestFocus();
}//GEN-LAST:event_sendButtonActionPerformed

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

private void setEditing(boolean editing) {
  if (editing) {
    btnEditPreview.setEnabled(textCode.getDocument().getLength() != 0);
    btnEditPreview.setIcon(ICON_PREVIEW);
    btnEditPreview.setToolTipText(NbBundle.getMessage(WikiEditPanel.class, "TOOL_Preview"));
    textCode.setVisible(true);
    scrollCode.setVisible(true);
    textPreview.setVisible(false);
    scrollPreview.setVisible(false);
    textCode.requestFocus();
  } else {
    btnEditPreview.setEnabled(true);
    btnEditPreview.setIcon(ICON_EDIT);
    btnEditPreview.setToolTipText(NbBundle.getMessage(WikiEditPanel.class, "TOOL_Edit"));
    textPreview.setVisible(true);
    scrollPreview.setVisible(true);
    textCode.setVisible(false);
    scrollCode.setVisible(false);
    if (this.editing != editing) {
      setWikiFormatText(textCode.getText());
    }
  }
  this.editing = editing;
  this.revalidate();
  this.repaint();
}

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

/**
 * Method for toggling source window visibility
 */
private void toggleSourceWindow() {
 if (!(isSourceWindowActive())) {
  jtpSource.setText(jtpMain.getText());
  jspltDisplay.setRightComponent(jspSource);
  if (exclusiveEdit) {
   jspltDisplay.setDividerLocation(0);
   jspltDisplay.setEnabled(false);
   jtpSource.requestFocus();
  } else {
   jspltDisplay.setDividerLocation(iSplitPos);
   jspltDisplay.setEnabled(true);
  }
 } else {
  jtpMain.setText(jtpSource.getText());
  iSplitPos = jspltDisplay.getDividerLocation();
  jspltDisplay.remove(jspSource);
  jtpMain.requestFocus();
 }
 this.validate();
 jcbmiViewSource.setSelected(isSourceWindowActive());
 jtbtnViewSource.setSelected(isSourceWindowActive());
}

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

parentTextPane.requestFocus();

相关文章

JTextPane类方法