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

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

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

JCheckBox.setSize介绍

暂无

代码示例

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

public Test() {
  initComponents();
  JCheckBox x = new JCheckBox("ergcdf"); //create the component,
  x.setSize(100,30);                     //size the component 
  this.testPanel1.add(x);                //and then add it to the panel
  this.testPanel1.add(new JCheckBox("ergcdf1"));
  this.testPanel1.add(new JCheckBox("ergcdf2"));
  this.testPanel1.add(new JCheckBox("ergcdf3"));
  this.testPanel1.add(new JCheckBox("ergcdf4"));
  this.testPanel1.validate();
  this.validate();
}

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

JCheckBox Ketchup = new JCheckBox();
Ketchup.setText("Ketchup");
Ketchup.setSize(50,25);
contentPane.add(Ketchup);
Ketchup.setBounds(175, 100, 175,25);

JCheckBox Garlic = new JCheckBox();
Garlic.setText("Garlic");
Garlic.setSize(50,25);
contentPane.add(Garlic);
Garlic.setBounds(175, 120, 175,25);

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

private JCheckBox Ketchup;
private JCheckBox Garlic;

public ClassName() {
  Ketchup = new JCheckBox();
  Ketchup.setText("Ketchup");
  Ketchup.setSize(50,25);
  add(Ketchup);
  Ketchup.setBounds(175, 100, 175,25);

  Garlic = new JCheckBox();
  Garlic.setText("Garlic");
  Garlic.setSize(50,25);
  add(Garlic);
  Garlic.setBounds(175, 120, 175,25);
}

代码示例来源:origin: protegeproject/protege

public void layoutContainer(Container parent) {
    cb.setSize(cb.getPreferredSize());
    cb.setLocation(2, 2);
    parent.getInsets();
    list.setBounds(20, 0, parent.getWidth() - 20, parent.getHeight());
    ListModel listModel = list.getModel();
    for (int i = 0; i < listModel.getSize(); i++) {
      JCheckBox cb = item2CheckBoxMap.get(listModel.getElementAt(i));
      if (cb != null) {
        Rectangle bounds = list.getCellBounds(i, i);
        cb.setBounds(0, bounds.y, bounds.height + 20, bounds.height);
      }
    }
  }
}

代码示例来源:origin: org.protege/protege-editor-core-application

public void layoutContainer(Container parent) {
    cb.setSize(cb.getPreferredSize());
    cb.setLocation(2, 2);
    parent.getInsets();
    list.setBounds(20, 0, parent.getWidth() - 20, parent.getHeight());
    ListModel listModel = list.getModel();
    for (int i = 0; i < listModel.getSize(); i++) {
      JCheckBox cb = item2CheckBoxMap.get(listModel.getElementAt(i));
      if (cb != null) {
        Rectangle bounds = list.getCellBounds(i, i);
        cb.setBounds(0, bounds.y, bounds.height + 20, bounds.height);
      }
    }
  }
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application

public void layoutContainer(Container parent) {
    cb.setSize(cb.getPreferredSize());
    cb.setLocation(2, 2);
    parent.getInsets();
    list.setBounds(20, 0, parent.getWidth() - 20, parent.getHeight());
    ListModel listModel = list.getModel();
    for (int i = 0; i < listModel.getSize(); i++) {
      JCheckBox cb = item2CheckBoxMap.get(listModel.getElementAt(i));
      if (cb != null) {
        Rectangle bounds = list.getCellBounds(i, i);
        cb.setBounds(0, bounds.y, bounds.height + 20, bounds.height);
      }
    }
  }
}

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

@Override
public void paintValue(Graphics g, Rectangle box) {
  checkBox.setForeground(g.getColor());
  checkBox.setFont(g.getFont());
  g.translate(box.x, box.y);
  StateCA state = (StateCA) getValue();
  checkBox.setText(state.toString());
  checkBox.setEnabled(false);
  switch (state) {
    case ParsedSource:
    case ExtraParsedSource:
    case IncludedHeader:
    case ParsedOrphanHeader:
      checkBox.setSelected(true);
      break;
    case ExcludedHeader:
    case ExcludedSource:
    case NotYetParsed:
      checkBox.setSelected(false);
      break;
    default:
      assert false : "unexpected " + state;
  }
  checkBox.setSize(box.width, box.height);
  checkBox.paint(g);
  g.translate(-box.x, -box.y);
}

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

protected void validateTree() {
  checkBox.setLocation(0, 0);
  checkBox.setSize(checkBox.getPreferredSize());
  int x = 0;
  Border cbBorder = UIManager.getBorder("CheckBox.border");

相关文章

JCheckBox类方法