javax.swing.JCheckBox.getBounds()方法的使用及代码示例

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

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

JCheckBox.getBounds介绍

暂无

代码示例

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

@Override
public void doLayout() {
  Dimension d_check = check == null ? new Dimension(0, 0) : check.getPreferredSize();
  Dimension d_label = stringDisplayer == null ? new Dimension (0,0) : stringDisplayer.getPreferredSize();
  int y_check = 0;
  if (d_check.height < d_label.height) {
    y_check = (d_label.height - d_check.height) / 2;
  }
  
  if (check != null) {
    check.setLocation(0, y_check);
    check.setBounds(0, y_check, d_check.width, d_check.height);
    if (checkBounds == null)
      checkBounds = check.getBounds();
  }
}

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

@Override
public void doLayout() {
  Dimension dCheck = check.getPreferredSize();
  Dimension dLabel = stringDisplayer.getPreferredSize();
  int yCheck = 0;
  if (dCheck.height < dLabel.height) {
    yCheck = (dLabel.height - dCheck.height) / 2;
  }
  check.setLocation(0, yCheck);
  check.setBounds(0, yCheck, dCheck.width, dCheck.height);
  if (checkBounds == null) {
    checkBounds = check.getBounds();
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-nativeexecution-nb

@Override
  public void mouseClicked(MouseEvent event) {
    JList<AuthenticationCheckboxListItem> list = (JList<AuthenticationCheckboxListItem>) event.getSource();
    int index = list.locationToIndex(event.getPoint());
    if (index != -1) {
      Rectangle checkBounds = ((AuthentificationCheckboxListRenderer)list.getCellRenderer()).check.getBounds();
      if (event.getPoint().x <= checkBounds.width) {
        AuthenticationCheckboxListItem item = (AuthenticationCheckboxListItem) list.getModel().getElementAt(index);
        item.setSelected(!item.isSelected());
        list.repaint(list.getCellBounds(index, index));
      }
    }
  }
});

相关文章

JCheckBox类方法