javax.swing.JLabel.contains()方法的使用及代码示例

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

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

JLabel.contains介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.jtstand/jtstand-ui

private void maybeShowPopup(MouseEvent e) {
  if (e.isPopupTrigger() && jLabel.isEnabled()) {
    Point p = new Point(e.getX(), e.getY());
    if (jLabel.contains(p)) {
      /* create popup menu... */
      JPopupMenu contextMenu = createLoginContextMenu(jLabel);
      /* ... and show it */
      if (contextMenu != null && contextMenu.getComponentCount() > 0) {
        contextMenu.show(jLabel, p.x, p.y);
      }
    }
  }
}

代码示例来源:origin: com.samskivert/samskivert

public void mouseReleased (MouseEvent e)
{
  // if the mouse was released within the bounds of the button, go
  // ahead and select it properly
  if (_selectedButton != null) {
    if (_selectedButton.contains(e.getX(), e.getY())) {
      // tell the model that the selection has changed (and
      // we'll respond and do our business
      Object elem = _selectedButton.getClientProperty("element");
      _model.setSelectedItem(elem);
    } else {
      _selectedButton.setBorder(DESELECTED_BORDER);
      _selectedButton.repaint();
    }
    // clear out the selected button indicator
    _selectedButton = null;
  }
}

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

b.repaint();
if (b.contains(e.getPoint()))

相关文章

微信公众号

最新文章

更多

JLabel类方法