Java Code Examples for net.miginfocom.layout.CC#width()
The following examples show how to use
net.miginfocom.layout.CC#width() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MigLayoutHelper.java From cuba with Apache License 2.0 | 6 votes |
public static void applyWidth(CC constraints, int width, SizeUnit widthUnits, boolean expand) { if (width == -1) { // own size constraints.growX(0); } else if (widthUnits == SizeUnit.PERCENTAGE) { constraints.width(width + "%"); } else if (width != 0 && widthUnits == SizeUnit.PIXELS) { constraints.growX(0); constraints.width(width + "!"); // min, pref, max size as specified } else { if (expand) { constraints.growX(); constraints.growPrioX(99); // lower grow priority constraints.width("100%"); // preferred size to full container } else { constraints.growX(0); } } }
Example 2
Source File: MigGridLayoutAdapter.java From cuba with Apache License 2.0 | 5 votes |
@Override public Object getCaptionConstraints(com.haulmont.cuba.gui.components.Component component, int col, int row, int col2, int row2) { CC constraints = new CC(); constraints.cell(col, row); constraints.split(2); constraints.flowY(); constraints.width("min!"); constraints.height("min!"); MigLayoutHelper.applyAlignment(constraints, component.getAlignment()); return constraints; }
Example 3
Source File: MigBoxLayoutAdapter.java From cuba with Apache License 2.0 | 5 votes |
@Override public Object getCaptionConstraints(com.haulmont.cuba.gui.components.Component component) { CC cc = new CC(); cc.split(2); cc.width("min!"); cc.height("min!"); MigLayoutHelper.applyAlignment(cc, component.getAlignment()); return cc; }
Example 4
Source File: VclTestApp.java From cuba with Apache License 2.0 | 4 votes |
private Component createTableTab() { final JPanel box = new JPanel(); box.setFocusable(false); MigLayout boxLayout = new MigLayout("fill"); box.setLayout(boxLayout); final JScrollPane outerScrollPane = new JScrollPane(); outerScrollPane.setViewportView(box); outerScrollPane.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { final Dimension minimumSize = box.getMinimumSize(); final int width = Math.max(minimumSize.width, outerScrollPane.getViewport().getWidth()); box.setPreferredSize(new Dimension(width, minimumSize.height)); } }); JPanel tablePanel = new JPanel(); MigLayout tablePanellayout = new MigLayout("flowy, fill, insets 0", "", "[min!][fill]"); tablePanel.setLayout(tablePanellayout); JPanel topPanel = new JPanel(new FlowLayout()); topPanel.setVisible(true); tablePanel.add(topPanel/*, "growx"*/); topPanel.add(new JButton("Button1")); topPanel.add(new JButton("Button2")); topPanel.add(new JButton("Button3")); topPanel.add(new JButton("Button4")); topPanel.add(new JButton("Button5")); JXTableExt table = new JXTableExt(); JScrollPane tableScrollPane = new JScrollPane(table); // table.setFillsViewportHeight(true); tablePanel.add(tableScrollPane, "grow"); table.setShowGrid(true); table.setGridColor(Color.lightGray); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setColumnControlVisible(true); table.setModel(new AbstractTableModel() { @Override public int getRowCount() { return 20; } @Override public int getColumnCount() { return 20; } @Override public Object getValueAt(int rowIndex, int columnIndex) { return rowIndex + "-" + columnIndex; } }); CC cc = new CC(); // cc.growX(0); // cc.width("300!"); cc.width("100%"); // cc.growY(0.0f); cc.height("200!"); // cc.height("100%"); box.add(tablePanel); boxLayout.setComponentConstraints(tablePanel, cc); // cc = new CC(); // cc.growX(0); // cc.width("300!"); // cc.width("100%"); // cc.height("200!"); // tablePanellayout.setComponentConstraints(tableScrollPane, cc); return outerScrollPane; }