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

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

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

JCheckBox.getSize介绍

暂无

代码示例

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

@Override
public void paintComponent(Graphics g) {
  Dimension dCheck = check.getSize();
  Dimension dLabel = stringDisplayer.getPreferredSize();
  int yLabel = 0;
  if (dCheck.height >= dLabel.height) {
    yLabel = (dCheck.height - dLabel.height) / 2;
  }
  check.setBounds(0, 0, dCheck.width, dCheck.height);
  check.paint(g);
  int y = yLabel - 2;
  stringDisplayer.setBounds(dCheck.width, y, dLabel.width, getHeight() - 1);
  g.translate(dCheck.width, yLabel);
  stringDisplayer.paint(g);
  g.translate(-dCheck.width, -yLabel);
}

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

@Override
public void paintComponent (Graphics g) {
  Dimension d_check = check == null ? new Dimension(0, 0) : check.getSize();
  Dimension d_label = stringDisplayer == null ? new Dimension(0,0) : 
    stringDisplayer.getPreferredSize();
  int y_check = 0;
  int y_label = 0;
  if (d_check.height >= d_label.height) {
    y_label = (d_check.height - d_label.height) / 2;
  }
  if (check != null) {
    check.setBounds (0, 0, d_check.width, d_check.height);
    check.paint(g);
  }
  if (stringDisplayer != null) {
    int y = y_label-2;
    stringDisplayer.setBounds (d_check.width, y, 
      d_label.width, getHeight()-1);
    g.translate (d_check.width, y_label);
    stringDisplayer.paint(g);
    g.translate (-d_check.width, -y_label);
  }
}

相关文章

JCheckBox类方法