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

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

本文整理了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

  1. @Override
  2. public void doLayout() {
  3. Dimension d_check = check == null ? new Dimension(0, 0) : check.getPreferredSize();
  4. Dimension d_label = stringDisplayer == null ? new Dimension (0,0) : stringDisplayer.getPreferredSize();
  5. int y_check = 0;
  6. if (d_check.height < d_label.height) {
  7. y_check = (d_label.height - d_check.height) / 2;
  8. }
  9. if (check != null) {
  10. check.setLocation(0, y_check);
  11. check.setBounds(0, y_check, d_check.width, d_check.height);
  12. if (checkBounds == null)
  13. checkBounds = check.getBounds();
  14. }
  15. }

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

  1. @Override
  2. public void doLayout() {
  3. Dimension dCheck = check.getPreferredSize();
  4. Dimension dLabel = stringDisplayer.getPreferredSize();
  5. int yCheck = 0;
  6. if (dCheck.height < dLabel.height) {
  7. yCheck = (dLabel.height - dCheck.height) / 2;
  8. }
  9. check.setLocation(0, yCheck);
  10. check.setBounds(0, yCheck, dCheck.width, dCheck.height);
  11. if (checkBounds == null) {
  12. checkBounds = check.getBounds();
  13. }
  14. }

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

  1. @Override
  2. public void mouseClicked(MouseEvent event) {
  3. JList<AuthenticationCheckboxListItem> list = (JList<AuthenticationCheckboxListItem>) event.getSource();
  4. int index = list.locationToIndex(event.getPoint());
  5. if (index != -1) {
  6. Rectangle checkBounds = ((AuthentificationCheckboxListRenderer)list.getCellRenderer()).check.getBounds();
  7. if (event.getPoint().x <= checkBounds.width) {
  8. AuthenticationCheckboxListItem item = (AuthenticationCheckboxListItem) list.getModel().getElementAt(index);
  9. item.setSelected(!item.isSelected());
  10. list.repaint(list.getCellBounds(index, index));
  11. }
  12. }
  13. }
  14. });

相关文章

JCheckBox类方法