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

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

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

JTextPane.addMouseListener介绍

暂无

代码示例

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

textPane.addMouseListener(new java.awt.event.MouseAdapter() {
 @Override
 public void mouseClicked(java.awt.event.MouseEvent evt) {

代码示例来源:origin: pentaho/mondrian

queryTextPane.setFont(new java.awt.Font("Courier New", 0, 12));
queryTextPane.setText("");
queryTextPane.addMouseListener(
  new MouseAdapter() {

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

consoleMessages.setFont(Theme.EDITOR_FONT);
consoleMessages.setEditable(false);
consoleMessages.addMouseListener(new MouseAdapter() {
  @Override
  public void mouseClicked(MouseEvent mouseEvent) {

代码示例来源:origin: ron190/jsql-injection

browser.addMouseListener(new MouseAdapter() {
  @Override
  public void mousePressed(MouseEvent evt) {

代码示例来源:origin: triplea-game/triplea

private void createComponents() {
 text = new JTextPane();
 text.setEditable(false);
 text.addMouseListener(new MouseListener() {
  @Override
  public void mouseReleased(final MouseEvent e) {
   final String markedText = text.getSelectedText();
   if (markedText == null || markedText.length() == 0) {
    nextMessage.requestFocusInWindow();
   }
  }
  @Override
  public void mousePressed(final MouseEvent e) {}
  @Override
  public void mouseExited(final MouseEvent e) {}
  @Override
  public void mouseEntered(final MouseEvent e) {}
  @Override
  public void mouseClicked(final MouseEvent e) {}
 });
 nextMessage = new JTextField(10);
 // when enter is pressed, send the message
 setStatus = new JButton(setStatusAction);
 setStatus.setFocusable(false);
 final Insets inset = new Insets(3, 3, 3, 3);
 send = new JButton(SwingAction.of("Send", e -> sendMessage()));
 send.setMargin(inset);
 send.setFocusable(false);
}

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

copyright.setText(getCopyrightText());
copyright.setCaretPosition(0); // so that text is not scrolled down
copyright.addMouseListener(new java.awt.event.MouseAdapter() {
  public void mouseClicked(java.awt.event.MouseEvent evt) {
    copyrightMouseClicked(evt);

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

this.textPane.setMinimumSize(new Dimension(200, 100));
this.textPane.addMouseListener(new MouseListener() {

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

this.textPane.setMinimumSize(new Dimension(200, 100));
this.textPane.addMouseListener(new MouseListener() {
 @Override
 public void mouseClicked(MouseEvent e) {

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

menu.add(new JMenuItem(PASTE)).addActionListener(this);
text.addMouseListener(this);

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

public static void linkify(JTextPane jTextPane) {
  final MouseAdapter mouseAdapter = new AttributeInserterMouseListener(jTextPane);
  // Adding mouse listner for actions
  jTextPane.addMouseListener(mouseAdapter);
  // settings for mouseover (changing cursor)
  jTextPane.addMouseMotionListener(mouseAdapter);
  // Those are the main called points from user's activities.
  setDocumentFilter(jTextPane);
  jTextPane.addPropertyChangeListener("document", new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      Object source = evt.getSource();
      if (source instanceof JTextPane) {
        setDocumentFilter((JTextPane) source);
      }
    }
  });
}

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

@Override
  public void run() {
    StyledDocument doc = pane.getStyledDocument();
    Style hlStyle = doc.addStyle("regularBlue-findtype", defStyle);     // NOI18N
    hlStyle.addAttribute(HyperlinkSupport.TYPE_ATTRIBUTE, new TypeLink());
    StyleConstants.setForeground(hlStyle, UIUtils.getLinkColor());
    StyleConstants.setUnderline(hlStyle, true);            
    List<Integer> l = Collections.emptyList();
    try {
      l = getHighlightOffsets(doc.getText(0, doc.getLength()));
    } catch (BadLocationException ex) {
      Support.LOG.log(Level.SEVERE, null, ex);
    }
    List<Highlight> highlights = new ArrayList<Highlight>(l.size());
    for (int i = 0; i < l.size(); i++) {
      highlights.add(new Highlight(l.get(i), l.get(++i)));
    }
    pane.putClientProperty(HIGHLIGHTS_PROPERTY, highlights);
    pane.removeMouseMotionListener(FindTypesSupport.this);
    pane.addMouseMotionListener(FindTypesSupport.this);
    pane.removeMouseListener(FindTypesSupport.this);
    pane.addMouseListener(FindTypesSupport.this);
  }
});

代码示例来源:origin: net.imagej/imagej-ui-swing

textPane.addMouseListener(new MouseAdapter() {
  @Override
  public void mouseClicked(MouseEvent event) {

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

p.setLayout(new BorderLayout());
textArea = new JTextPane();
textArea.addMouseListener(new MouseAdapter() {

代码示例来源:origin: mars-sim/mars-sim

public MarsTerminal() {	
//        System.out.println("w: " + getFrame().getWidth()); // w: 656      
//        System.out.println("h: " + getFrame().getHeight()); // h: 519        
    this.getFrame().setSize(1024, 600);
    configureMainMenu();

    JTextPane textPane = getTextPane();
    addAction("ctrl C", "Copy", () -> textPane.copy());
    addAction("ctrl V", "Paste", () -> textPane.paste());
    MouseListener popupListener = new PopupListener(popup);
    textPane.addMouseListener(popupListener);
  }

代码示例来源:origin: com.itextpdf/itext-rups

JTabbedPane editorPane = readerController.getEditorTabs();
JScrollPane cons = new JScrollPane(console.getTextArea());
console.getTextArea().addMouseListener(new ContextMenuMouseListener(ConsoleContextMenu.getPopupMenu(console.getTextArea()), console.getTextArea()));
editorPane.addTab("Console", null, cons, "Console window (System.out/System.err)");
editorPane.setSelectedComponent(cons);

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

_outputPanel.addMouseListener( ml );
_outputPanel.addMouseWheelListener( ml );

代码示例来源:origin: blurpy/kouchat

viewerTP.addMouseListener(urlML);
viewerTP.addMouseMotionListener(urlML);
final AbstractDocument doc = (AbstractDocument) viewerDoc;

代码示例来源:origin: blurpy/kouchat

chatTP.addMouseListener(urlML);
chatTP.addMouseMotionListener(urlML);

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

@Override
  public void run() {
    Style defStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
    final Style hlStyle = doc.addStyle("regularBlue-link", defStyle); // NOI18N
    hlStyle.addAttribute(LINK_ATTRIBUTE, link);
    StyleConstants.setForeground(hlStyle, UIUtils.getLinkColor());
    StyleConstants.setUnderline(hlStyle, true);
    for (int i=0; i<pos.length; i+=2) {
      int off = pos[i];
      int length = pos[i+1]-pos[i];
      doc.setCharacterAttributes(off, length, hlStyle, true);
    }
    pane.removeMouseListener(mouseListener);
    pane.addMouseListener(mouseListener);
  }
});

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

@Override
  public void run() {
    Style defStyle = StyleContext.getDefaultStyleContext()
             .getStyle(StyleContext.DEFAULT_STYLE);
    final Style hlStyle = doc.addStyle("regularBlue-url", defStyle);      //NOI18N
    hlStyle.addAttribute(HyperlinkSupport.URL_ATTRIBUTE, new UrlAction());
    StyleConstants.setForeground(hlStyle, UIUtils.getLinkColor());
    StyleConstants.setUnderline(hlStyle, true);
    for (int i = 0; i < boundaries.length; i+=2) {
      doc.setCharacterAttributes(boundaries[i], boundaries[i + 1] - boundaries[i], hlStyle, true);
    }
    pane.removeMouseListener(getUrlMouseListener());
    pane.addMouseListener(getUrlMouseListener());
  }
});

相关文章

JTextPane类方法