本文整理了Java中com.intellij.uiDesigner.core.GridLayoutManager
类的一些代码示例,展示了GridLayoutManager
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridLayoutManager
类的具体详情如下:
包路径:com.intellij.uiDesigner.core.GridLayoutManager
类名称:GridLayoutManager
暂无
代码示例来源:origin: stackoverflow.com
mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
//or
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
代码示例来源:origin: stackoverflow.com
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create a grid layout with two columns
GridLayoutManager layoutManager = new GridLayoutManager(this, 2);
// Create a custom SpanSizeLookup where the first item spans both columns
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return position == 0 ? 2 : 1;
}
});
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(new MyGridAdapter());
}
代码示例来源:origin: stackoverflow.com
recyclerView= (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
GridLayoutManager glm = new GridLayoutManager(this, 2); // 2 columns in each row
glm.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(glm);
代码示例来源:origin: stackoverflow.com
RecylerView recycler = findViewById(R.id.recyclerInActivity);
//now create a GridLayoutManager
GridLayoutManager gridLayoutManager = new GridLayoutManager(this);
//set the gridLayoutManager's spanCount to 3 for 3 columns:
gridLayoutManager.setSpanCount(3);
//Now create your custom Adapter with an XML layout with a button and set the adapter
recycler.setAdapter(myCustomAdapter);
//When a view is removed, remove it from the data supply (e.g. arrayListOfData.remove(indexOfRemovedItem)) of the RecylerView.Adapter and then call:
myCustomAdapter.notifyItemChanged(indexOfRemovedItem);
代码示例来源:origin: stackoverflow.com
final GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
switch (listAdapter.getItemViewType(position)) {
case ViewType.DEFAULT_ITEM_TYPE:
return 1;
case ViewType.AD_ITEM_TYPE:
return gridLayoutManager.getSpanCount();
default:
return -1;
}
}
});
代码示例来源:origin: intellij-dlanguage/intellij-dlanguage
final GridConstraints constraints = layout.getConstraintsForComponent(textArgsPane);
代码示例来源:origin: stackoverflow.com
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
GridLayoutManager.SpanSizeLookup columnSpanner = new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return adapter.getItemViewType(position) == R.layout.your_two_column_row_layout ? 1 : 2;
}
};
gridLayoutManager.setSpanSizeLookup(columnSpanner);
recyclerView.setLayoutManager(gridLayoutManager);
代码示例来源:origin: stackoverflow.com
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 1);
gridLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
recyclerView.setLayoutManager(gridLayoutManager);
代码示例来源:origin: ballerina-platform/ballerina-lang
private JPanel createRootPanel() {
final JPanel panel = new JPanel();
panel.setLayout(new GridLayoutManager(rows.size(), 6, JBUI.emptyInsets(), -1, -1));
int idx = 0;
final Iterator<Map.Entry<Timeouts, JTextField>> iterator = rows.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Timeouts, JTextField> entry = iterator.next();
Timeouts timeout = entry.getKey();
JTextField textField = entry.getValue();
String name = timeout.name();
panel.add(new JLabel(name.substring(0, 1) + name.substring(1).toLowerCase()), createGridConstraints(idx, 0));
panel.add(textField, createGridConstraints(idx, 1, new Dimension(100, 10)));
panel.add(new Spacer(), createSpacerGridConstraints(idx, 2));
if (iterator.hasNext()) {
entry = iterator.next();
timeout = entry.getKey();
textField = entry.getValue();
name = timeout.name();
panel.add(new JLabel(name.substring(0, 1) + name.substring(1).toLowerCase()), createGridConstraints(idx, 3));
panel.add(textField, createGridConstraints(idx, 4, new Dimension(100, 10)));
panel.add(new Spacer(), createSpacerGridConstraints(idx++, 5));
}
}
return panel;
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
Collection<HideableDecorator> hideableDecorators = ContainerUtil.newHashSet();
GridLayoutManager layoutManager = new GridLayoutManager(configurables.size() + 1, 1, new Insets(0, 0, 0, 0), -1, -1);
JPanel rootPanel = new JPanel(layoutManager);
Spacer spacer = new Spacer();
代码示例来源:origin: ballerina-platform/ballerina-lang
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
rootPanel = new JPanel();
rootPanel.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
repositoriesLabel = new JLabel();
repositoriesLabel.setText("Additional repositories");
rootPanel.add(repositoriesLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer1 = new Spacer();
rootPanel.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final Spacer spacer2 = new Spacer();
rootPanel.add(spacer2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
final JScrollPane scrollPane1 = new JScrollPane();
rootPanel.add(scrollPane1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
repositoriesTextArea = new JTextArea();
repositoriesTextArea.setMaximumSize(new Dimension(420, 2147483647));
repositoriesTextArea.setMinimumSize(new Dimension(300, 10));
repositoriesTextArea.setPreferredSize(new Dimension(300, 50));
repositoriesTextArea.setText(ResourceBundle.getBundle("com/github/gtache/lsp/LSPBundle").getString("coursier.settings.textarea.basetext"));
repositoriesTextArea.setToolTipText("Insert one resolver by line");
scrollPane1.setViewportView(repositoriesTextArea);
}
代码示例来源:origin: ballerina-platform/ballerina-lang
private JPanel createRow(final Collection<JComponent> labelFields, final String selectedItem) {
final JPanel panel = new JPanel();
int colIdx = 0;
panel.setLayout(new GridLayoutManager(2, 17, JBUI.emptyInsets(), -1, -1));
panel.add(new Spacer(), new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, 1, GridConstraints.SIZEPOLICY_FIXED, new Dimension(0, 10), new Dimension(0, 10), new Dimension(0, 10), 0, false));
final JComboBox<String> typeBox = createComboBox(panel, selectedItem);
panel.add(typeBox, new GridConstraints(0, colIdx++, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Iterator<JComponent> iterator = labelFields.iterator();
while (iterator.hasNext()) {
final JComponent label = iterator.next();
final JComponent field = iterator.next();
panel.add(new Spacer(), new GridConstraints(0, colIdx++, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
panel.add(label, new GridConstraints(0, colIdx++, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
panel.add(field, new GridConstraints(0, colIdx++, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
}
panel.add(new Spacer(), new GridConstraints(0, 14, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JButton newRowButton = createNewRowButton();
panel.add(newRowButton, new GridConstraints(0, 15, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
if (rows.isEmpty()) {
panel.add(new Spacer(), new GridConstraints(0, 16, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
} else {
final JButton removeRowButton = createRemoveRowButton(panel);
panel.add(removeRowButton, new GridConstraints(0, 16, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
panel.setAlignmentX(Component.LEFT_ALIGNMENT);
return panel;
}
代码示例来源:origin: ballerina-platform/ballerina-lang
Collection<HideableDecorator> hideableDecorators = ContainerUtil.newHashSet();
GridLayoutManager layoutManager = new GridLayoutManager(configurables.size() + 1, 1, new Insets(0, 0,
0, 0), -1, -1);
JPanel rootPanel = new JPanel(layoutManager);
代码示例来源:origin: google/google-java-format
createUIComponents();
panel = new JPanel();
panel.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1));
enable = new JCheckBox();
enable.setText("Enable google-java-format");
代码示例来源:origin: ballerina-platform/ballerina-lang
private void setupUI() {
rootPane = new JPanel();
rootPane.setLayout(new GridLayoutManager(4, 3, JBUI.emptyInsets(), -1, -1));
/*showDetailsCheck = new JCheckBox();
showDetailsCheck.setText("Show servers instances");
rootPane.add(showDetailsCheck, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
showDetailsCheck.addItemListener(e -> {
final var checkBox = (JCheckBox) e.getItem();
if (checkBox.isSelected()) {
serverBox.setModel(serverWrapModel);
} else {
serverBox.setModel(serverDefModel);
}
});*/
serverBox = new ComboBox<>(this.serverDefModel);
rootPane.add(serverBox, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer1 = new Spacer();
rootPane.add(spacer1, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
final Spacer spacer2 = new Spacer();
rootPane.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
final Spacer spacer3 = new Spacer();
rootPane.add(spacer3, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
final Spacer spacer4 = new Spacer();
rootPane.add(spacer4, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final Spacer spacer5 = new Spacer();
rootPane.add(spacer5, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
}
代码示例来源:origin: ballerina-platform/ballerina-lang
rootPanel.setLayout(new GridLayoutManager(9, 4, new Insets(5, 5, 0, 0), -1, -1));
final Spacer spacer1 = new Spacer();
rootPanel.add(spacer1, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
代码示例来源:origin: stackoverflow.com
// Create a grid layout with 6 columns
// (least common multiple of 2 and 3)
GridLayoutManager layoutManager = new GridLayoutManager(this, 6);
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
// 5 is the sum of items in one repeated section
switch (position % 5) {
// first two items span 3 columns each
case 0:
case 1:
return 3;
// next 3 items span 2 columns each
case 2:
case 3:
case 4:
return 2;
}
throw new IllegalStateException("internal error");
}
});
代码示例来源:origin: vulnersCom/burp-vulners-scanner
createUIComponents();
rootPanel = new JPanel();
rootPanel.setLayout(new GridLayoutManager(5, 19, new Insets(0, 0, 0, 0), -1, -1));
tabbedPane1 = new JTabbedPane();
tabbedPane1.setTabPlacement(1);
rootPanel.add(tabbedPane1, new GridConstraints(0, 0, 5, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(4, 5, new Insets(0, 0, 0, 0), -1, -1));
tabbedPane1.addTab("Scan rules", panel1);
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(4, 3, new Insets(0, 0, 0, 0), -1, -1));
panel1.add(panel2, new GridConstraints(0, 0, 1, 5, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final Spacer spacer1 = new Spacer();
panel1.add(btnRuleRemove, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(8, 2, new Insets(0, 0, 0, 0), -1, -1));
tabbedPane1.addTab("Results", panel3);
final JScrollPane scrollPane1 = new JScrollPane();
panel3.add(btnTblPathClear, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JPanel panel4 = new JPanel();
panel4.setLayout(new GridLayoutManager(8, 3, new Insets(0, 0, 0, 0), -1, -1));
tabbedPane1.addTab("Options", panel4);
final JLabel label8 = new JLabel();
代码示例来源:origin: stackoverflow.com
case R.id.menu_switch_view:
isGridLayout = !isGridLayout;
recyclerView.setLayoutManager(isGridLayout ? new GridLayoutManager(this, 2) : new LinearLayoutManager(this));
recyclerView.setAdapter(mAdapter);
break;
代码示例来源:origin: stackoverflow.com
GridLayoutManager manager = new GridLayoutManager(this, 3);
manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return (3 - position % 3);
}
});
recyclerView.setLayoutManager(manager);
内容来源于网络,如有侵权,请联系作者删除!