本文整理了Java中java.awt.GridBagLayout.addLayoutComponent()
方法的一些代码示例,展示了GridBagLayout.addLayoutComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridBagLayout.addLayoutComponent()
方法的具体详情如下:
包路径:java.awt.GridBagLayout
类名称:GridBagLayout
方法名:addLayoutComponent
[英]Adds the specified component to the layout, using the specified constraints
object. Note that constraints are mutable and are, therefore, cloned when cached.
[中]使用指定的constraints
对象将指定的组件添加到布局中。请注意,约束是可变的,因此在缓存时会被克隆。
代码示例来源:origin: stackoverflow.com
GridBagLayout layout = new GridBagLayout();
GridBagConstraints cons = new GridBagConstraints();
//set the constraints properties
layout.addLayoutComponent(JProgressBar, cons);
代码示例来源:origin: stackoverflow.com
GridBagLayout layout = new GridBagLayout();
GridBagConstraints cons = new GridBagConstraints();
layout.addLayoutComponent(Component, cons);
代码示例来源:origin: org.swinglabs.swingx/swingx-core
/**
* {@inheritDoc}
*/
@Override
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0));
copyToClipboardButton.setVisible(false);
return layout;
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
/**
* {@inheritDoc}
*/
@Override
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0));
copyToClipboardButton.setVisible(false);
return layout;
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
/**
* {@inheritDoc}
*/
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0));
copyToClipboardButton.setVisible(false);
return layout;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
/**
* {@inheritDoc}
*/
@Override
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0));
copyToClipboardButton.setVisible(false);
return layout;
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
/**
* {@inheritDoc}
*/
@Override
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0));
copyToClipboardButton.setVisible(false);
return layout;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0));
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.LINE_END;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weighty = 0.0;
gbc.weightx = 1.0;
gbc.insets = new Insets(6, 0, 6, 0);
layout.addLayoutComponent(copyToClipboardButton, gbc);
return layout;
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0));
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.LINE_END;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weighty = 0.0;
gbc.weightx = 1.0;
gbc.insets = new Insets(6, 0, 6, 0);
layout.addLayoutComponent(copyToClipboardButton, gbc);
return layout;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-core
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0));
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.LINE_END;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weighty = 0.0;
gbc.weightx = 1.0;
gbc.insets = new Insets(6, 0, 6, 0);
layout.addLayoutComponent(copyToClipboardButton, gbc);
return layout;
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0));
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.LINE_END;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weighty = 0.0;
gbc.weightx = 1.0;
gbc.insets = new Insets(6, 0, 6, 0);
layout.addLayoutComponent(copyToClipboardButton, gbc);
return layout;
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
protected LayoutManager createDetailPanelLayout() {
GridBagLayout layout = new GridBagLayout();
layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0));
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.LINE_END;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weighty = 0.0;
gbc.weightx = 1.0;
gbc.insets = new Insets(6, 0, 6, 0);
layout.addLayoutComponent(copyToClipboardButton, gbc);
return layout;
}
代码示例来源:origin: org.nuiton/nuiton-widgets
/**
* Binds a name in the layout to the specified component. If the name is not
* defined in the layout an error message will be send to System.err
*
* @param name The name in the layout to bind the component to
* @param comp The component to bind to the specified name.
*/
@Override
public void addLayoutComponent(String name, Component comp) {
GridBagConstraints constraint = (GridBagConstraints) constraints
.get(name);
if (constraint != null) {
layout.addLayoutComponent(comp, constraint);
} else {
System.err
.println("(XMLGridLayout) No constraint defined for name "
+ name);
}
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra
/**
* Binds a name in the layout to the specified component. If the name is not
* defined in the layout an error message will be send to System.err
*
* @param name The name in the layout to bind the component to
* @param comp The component to bind to the specified name.
*/
@Override
public void addLayoutComponent(String name, Component comp) {
GridBagConstraints constraint = (GridBagConstraints) constraints
.get(name);
if (constraint != null) {
layout.addLayoutComponent(comp, constraint);
} else {
System.err
.println("(XMLGridLayout) No constraint defined for name "
+ name);
}
}
代码示例来源:origin: org.swinglabs.swingx/swingx-core
/**
* {@inheritDoc}
*/
@Override
protected LayoutManager createErrorPaneLayout() {
createExtraComponents();
GridBagLayout layout = new GridBagLayout();
try {
layout.addLayoutComponent(iconLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 17), 0, 0));
layout.addLayoutComponent(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 12, 0), 0 ,0));
layout.addLayoutComponent(errorScrollPane,new GridBagConstraints(1, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 10, 0), 0, 0));
layout.addLayoutComponent(detailButton, new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 6, 0), 0, 0));
layout.addLayoutComponent(detailsPanel, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 6, 0), 0 ,0));
layout.addLayoutComponent(disclaimerText, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
layout.addLayoutComponent(closeButton, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
layout.addLayoutComponent(reportButton, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
} catch (Exception e) {
e.printStackTrace();
}
return layout;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
/**
* {@inheritDoc}
*/
@Override
protected LayoutManager createErrorPaneLayout() {
createExtraComponents();
GridBagLayout layout = new GridBagLayout();
try {
layout.addLayoutComponent(iconLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 17), 0, 0));
layout.addLayoutComponent(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 12, 0), 0 ,0));
layout.addLayoutComponent(errorScrollPane,new GridBagConstraints(1, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 10, 0), 0, 0));
layout.addLayoutComponent(detailButton, new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 6, 0), 0, 0));
layout.addLayoutComponent(detailsPanel, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 6, 0), 0 ,0));
layout.addLayoutComponent(disclaimerText, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
layout.addLayoutComponent(closeButton, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
layout.addLayoutComponent(reportButton, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
} catch (Exception e) {
e.printStackTrace();
}
return layout;
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
/**
* {@inheritDoc}
*/
@Override
protected LayoutManager createErrorPaneLayout() {
createExtraComponents();
GridBagLayout layout = new GridBagLayout();
try {
layout.addLayoutComponent(iconLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 17), 0, 0));
layout.addLayoutComponent(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 12, 0), 0 ,0));
layout.addLayoutComponent(errorScrollPane,new GridBagConstraints(1, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 10, 0), 0, 0));
layout.addLayoutComponent(detailButton, new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 6, 0), 0, 0));
layout.addLayoutComponent(detailsPanel, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 6, 0), 0 ,0));
layout.addLayoutComponent(disclaimerText, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
layout.addLayoutComponent(closeButton, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
layout.addLayoutComponent(reportButton, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
} catch (Exception e) {
e.printStackTrace();
}
return layout;
}
代码示例来源:origin: org.freehep/freehep-graphicsbase
public void addLayoutComponent(Component component, Object constraints) {
if (constraints instanceof String) {
constraints = getGridBagConstraints((String)constraints);
if (constraints == null) {
usage();
constraints = new GridBagConstraints();
System.err.println("Using Default GridBagConstraints.");
}
}
super.addLayoutComponent(component, constraints);
}
代码示例来源:origin: freehep/freehep-vectorgraphics
public void addLayoutComponent(Component component, Object constraints) {
if (constraints instanceof String) {
constraints = getGridBagConstraints((String)constraints);
if (constraints == null) {
usage();
constraints = new GridBagConstraints();
System.err.println("Using Default GridBagConstraints.");
}
}
super.addLayoutComponent(component, constraints);
}
代码示例来源:origin: datacleaner/DataCleaner
public static void addToGridBag(final Component comp, final JPanel panel, final int gridx, final int gridy,
final int width, final int height, final int anchor, final int padding, final double weightx,
final double weighty, final int fill) {
LayoutManager layout = panel.getLayout();
if (!(layout instanceof GridBagLayout)) {
layout = new GridBagLayout();
panel.setLayout(layout);
}
final GridBagLayout gridBagLayout = (GridBagLayout) layout;
final GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = gridx;
constraints.gridy = gridy;
constraints.gridwidth = width;
constraints.gridheight = height;
constraints.weightx = weightx;
constraints.weighty = weighty;
constraints.anchor = anchor;
constraints.fill = fill;
constraints.insets = new Insets(padding, padding, padding, padding);
gridBagLayout.addLayoutComponent(comp, constraints);
panel.add(comp);
}
内容来源于网络,如有侵权,请联系作者删除!