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

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

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

JCheckBox.setBounds介绍

暂无

代码示例

代码示例来源:origin: org.mobicents.protocols.ss7.tools.simulator/simulator-gui

private JCheckBox createCheckbox(JPanel section,String name, int y_pos) {
  JCheckBox checkBox = new JCheckBox(name);
  checkBox.setBounds(10, y_pos, 450, 20);
  section.add(checkBox);
  return checkBox;
}

代码示例来源:origin: org.mobicents.protocols.ss7.tools.simulator/simulator-gui

private JCheckBox createCheckbox(JPanel section,String name, int y_pos) {
  JCheckBox checkBox = new JCheckBox(name);
  checkBox.setBounds(10, y_pos, 450, 20);
  section.add(checkBox);
  return checkBox;
}

代码示例来源:origin: org.restcomm.protocols.ss7.tools.simulator/simulator-gui

private JCheckBox createCheckbox(JPanel section,String name, int y_pos) {
  JCheckBox checkBox = new JCheckBox(name);
  checkBox.setBounds(10, y_pos, 450, 20);
  section.add(checkBox);
  return checkBox;
}

代码示例来源:origin: org.restcomm.protocols.ss7.tools.simulator/simulator-gui

private JCheckBox createCheckbox(JPanel section, String name, int y_pos) {
  JCheckBox checkBox = new JCheckBox(name);
  checkBox.setBounds(10, y_pos, 450, 20);
  section.add(checkBox);
  return checkBox;
}

代码示例来源: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 void initialize() {
  frame = new JFrame();
  frame.setBounds(100, 100, 450, 300);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.getContentPane().setLayout(null);

  JPanel panel = new JPanel();
  panel.setBounds(0, 0, 434, 261);
  frame.getContentPane().add(panel);
  panel.setLayout(null);

  JCheckBox chckbxCheckbox = new JCheckBox("checkbox");
  chckbxCheckbox.setBounds(44, 41, 97, 23);
  panel.add(chckbxCheckbox);

  JCheckBox chckbxCheckbox_1 = new JCheckBox("checkbox 2");
  chckbxCheckbox_1.setBounds(197, 41, 97, 23);
  panel.add(chckbxCheckbox_1);
}

代码示例来源: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: dkpro/dkpro-jwpl

private void createOutputSettings()
{
  enableZipEncodingCheckBox = new JCheckBox("Activate Zip Encoding");
  enableZipEncodingCheckBox.setBounds(10, 160, 200, 25);
  enableZipEncodingCheckBox.addActionListener(new ActionListener()
  {
    @Override
    public void actionPerformed(final ActionEvent e)
    {
      boolean flag = !controller.isZipCompressionEnabled();
      controller.setEnableZipCompression(flag);
      validateSettings();
    }
  });
  this.add(enableZipEncodingCheckBox);
}

代码示例来源:origin: dkpro/dkpro-jwpl

private void createStatsOutputSettings()
{
  statsOutputCheckBox = new JCheckBox(
      "Activate Article Information Output");
  statsOutputCheckBox.setBounds(10, 80, 250, 25);
  statsOutputCheckBox.addActionListener(new ActionListener()
  {
    @Override
    public void actionPerformed(final ActionEvent e)
    {
      boolean flag = !controller.isStatsOutputEnabled();
      controller.setEnableStatsOutput(flag);
    }
  });
  this.add(statsOutputCheckBox);
}

代码示例来源:origin: net.sf.sfac/sfac-core

protected void layoutExtraComponents(Container cont) {
  Dimension dim = checkBox.getPreferredSize();
  int posX = x + CONTROL_BUTTON_SPACE;
  int posY = y + ((getUpdatedInsets(cont).top - dim.height) / 2);
  checkBox.setBounds(posX, posY, dim.width, dim.height);
}

代码示例来源: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 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: 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.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: 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.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: Jamling/SmartIM

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

代码示例来源:origin: org.n52.wps/52n-wps-install-wizard

public void doLayout() {
 Dimension d_check = check.getPreferredSize();
 Dimension d_label = label.getPreferredSize();
 int y_check = 0;
 int y_label = 0;
 if (d_check.height < d_label.height) {
  y_check = (d_label.height - d_check.height)/2;
 } else {
  y_label = (d_check.height - d_label.height)/2;
 }
 check.setLocation(0,y_check);
 check.setBounds(0,y_check,d_check.width,d_check.height);
 label.setLocation(d_check.width,y_label);    
 label.setBounds(d_check.width,y_label,d_label.width,d_label.height);    
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

public void doLayout() {
  Dimension dCheck = checkBox.getPreferredSize();
  Dimension dLabel = treeLabel.getPreferredSize();
  int yCheck = 0;
  int yLabel = 0;
  if (dCheck.height < dLabel.height) {
    yCheck = (dLabel.height - dCheck.height) / 2;
  } else {
    yLabel = (dCheck.height - dLabel.height) / 2;
  }
  checkBox.setLocation(0, yCheck);
  checkBox.setBounds(0, yCheck, dCheck.width, dCheck.height);
  treeLabel.setLocation(dCheck.width, yLabel);
  treeLabel.setBounds(dCheck.width, yLabel, dLabel.width, dLabel.height);
}

代码示例来源:origin: igniterealtime/Spark

public void doLayout() {
  Dimension d_check = check.getPreferredSize();
  Dimension d_label = label.getPreferredSize();
  int y_check = 0;
  int y_label = 0;
  if (d_check.height < d_label.height) {
    y_check = (d_label.height - d_check.height) / 2;
  }
  else {
    y_label = (d_check.height - d_label.height) / 2;
  }
  check.setLocation(0, y_check);
  check.setBounds(0, y_check, d_check.width, d_check.height);
  label.setLocation(d_check.width, y_label);
  label.setBounds(d_check.width, y_label, d_label.width, d_label.height);
}

相关文章

JCheckBox类方法