本文整理汇总了Java中javax.swing.GroupLayout.createSequentialGroup方法的典型用法代码示例。如果您正苦于以下问题:Java GroupLayout.createSequentialGroup方法的具体用法?Java GroupLayout.createSequentialGroup怎么用?Java GroupLayout.createSequentialGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.GroupLayout
的用法示例。
在下文中一共展示了GroupLayout.createSequentialGroup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FormLayoutHelper
import javax.swing.GroupLayout; //导入方法依赖的package包/类
public FormLayoutHelper(JPanel panel, Column... columns) {
this.panel = panel;
layout = new GroupLayout(panel);
panel.setLayout(layout);
horizontalGroup = layout.createSequentialGroup();
verticalGroup = layout.createSequentialGroup();
this.columns = columns;
columnGroups = new Group[columns.length];
for (int i = 0; i < columns.length; i++) {
Group columnGroup = columns[i].createParallelGroup(layout);
columnGroups[i] = columnGroup;
horizontalGroup.addGroup(columnGroup);
}
layout.setHorizontalGroup(horizontalGroup);
layout.setVerticalGroup(verticalGroup);
}
示例2: getVerticalGroup
import javax.swing.GroupLayout; //导入方法依赖的package包/类
private GroupLayout.ParallelGroup getVerticalGroup (GroupLayout layout, boolean hasPrimary, boolean hasRequired) {
GroupLayout.ParallelGroup res = layout.createParallelGroup (/* XXX huh? GroupLayout.PREFERRED_SIZE*/);
GroupLayout.SequentialGroup seq = layout.createSequentialGroup ();
if (hasPrimary) {
seq.addComponent (tpPrimaryTitle, GroupLayout.DEFAULT_SIZE, 40, 40)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED)
.addComponent (tpPrimaryPlugins, GroupLayout.PREFERRED_SIZE, tpPrimaryPlugins.getPreferredSize ().height, GroupLayout.PREFERRED_SIZE)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED)
.addGap (0, 30, 30);
}
if (hasRequired) {
seq.addComponent (tpDependingTitle, GroupLayout.DEFAULT_SIZE, 80, 80)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED)
.addComponent (tpDependingPlugins, GroupLayout.PREFERRED_SIZE, tpDependingPlugins.getPreferredSize ().height, GroupLayout.PREFERRED_SIZE)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED);
}
res.addGroup (seq);
return res;
}
示例3: init
import javax.swing.GroupLayout; //导入方法依赖的package包/类
private void init() {
errorLabel.setText(" "); // NOI18N
GroupLayout containerPanelLayout = new GroupLayout(containerPanel);
containerPanel.setLayout(containerPanelLayout);
GroupLayout.ParallelGroup horizontalGroup = containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
GroupLayout.SequentialGroup verticalGroup = containerPanelLayout.createSequentialGroup();
containerPanelLayout.setHorizontalGroup(horizontalGroup);
containerPanelLayout.setVerticalGroup(
containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(verticalGroup)
);
for (CssPreprocessorUIImplementation.Options options : allOptions) {
JComponent component = options.getComponent();
Parameters.notNull("component", component); // NOI18N
horizontalGroup.addComponent(component, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
verticalGroup.addComponent(component, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
}
}
示例4: ActionsBuilder
import javax.swing.GroupLayout; //导入方法依赖的package包/类
public ActionsBuilder (JPanel panel, FocusListener listener) {
this.focusListener = listener;
panel.removeAll();
GroupLayout layout = (GroupLayout) panel.getLayout();
horizontalSeqGroup = layout.createSequentialGroup();
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(horizontalSeqGroup)
);
verticalParallelGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(verticalParallelGroup)
);
}
示例5: ActionsBuilder
import javax.swing.GroupLayout; //导入方法依赖的package包/类
public ActionsBuilder (JPanel panel) {
panel.removeAll();
GroupLayout layout = (GroupLayout) panel.getLayout();
horizontalSeqGroup = layout.createSequentialGroup();
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(horizontalSeqGroup)
);
verticalParallelGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(verticalParallelGroup)
);
}
示例6: getTableCellRendererComponent
import javax.swing.GroupLayout; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus, int row,
int column) {
JPanel panel = new JPanel();
if (value instanceof String[]) {
String[] valueArray = (String[]) value;
if (valueArray.length == 0)
return panel;
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);
SequentialGroup cols = layout.createSequentialGroup();
layout.setHorizontalGroup(cols);
ParallelGroup col1 = layout
.createParallelGroup(GroupLayout.Alignment.LEADING);
ParallelGroup col2 = layout
.createParallelGroup(GroupLayout.Alignment.TRAILING);
cols.addGroup(col1)
.addPreferredGap(
LayoutStyle.ComponentPlacement.RELATED,
GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(col2);
SequentialGroup rows = layout.createSequentialGroup();
layout.setVerticalGroup(rows);
for (int i = 0; i < valueArray.length; i++) {
// the value array has null elements for
// IdResource/Demand
if (valueArray[i] != null) {
/* TODO: Fix ArrayIndexOutofBounds Exception here
* Update: Problem is actually above. Probably linked to resources without setters. */
//System.out.println("ValueArray: " + valueArray[i]);
//for (int j = 0; j < resParamNames.size(); j++) { System.out.println("resParamNames: " + resParamNames.get(j)); }
JLabel label = new JLabel();
if (resParamNames.get(row).length == 0)
label.setText("max. param");
else
label.setText("max. " + resParamNames.get(row)[i]);
JTextField tf = new JTextField(3);
tf.setText(valueArray[i]);
col1.addComponent(label);
col2.addComponent(tf, GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE);
rows.addGroup(layout
.createParallelGroup(
GroupLayout.Alignment.CENTER)
.addComponent(label).addComponent(tf));
}
}
}
table.setRowHeight(row, Math.max(table.getRowHeight(row),
(int) panel.getPreferredSize().getHeight()));
TableColumn cm = table.getColumnModel().getColumn(column);
cm.setMinWidth(Math.max(cm.getMinWidth(), (int) panel
.getPreferredSize().getWidth()));
return panel;
}
示例7: getTableCellEditorComponent
import javax.swing.GroupLayout; //导入方法依赖的package包/类
@Override
public Component getTableCellEditorComponent(JTable table,
Object value, boolean isSelected, int row, int column) {
panel = new JPanel();
if (value instanceof String[]) {
String[] valueArray = (String[]) value;
if (valueArray.length == 0)
return panel;
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);
SequentialGroup cols = layout.createSequentialGroup();
layout.setHorizontalGroup(cols);
ParallelGroup col1 = layout
.createParallelGroup(GroupLayout.Alignment.LEADING);
ParallelGroup col2 = layout
.createParallelGroup(GroupLayout.Alignment.TRAILING);
cols.addGroup(col1)
.addPreferredGap(
LayoutStyle.ComponentPlacement.RELATED,
GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(col2);
SequentialGroup rows = layout.createSequentialGroup();
layout.setVerticalGroup(rows);
for (int i = 0; i < valueArray.length; i++) {
// create the label. use the resource param name for both
// resource and demand params as it should be the same. TODO
JLabel label = new JLabel();
if (resParamNames.get(row).length == 0)
label.setText("max. param");
else
label.setText("max. " + resParamNames.get(row)[i]);
JTextField tf = new JTextField(3);
tf.setText(valueArray[i]);
tf.setEditable(true);
col1.addComponent(label);
col2.addComponent(tf, GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE);
rows.addGroup(layout
.createParallelGroup(GroupLayout.Alignment.CENTER)
.addComponent(label).addComponent(tf));
}
}
table.setRowHeight(row, Math.max(table.getRowHeight(row),
(int) panel.getPreferredSize().getHeight()));
TableColumn cm = table.getColumnModel().getColumn(column);
cm.setMinWidth(Math.max(cm.getMinWidth(), (int) panel
.getPreferredSize().getWidth()));
return panel;
}
示例8: setIssue
import javax.swing.GroupLayout; //导入方法依赖的package包/类
void setIssue(BugzillaIssue issue,
List<BugzillaIssue.Attachment> attachments) {
removeAll();
this.issue = issue;
initCollapsedComments();
this.attachments = attachments;
this.attachmentIds = getAttachmentIds(attachments);
BugzillaIssue.Comment[] comments = issue.getComments();
this.sections = new ArrayList<>(comments.length + 1);
GroupLayout layout = new GroupLayout(this);
GroupLayout.ParallelGroup horizontalGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
layout.setHorizontalGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(horizontalGroup)
.addContainerGap());
GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup();
verticalGroup.addContainerGap();
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(verticalGroup));
DateFormat format = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT);
String creationTxt = issue.getFieldValue(IssueField.CREATION);
try {
if (!creationTxt.isEmpty()) {
Date creation = dateTimeFormat.parse(creationTxt);
creationTxt = format.format(creation);
}
} catch (ParseException pex) {
Bugzilla.LOG.log(Level.INFO, null, pex);
}
sections.add(addSection(layout,
new Long(0),
issue.getFieldValue(IssueField.DESCRIPTION),
issue.getFieldValue(IssueField.REPORTER),
issue.getFieldValue(IssueField.REPORTER_NAME),
creationTxt, horizontalGroup, verticalGroup, true));
for (BugzillaIssue.Comment comment : comments) {
String when = format.format(comment.getWhen());
sections.add(addSection(layout, comment.getNumber(), comment.getText(), comment.getAuthor(), comment.getAuthorName(), when, horizontalGroup, verticalGroup, false));
}
verticalGroup.addContainerGap();
setLayout(layout);
}