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

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

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

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

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

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

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

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

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

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

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

  1. JCheckBox Ketchup = new JCheckBox();
  2. Ketchup.setText("Ketchup");
  3. Ketchup.setSize(50,25);
  4. contentPane.add(Ketchup);
  5. Ketchup.setBounds(175, 100, 175,25);
  6. JCheckBox Garlic = new JCheckBox();
  7. Garlic.setText("Garlic");
  8. Garlic.setSize(50,25);
  9. contentPane.add(Garlic);
  10. Garlic.setBounds(175, 120, 175,25);

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

  1. private void initialize() {
  2. frame = new JFrame();
  3. frame.setBounds(100, 100, 450, 300);
  4. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  5. frame.getContentPane().setLayout(null);
  6. JPanel panel = new JPanel();
  7. panel.setBounds(0, 0, 434, 261);
  8. frame.getContentPane().add(panel);
  9. panel.setLayout(null);
  10. JCheckBox chckbxCheckbox = new JCheckBox("checkbox");
  11. chckbxCheckbox.setBounds(44, 41, 97, 23);
  12. panel.add(chckbxCheckbox);
  13. JCheckBox chckbxCheckbox_1 = new JCheckBox("checkbox 2");
  14. chckbxCheckbox_1.setBounds(197, 41, 97, 23);
  15. panel.add(chckbxCheckbox_1);
  16. }

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

  1. private JCheckBox Ketchup;
  2. private JCheckBox Garlic;
  3. public ClassName() {
  4. Ketchup = new JCheckBox();
  5. Ketchup.setText("Ketchup");
  6. Ketchup.setSize(50,25);
  7. add(Ketchup);
  8. Ketchup.setBounds(175, 100, 175,25);
  9. Garlic = new JCheckBox();
  10. Garlic.setText("Garlic");
  11. Garlic.setSize(50,25);
  12. add(Garlic);
  13. Garlic.setBounds(175, 120, 175,25);
  14. }

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

  1. private void createOutputSettings()
  2. {
  3. enableZipEncodingCheckBox = new JCheckBox("Activate Zip Encoding");
  4. enableZipEncodingCheckBox.setBounds(10, 160, 200, 25);
  5. enableZipEncodingCheckBox.addActionListener(new ActionListener()
  6. {
  7. @Override
  8. public void actionPerformed(final ActionEvent e)
  9. {
  10. boolean flag = !controller.isZipCompressionEnabled();
  11. controller.setEnableZipCompression(flag);
  12. validateSettings();
  13. }
  14. });
  15. this.add(enableZipEncodingCheckBox);
  16. }

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

  1. private void createStatsOutputSettings()
  2. {
  3. statsOutputCheckBox = new JCheckBox(
  4. "Activate Article Information Output");
  5. statsOutputCheckBox.setBounds(10, 80, 250, 25);
  6. statsOutputCheckBox.addActionListener(new ActionListener()
  7. {
  8. @Override
  9. public void actionPerformed(final ActionEvent e)
  10. {
  11. boolean flag = !controller.isStatsOutputEnabled();
  12. controller.setEnableStatsOutput(flag);
  13. }
  14. });
  15. this.add(statsOutputCheckBox);
  16. }

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

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

代码示例来源: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 paintComponent(Graphics g) {
  3. Dimension dCheck = check.getSize();
  4. Dimension dLabel = stringDisplayer.getPreferredSize();
  5. int yLabel = 0;
  6. if (dCheck.height >= dLabel.height) {
  7. yLabel = (dCheck.height - dLabel.height) / 2;
  8. }
  9. check.setBounds(0, 0, dCheck.width, dCheck.height);
  10. check.paint(g);
  11. int y = yLabel - 2;
  12. stringDisplayer.setBounds(dCheck.width, y, dLabel.width, getHeight() - 1);
  13. g.translate(dCheck.width, yLabel);
  14. stringDisplayer.paint(g);
  15. g.translate(-dCheck.width, -yLabel);
  16. }

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

  1. public void layoutContainer(Container parent) {
  2. cb.setSize(cb.getPreferredSize());
  3. cb.setLocation(2, 2);
  4. parent.getInsets();
  5. list.setBounds(20, 0, parent.getWidth() - 20, parent.getHeight());
  6. ListModel listModel = list.getModel();
  7. for (int i = 0; i < listModel.getSize(); i++) {
  8. JCheckBox cb = item2CheckBoxMap.get(listModel.getElementAt(i));
  9. if (cb != null) {
  10. Rectangle bounds = list.getCellBounds(i, i);
  11. cb.setBounds(0, bounds.y, bounds.height + 20, bounds.height);
  12. }
  13. }
  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: edu.stanford.protege/org.protege.editor.core.application

  1. public void layoutContainer(Container parent) {
  2. cb.setSize(cb.getPreferredSize());
  3. cb.setLocation(2, 2);
  4. parent.getInsets();
  5. list.setBounds(20, 0, parent.getWidth() - 20, parent.getHeight());
  6. ListModel listModel = list.getModel();
  7. for (int i = 0; i < listModel.getSize(); i++) {
  8. JCheckBox cb = item2CheckBoxMap.get(listModel.getElementAt(i));
  9. if (cb != null) {
  10. Rectangle bounds = list.getCellBounds(i, i);
  11. cb.setBounds(0, bounds.y, bounds.height + 20, bounds.height);
  12. }
  13. }
  14. }
  15. }

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

  1. public void layoutContainer(Container parent) {
  2. cb.setSize(cb.getPreferredSize());
  3. cb.setLocation(2, 2);
  4. parent.getInsets();
  5. list.setBounds(20, 0, parent.getWidth() - 20, parent.getHeight());
  6. ListModel listModel = list.getModel();
  7. for (int i = 0; i < listModel.getSize(); i++) {
  8. JCheckBox cb = item2CheckBoxMap.get(listModel.getElementAt(i));
  9. if (cb != null) {
  10. Rectangle bounds = list.getCellBounds(i, i);
  11. cb.setBounds(0, bounds.y, bounds.height + 20, bounds.height);
  12. }
  13. }
  14. }
  15. }

代码示例来源:origin: Jamling/SmartIM

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

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

  1. public void doLayout() {
  2. Dimension d_check = check.getPreferredSize();
  3. Dimension d_label = label.getPreferredSize();
  4. int y_check = 0;
  5. int y_label = 0;
  6. if (d_check.height < d_label.height) {
  7. y_check = (d_label.height - d_check.height)/2;
  8. } else {
  9. y_label = (d_check.height - d_label.height)/2;
  10. }
  11. check.setLocation(0,y_check);
  12. check.setBounds(0,y_check,d_check.width,d_check.height);
  13. label.setLocation(d_check.width,y_label);
  14. label.setBounds(d_check.width,y_label,d_label.width,d_label.height);
  15. }

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

  1. public void doLayout() {
  2. Dimension dCheck = checkBox.getPreferredSize();
  3. Dimension dLabel = treeLabel.getPreferredSize();
  4. int yCheck = 0;
  5. int yLabel = 0;
  6. if (dCheck.height < dLabel.height) {
  7. yCheck = (dLabel.height - dCheck.height) / 2;
  8. } else {
  9. yLabel = (dCheck.height - dLabel.height) / 2;
  10. }
  11. checkBox.setLocation(0, yCheck);
  12. checkBox.setBounds(0, yCheck, dCheck.width, dCheck.height);
  13. treeLabel.setLocation(dCheck.width, yLabel);
  14. treeLabel.setBounds(dCheck.width, yLabel, dLabel.width, dLabel.height);
  15. }

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

  1. public void doLayout() {
  2. Dimension d_check = check.getPreferredSize();
  3. Dimension d_label = label.getPreferredSize();
  4. int y_check = 0;
  5. int y_label = 0;
  6. if (d_check.height < d_label.height) {
  7. y_check = (d_label.height - d_check.height) / 2;
  8. }
  9. else {
  10. y_label = (d_check.height - d_label.height) / 2;
  11. }
  12. check.setLocation(0, y_check);
  13. check.setBounds(0, y_check, d_check.width, d_check.height);
  14. label.setLocation(d_check.width, y_label);
  15. label.setBounds(d_check.width, y_label, d_label.width, d_label.height);
  16. }

相关文章

JCheckBox类方法