net.miginfocom.swing.MigLayout.getComponentConstraints()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(102)

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

MigLayout.getComponentConstraints介绍

[英]Returns the component constraints as a String representation. This string is the exact string as set with #setComponentConstraints(java.awt.Component,Object)or set when adding the component to the parent component.

See the class JavaDocs for information on how this string is formatted.
[中]以字符串表示形式返回组件约束。此字符串与#setComponentConstraints(java.awt.Component,Object)设置的字符串或将组件添加到父组件时设置的字符串完全相同。
有关如何格式化此字符串的信息,请参见JavaDocs类。

代码示例

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

public void replaceNameField(JPanel newNamePanel) {
  MigLayout layout = (MigLayout) pane.getLayout();
  Object constraintsForNamePanel = layout.getComponentConstraints(this.namePanel);
  pane.remove(this.namePanel);
  this.namePanel = newNamePanel;
  pane.add(newNamePanel, constraintsForNamePanel);
 }

代码示例来源:origin: dragome/dragome-sdk

public void insertBefore(Template newChild, Template referenceChild, Map<String, Template> children, List<Template> childrenList, Template template)
{
  if (isInvokingEvents())
  {
    Component referenceElement= (Component) referenceChild.getContent().getValue();
    Object componentConstraints= ((MigLayout) referenceElement.getParent().getLayout()).getComponentConstraints(referenceElement);
    int index= childrenList.indexOf(referenceChild) - 1;
    if (index < 0)
      index= 0;
    childrenList.add(index, newChild);
    children.put(newChild.getName(), newChild);
    Component newElement= (Component) newChild.getContent().getValue();
    referenceElement.getParent().add(newElement, componentConstraints);
    newChild.setParent(template);
  }
}

相关文章