本文整理了Java中net.miginfocom.swing.MigLayout.getComponentConstraints()
方法的一些代码示例,展示了MigLayout.getComponentConstraints()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MigLayout.getComponentConstraints()
方法的具体详情如下:
包路径:net.miginfocom.swing.MigLayout
类名称: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!