java.awt.GridBagLayout.getConstraints()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(123)

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

GridBagLayout.getConstraints介绍

[英]Gets the constraints for the specified component. A copy of the actual GridBagConstraints object is returned.
[中]获取指定组件的约束。返回实际GridBagConstraints对象的副本。

代码示例

代码示例来源:origin: libgdx/libgdx

public void setEmbedded () {
  GridBagLayout layout = (GridBagLayout)getLayout();
  GridBagConstraints constraints = layout.getConstraints(contentPanel);
  constraints.insets = new Insets(0, 0, 0, 0);
  layout.setConstraints(contentPanel, constraints);
  titlePanel.setVisible(false);
}

代码示例来源:origin: libgdx/libgdx

public void setEmbedded () {
  GridBagLayout layout = (GridBagLayout)getLayout();
  GridBagConstraints constraints = layout.getConstraints(contentPanel);
  constraints.insets = new Insets(0, 0, 0, 0);
  layout.setConstraints(contentPanel, constraints);
  titlePanel.setVisible(false);
}

代码示例来源:origin: libgdx/libgdx

public void setEmbedded () {
  GridBagLayout layout = (GridBagLayout)getLayout();
  GridBagConstraints constraints = layout.getConstraints(contentPanel);
  constraints.insets = new Insets(0, 0, 0, 0);
  layout.setConstraints(contentPanel, constraints);
  titlePanel.setVisible(false);
}

代码示例来源:origin: libgdx/libgdx

public void setEmbedded () {
  GridBagLayout layout = (GridBagLayout)getLayout();
  GridBagConstraints constraints = layout.getConstraints(contentPanel);
  constraints.insets = new Insets(0, 0, 0, 0);
  layout.setConstraints(contentPanel, constraints);
  titlePanel.setVisible(false);
}

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    boolean visible = !lowMaxSlider.isVisible();
    lowMaxSlider.setVisible(visible);
    lowRangeButton.setText(visible ? "<" : ">");
    GridBagLayout layout = (GridBagLayout)formPanel.getLayout();
    GridBagConstraints constraints = layout.getConstraints(lowRangeButton);
    constraints.gridx = visible ? 5 : 4;
    layout.setConstraints(lowRangeButton, constraints);
    Slider slider = visible ? lowMaxSlider : lowMinSlider;
    ScaledNumericPanel.this.value.setLowMax(slider.getValue());
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    boolean visible = !highMaxSlider.isVisible();
    highMaxSlider.setVisible(visible);
    highRangeButton.setText(visible ? "<" : ">");
    GridBagLayout layout = (GridBagLayout)formPanel.getLayout();
    GridBagConstraints constraints = layout.getConstraints(highRangeButton);
    constraints.gridx = visible ? 5 : 4;
    layout.setConstraints(highRangeButton, constraints);
    Slider slider = visible ? highMaxSlider : highMinSlider;
    value.setHighMax((Float)slider.getValue());
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    boolean visible = !highMaxSlider.isVisible();
    highMaxSlider.setVisible(visible);
    highRangeButton.setText(visible ? "<" : ">");
    GridBagLayout layout = (GridBagLayout)formPanel.getLayout();
    GridBagConstraints constraints = layout.getConstraints(highRangeButton);
    constraints.gridx = visible ? 5 : 4;
    layout.setConstraints(highRangeButton, constraints);
    Slider slider = visible ? highMaxSlider : highMinSlider;
    ScaledNumericPanel.this.value.setHighMax(slider.getValue());
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    boolean visible = !lowMaxSlider.isVisible();
    lowMaxSlider.setVisible(visible);
    lowRangeButton.setText(visible ? "<" : ">");
    GridBagLayout layout = (GridBagLayout)formPanel.getLayout();
    GridBagConstraints constraints = layout.getConstraints(lowRangeButton);
    constraints.gridx = visible ? 5 : 4;
    layout.setConstraints(lowRangeButton, constraints);
    Slider slider = visible ? lowMaxSlider : lowMinSlider;
    value.setLowMax((Float)slider.getValue());
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    boolean visible = !lowMaxSlider.isVisible();
    lowMaxSlider.setVisible(visible);
    lowRangeButton.setText(visible ? "<" : ">");
    GridBagLayout layout = (GridBagLayout)formPanel.getLayout();
    GridBagConstraints constraints = layout.getConstraints(lowRangeButton);
    constraints.gridx = visible ? 5 : 4;
    layout.setConstraints(lowRangeButton, constraints);
    Slider slider = visible ? lowMaxSlider : lowMinSlider;
    value.setLowMax((Float)slider.getValue());
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    boolean visible = !highMaxSlider.isVisible();
    highMaxSlider.setVisible(visible);
    highRangeButton.setText(visible ? "<" : ">");
    GridBagLayout layout = (GridBagLayout)formPanel.getLayout();
    GridBagConstraints constraints = layout.getConstraints(highRangeButton);
    constraints.gridx = visible ? 5 : 4;
    layout.setConstraints(highRangeButton, constraints);
    Slider slider = visible ? highMaxSlider : highMinSlider;
    value.setHighMax((Float)slider.getValue());
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    boolean visible = !lowMaxSlider.isVisible();
    lowMaxSlider.setVisible(visible);
    lowRangeButton.setText(visible ? "<" : ">");
    GridBagLayout layout = (GridBagLayout)formPanel.getLayout();
    GridBagConstraints constraints = layout.getConstraints(lowRangeButton);
    constraints.gridx = visible ? 5 : 4;
    layout.setConstraints(lowRangeButton, constraints);
    Slider slider = visible ? lowMaxSlider : lowMinSlider;
    ScaledNumericPanel.this.value.setLowMax(slider.getValue());
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    boolean visible = !highMaxSlider.isVisible();
    highMaxSlider.setVisible(visible);
    highRangeButton.setText(visible ? "<" : ">");
    GridBagLayout layout = (GridBagLayout)formPanel.getLayout();
    GridBagConstraints constraints = layout.getConstraints(highRangeButton);
    constraints.gridx = visible ? 5 : 4;
    layout.setConstraints(highRangeButton, constraints);
    Slider slider = visible ? highMaxSlider : highMinSlider;
    ScaledNumericPanel.this.value.setHighMax(slider.getValue());
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    chart.setExpanded(!chart.isExpanded());
    boolean expanded = chart.isExpanded();
    GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
    GridBagConstraints chartConstraints = layout.getConstraints(chart);
    GridBagConstraints expandButtonConstraints = layout.getConstraints(expandButton);
    if (expanded) {
      chart.setPreferredSize(new Dimension(150, 200));
      expandButton.setText("-");
      chartConstraints.weightx = 1;
      expandButtonConstraints.weightx = 0;
    } else {
      chart.setPreferredSize(new Dimension(150, 62));
      expandButton.setText("+");
      chartConstraints.weightx = 0;
      expandButtonConstraints.weightx = 1;
    }
    layout.setConstraints(chart, chartConstraints);
    layout.setConstraints(expandButton, expandButtonConstraints);
    chart.revalidate();
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    chart.setExpanded(!chart.isExpanded());
    boolean expanded = chart.isExpanded();
    GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
    GridBagConstraints chartConstraints = layout.getConstraints(chart);
    GridBagConstraints expandButtonConstraints = layout.getConstraints(expandButton);
    if (expanded) {
      chart.setPreferredSize(new Dimension(150, 200));
      expandButton.setText("-");
      chartConstraints.weightx = 1;
      expandButtonConstraints.weightx = 0;
    } else {
      chart.setPreferredSize(new Dimension(150, 62));
      expandButton.setText("+");
      chartConstraints.weightx = 0;
      expandButtonConstraints.weightx = 1;
    }
    layout.setConstraints(chart, chartConstraints);
    layout.setConstraints(expandButton, expandButtonConstraints);
    chart.revalidate();
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    chart.setExpanded(!chart.isExpanded());
    boolean expanded = chart.isExpanded();
    GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
    GridBagConstraints chartConstraints = layout.getConstraints(chart);
    GridBagConstraints expandButtonConstraints = layout.getConstraints(expandButton);
    if (expanded) {
      chart.setPreferredSize(new Dimension(150, 200));
      expandButton.setText("-");
      chartConstraints.weightx = 1;
      expandButtonConstraints.weightx = 0;
    } else {
      chart.setPreferredSize(new Dimension(150, 62));
      expandButton.setText("+");
      chartConstraints.weightx = 0;
      expandButtonConstraints.weightx = 1;
    }
    layout.setConstraints(chart, chartConstraints);
    layout.setConstraints(expandButton, expandButtonConstraints);
    chart.revalidate();
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    chart.setExpanded(!chart.isExpanded());
    boolean expanded = chart.isExpanded();
    GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
    GridBagConstraints chartConstraints = layout.getConstraints(chart);
    GridBagConstraints expandButtonConstraints = layout.getConstraints(expandButton);
    if (expanded) {
      chart.setPreferredSize(new Dimension(150, 200));
      expandButton.setText("-");
      chartConstraints.weightx = 1;
      expandButtonConstraints.weightx = 0;
    } else {
      chart.setPreferredSize(new Dimension(150, 62));
      expandButton.setText("+");
      chartConstraints.weightx = 0;
      expandButtonConstraints.weightx = 1;
    }
    layout.setConstraints(chart, chartConstraints);
    layout.setConstraints(expandButton, expandButtonConstraints);
    chart.revalidate();
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    chart.setExpanded(!chart.isExpanded());
    boolean expanded = chart.isExpanded();
    GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
    GridBagConstraints chartConstraints = layout.getConstraints(chart);
    GridBagConstraints expandButtonConstraints = layout.getConstraints(expandButton);
    if (expanded) {
      chart.setPreferredSize(new Dimension(150, 200));
      expandButton.setText("-");
      chartConstraints.weightx = 1;
      expandButtonConstraints.weightx = 0;
    } else {
      chart.setPreferredSize(new Dimension(150, 30));
      expandButton.setText("+");
      chartConstraints.weightx = 0;
      expandButtonConstraints.weightx = 1;
    }
    layout.setConstraints(chart, chartConstraints);
    layout.setConstraints(expandButton, expandButtonConstraints);
    relativeCheckBox.setVisible(!expanded);
    formPanel.setVisible(!expanded);
    chart.revalidate();
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    chart.setExpanded(!chart.isExpanded());
    boolean expanded = chart.isExpanded();
    GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
    GridBagConstraints chartConstraints = layout.getConstraints(chart);
    GridBagConstraints expandButtonConstraints = layout.getConstraints(expandButton);
    if (expanded) {
      chart.setPreferredSize(new Dimension(150, 200));
      expandButton.setText("-");
      chartConstraints.weightx = 1;
      expandButtonConstraints.weightx = 0;
    } else {
      chart.setPreferredSize(new Dimension(150, 30));
      expandButton.setText("+");
      chartConstraints.weightx = 0;
      expandButtonConstraints.weightx = 1;
    }
    layout.setConstraints(chart, chartConstraints);
    layout.setConstraints(expandButton, expandButtonConstraints);
    relativeCheckBox.setVisible(!expanded);
    formPanel.setVisible(!expanded);
    chart.revalidate();
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    chart.setExpanded(!chart.isExpanded());
    boolean expanded = chart.isExpanded();
    GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
    GridBagConstraints chartConstraints = layout.getConstraints(chart);
    GridBagConstraints expandButtonConstraints = layout.getConstraints(expandButton);
    if (expanded) {
      chart.setPreferredSize(new Dimension(150, 200));
      expandButton.setText("-");
      chartConstraints.weightx = 1;
      expandButtonConstraints.weightx = 0;
    } else {
      chart.setPreferredSize(new Dimension(150, 30));
      expandButton.setText("+");
      chartConstraints.weightx = 0;
      expandButtonConstraints.weightx = 1;
    }
    layout.setConstraints(chart, chartConstraints);
    layout.setConstraints(expandButton, expandButtonConstraints);
    relativeCheckBox.setVisible(!expanded);
    if (hasIndependent)
      independentCheckbox.setVisible(!expanded);
    formPanel.setVisible(!expanded);
    chart.revalidate();
  }
});

代码示例来源:origin: libgdx/libgdx

public void actionPerformed (ActionEvent event) {
    chart.setExpanded(!chart.isExpanded());
    boolean expanded = chart.isExpanded();
    GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
    GridBagConstraints chartConstraints = layout.getConstraints(chart);
    GridBagConstraints expandButtonConstraints = layout.getConstraints(expandButton);
    if (expanded) {
      chart.setPreferredSize(new Dimension(150, 200));
      expandButton.setText("-");
      chartConstraints.weightx = 1;
      expandButtonConstraints.weightx = 0;
    } else {
      chart.setPreferredSize(new Dimension(150, 30));
      expandButton.setText("+");
      chartConstraints.weightx = 0;
      expandButtonConstraints.weightx = 1;
    }
    layout.setConstraints(chart, chartConstraints);
    layout.setConstraints(expandButton, expandButtonConstraints);
    relativeCheckBox.setVisible(!expanded);
    if (hasIndependent)
      independentCheckbox.setVisible(!expanded);
    formPanel.setVisible(!expanded);
    chart.revalidate();
  }
});

相关文章