Java Code Examples for net.miginfocom.swing.MigLayout#setLayoutConstraints()
The following examples show how to use
net.miginfocom.swing.MigLayout#setLayoutConstraints() .
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: MenuScreenContentPanel.java From magarena with GNU General Public License v3.0 | 6 votes |
public MenuScreenContentPanel(String title, boolean showKeyStripPanel) { mp = new MenuPanel(title); final MigLayout layout = new MigLayout(); layout.setLayoutConstraints("insets 0, gap 0, flowy"); layout.setRowConstraints("[30!][100%, center][30!, bottom]"); layout.setColumnConstraints("[center, fill, grow]"); setLayout(layout); add(mp, "cell 0 1"); if (showKeyStripPanel) { add(new KeysStripPanel()); } setOpaque(false); }
Example 2
Source File: DeckInfoPanel.java From magarena with GNU General Public License v3.0 | 6 votes |
public DeckInfoPanel() { this.statsViewer = new DeckStatisticsViewer(); this.descViewer = new DeckDescriptionViewer(); final MigLayout mig = new MigLayout(); setLayout(mig); mig.setLayoutConstraints("flowy, insets 0, gap 0"); mig.setColumnConstraints("[fill, grow]"); mig.setRowConstraints("[][fill, grow]"); refreshLayout(); statsViewer.addPropertyChangeListener( DeckStatisticsViewer.CP_LAYOUT_CHANGED, (e) -> { refreshLayout(); firePropertyChange(CP_LAYOUT_CHANGED, true, false); } ); setBackground(FontsAndBorders.TRANSLUCENT_WHITE_STRONG); }
Example 3
Source File: LayoutTest.java From cuba with Apache License 2.0 | 5 votes |
private void testTable() { MigLayout layout = new MigLayout("debug"); JPanel panel = new JPanel(layout); contentPane.add(panel, BorderLayout.CENTER); layout.setLayoutConstraints("fill, flowy, insets 10 0 0 0, debug"); JTable table = new JTable(); table.setModel(new DefaultTableModel(new String[] {"col1", "col2"}, 3)); panel.add(table); layout.setComponentConstraints(table, "grow"); }
Example 4
Source File: LayoutTest.java From cuba with Apache License 2.0 | 5 votes |
private void testTableAndButtons() { MigLayout mainLayout = new MigLayout(); JPanel mainPanel = new JPanel(mainLayout); contentPane.add(mainPanel, BorderLayout.CENTER); mainLayout.setLayoutConstraints("flowy, fillx, insets panel, debug"); MigLayout buttonsLayout = new MigLayout("flowx, filly, insets panel, debug"); JPanel buttonsPanel = new JPanel(buttonsLayout); buttonsPanel.add(new JButton("button1")); buttonsPanel.add(new JButton("button2")); mainPanel.add(buttonsPanel); MigLayout tableLayout = new MigLayout("flowy, fill, debug"); JPanel tablePanel = new JPanel(tableLayout); JTable table = new JTable(); table.setModel(new DefaultTableModel(new String[] {"col1", "col2"}, 3)); tablePanel.add(table, "grow"); mainPanel.add(tablePanel); mainLayout.setComponentConstraints(tablePanel, "grow"); mainLayout.setLayoutConstraints("flowy, fill, insets panel, debug"); // change fillx to fill // mainLayout.setRowConstraints("[min!][fill]"); AC ac = new AC().size("min!", 0).fill(1); mainLayout.setRowConstraints(ac); }
Example 5
Source File: VclTestApp.java From cuba with Apache License 2.0 | 5 votes |
private Component createAlignTab() { JPanel box = new JPanel(); box.setFocusable(false); MigLayout boxLayout = new MigLayout("debug 1000, fill"); box.setLayout(boxLayout); JPanel panel = new JPanel(); MigLayout layout = new MigLayout("debug 1000, fill"); panel.setLayout(layout); JLabel label = new JLabel("Label"); CC cc = new CC(); cc.alignX("right").alignY("50%"); panel.add(label); layout.setComponentConstraints(label, cc); LC lc = new LC(); lc.hideMode(2); // The size of an invisible component will be set to 0, 0 and the gaps will also be set to 0 around it. lc.debug(1000); AC rowConstr = new AC(); AC colConstr = new AC(); lc.fillX(); lc.flowY(); lc.gridGapY("0"); layout.setLayoutConstraints(lc); layout.setRowConstraints(rowConstr); layout.setColumnConstraints(colConstr); box.add(panel, "height 100px, width 100px"); layout.setComponentConstraints(label, cc); return box; }
Example 6
Source File: HeaderFooterScreen.java From magarena with GNU General Public License v3.0 | 5 votes |
private void setMigLayout() { final MigLayout layout = new MigLayout(); layout.setLayoutConstraints("insets 0, gap 0, flowy"); layout.setRowConstraints("[50!][100%, fill, grow][]"); layout.setColumnConstraints("[center, fill, grow]"); setLayout(layout); }
Example 7
Source File: NewMenuScreenContentPanel.java From magarena with GNU General Public License v3.0 | 5 votes |
public NewMenuScreenContentPanel() { mp = new NewMenuPanel(); final MigLayout layout = new MigLayout(); layout.setLayoutConstraints("insets 0, gap 0, flowy"); layout.setRowConstraints("[30!][100%, center][30!, bottom]"); layout.setColumnConstraints("[center, fill, grow]"); setLayout(layout); add(mp, "cell 0 1"); refreshStyle(); setOpaque(false); }
Example 8
Source File: CardFilterPanel.java From magarena with GNU General Public License v3.0 | 5 votes |
private void refreshLayout() { MigLayout layout = new MigLayout(); layout.setLayoutConstraints("flowy, wrap 2, gap 4"); layout.setColumnConstraints("fill, 66:108"); layout.setRowConstraints("fill, 36"); setLayout(layout); // layout buttons in columns over two rows. for (FilterPanel fb : filterButtons) { add(fb); } add(resetButton); }
Example 9
Source File: DeckDescriptionViewer.java From magarena with GNU General Public License v3.0 | 5 votes |
public DeckDescriptionViewer() { setOpaque(false); final TitleBar titleBar = new TitleBar(MText.get(_S1)); textArea = new JTextArea(); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setBackground(FontsAndBorders.TEXTAREA_TRANSPARENT_COLOR_HACK); scrollPane = new JScrollPane(textArea); scrollPane.getVerticalScrollBar().setUnitIncrement(8); scrollPane.setBorder(null); scrollPane.getViewport().setOpaque(false); scrollPane.setMinimumSize(new Dimension(0, 0)); scrollPane.setPreferredSize(new Dimension(getWidth(), 0)); setMinimumSize(new Dimension(0, titleBar.getMinimumSize().height)); final MigLayout mig = new MigLayout(); mig.setLayoutConstraints("flowy, insets 0, gap 0"); mig.setColumnConstraints("[fill, grow]"); mig.setRowConstraints("[][fill, grow]"); setLayout(mig); add(titleBar); add(scrollPane); }