本文整理了Java中java.awt.GridBagLayout.preferredLayoutSize()
方法的一些代码示例,展示了GridBagLayout.preferredLayoutSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridBagLayout.preferredLayoutSize()
方法的具体详情如下:
包路径:java.awt.GridBagLayout
类名称:GridBagLayout
方法名:preferredLayoutSize
[英]Determines the preferred size of the parent
container using this grid bag layout.
Most applications do not call this method directly.
[中]
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra
@Override
public Dimension preferredLayoutSize(Container parent) {
return layout.preferredLayoutSize(parent);
}
代码示例来源:origin: org.nuiton/nuiton-widgets
@Override
public Dimension preferredLayoutSize(Container parent) {
return layout.preferredLayoutSize(parent);
}
代码示例来源:origin: com.stevesoft.pat/pat
public void packNShow() {
int i;
GridBagLayout gb = new GridBagLayout();
setLayout(gb);
GridBagConstraints gc = new GridBagConstraints();
gc.gridx = 0;
gc.fill = gc.HORIZONTAL;
int xpos = 0,ypos = 0;
Label lab;
for(i=0;i<v.size();i++)
if(v.elementAt(i) instanceof Label) {
lab = (Label)v.elementAt(i);
add(lab);
gc.gridy = ypos++;
gb.setConstraints(lab,gc);
}
gc.gridy = ypos;
for(i=0;i<v.size();i++)
if(v.elementAt(i) instanceof Button) {
Button but = (Button)v.elementAt(i);
add(but);
gc.gridx = xpos++;
gb.setConstraints(but,gc);
}
pack();
resize(gb.preferredLayoutSize(this));
show();
}
/** @serial */
内容来源于网络,如有侵权,请联系作者删除!